Interactive Fiction Parser
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 18
- Joined: Sat Mar 02, 2019 2:04 pm
- Location: Missouri, USA
Interactive Fiction Parser
I've decided to create an interactive fiction game using LiveCode. Does anyone know if someone has already created code to parse user input that I could review for adaptation?
Last edited by hypercardjdowns on Sat Aug 31, 2019 7:36 pm, edited 1 time in total.
D. John Downs | Old school HyperCard enthusiast | Novice LC Indy hobbyist
I have an extremely busy career, so please forgive my "come and go" manner.
I have an extremely busy career, so please forgive my "come and go" manner.
-
- VIP Livecode Opensource Backer
- Posts: 9850
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Interactive Fiction Parser
I've been thinking about converting any of the popular libraries used for chat interfaces to LC, given the time to pursue it (read, "not likely soon" <g>).
But for interactive fiction, do you really want the user to have to type into an open field, or would multiple choice provide a better experience?
But for interactive fiction, do you really want the user to have to type into an open field, or would multiple choice provide a better experience?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 18
- Joined: Sat Mar 02, 2019 2:04 pm
- Location: Missouri, USA
Re: Interactive Fiction Parser
Thanks, Richard.
I've been debating this internally for quite a little while now. The trend in much recent interactive fiction is to provide a limited number of choices (a la Choose Your Own Adventure). I'm very torn about this, however. I'm quite old, so far as technology goes. My roots hearken to the likes of Adventure and Infocom. I see much of the new model as "gaming on rails." My heart pushes me toward a more open model.
I'm not talking a parser like Infocom's monster. Something simpler. I've been roughing out what I think (hope) would be a workable framework:
1. Receive input from user
2. Strip all punctuation from input (is this necessary in modern X-Talk?)
3. Strip articles, prepositions, and other unnecessary words
4. Replace synonym verbs with standard verbs (eg, EXAMINE to LOOK)
5. Strip overused verbs to make noun the focus in special cases (eg, LOOK, GO)
6. Ensure verb is the first word in the remaining word cluster
7. Compare remaining word cluster with available verb word clusters (66% match threshold?)
8. Assign an actionable “command” based on the closest matching word cluster
9. Use code to assess the command and take action within the game's current context
This really would be a passion project, something to do for fun as I head toward retirement in a few years.
I've been debating this internally for quite a little while now. The trend in much recent interactive fiction is to provide a limited number of choices (a la Choose Your Own Adventure). I'm very torn about this, however. I'm quite old, so far as technology goes. My roots hearken to the likes of Adventure and Infocom. I see much of the new model as "gaming on rails." My heart pushes me toward a more open model.
I'm not talking a parser like Infocom's monster. Something simpler. I've been roughing out what I think (hope) would be a workable framework:
1. Receive input from user
2. Strip all punctuation from input (is this necessary in modern X-Talk?)
3. Strip articles, prepositions, and other unnecessary words
4. Replace synonym verbs with standard verbs (eg, EXAMINE to LOOK)
5. Strip overused verbs to make noun the focus in special cases (eg, LOOK, GO)
6. Ensure verb is the first word in the remaining word cluster
7. Compare remaining word cluster with available verb word clusters (66% match threshold?)
8. Assign an actionable “command” based on the closest matching word cluster
9. Use code to assess the command and take action within the game's current context
This really would be a passion project, something to do for fun as I head toward retirement in a few years.
D. John Downs | Old school HyperCard enthusiast | Novice LC Indy hobbyist
I have an extremely busy career, so please forgive my "come and go" manner.
I have an extremely busy career, so please forgive my "come and go" manner.
Re: Interactive Fiction Parser
I remember playing some of those on the IIe one of my friends had. From what I remember, they weren't quite as interactive as you might imagine. Although it is true you could type anything in, like "hang my self in the corner", usually if it didn't fit the several patterned responses you got the 'catch-all' response, something to the effect of "You can not hang yourself in the corner".
This was basically the set of 2 strings, concatenated with parts of your string, i.e.
"You can not" && yourText
Ah, the illusion of freedom!
This was basically the set of 2 strings, concatenated with parts of your string, i.e.
"You can not" && yourText
Ah, the illusion of freedom!
-
- VIP Livecode Opensource Backer
- Posts: 18
- Joined: Sat Mar 02, 2019 2:04 pm
- Location: Missouri, USA
Re: Interactive Fiction Parser
D. John Downs | Old school HyperCard enthusiast | Novice LC Indy hobbyist
I have an extremely busy career, so please forgive my "come and go" manner.
I have an extremely busy career, so please forgive my "come and go" manner.
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Interactive Fiction Parser
The LISP-inspired source for the Zork parser is also now on github.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 9850
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Interactive Fiction Parser
There used to be a game developer meetup here in LA back in the day, and we once had Chris Crawford as our speaker. If you know his career, he's made a lot of both open input and multiple choice games.bogs wrote: ↑Sat Aug 31, 2019 10:25 pmI remember playing some of those on the IIe one of my friends had. From what I remember, they weren't quite as interactive as you might imagine. Although it is true you could type anything in, like "hang my self in the corner", usually if it didn't fit the several patterned responses you got the 'catch-all' response, something to the effect of "You can not hang yourself in the corner".
This was basically the set of 2 strings, concatenated with parts of your string, i.e.
"You can not" && yourText
Ah, the illusion of freedom!
He referred to open input as ultimately being a sort is metagame, which he called "Hunt the Parser", where it's really easy for the user to spend a lot of time away from the game's story just to poke around to see what the input parser would tolerate.
That said, the industry has come a long way since then. In those days interactive fiction was one of the few relevant domains for such parsers.
Today we have a renewed interest in this for other applications, mostly chat-driven automation.
So even while a multiple choice setup might be a better user experience, and would certainly be easier to program, the time spent exploring parsers may pay off in the long run in unexpected ways.
Who knows? Maybe before you're done you'll have a good parser and hook it into LiveCode Server and host chat-driven services.
More work, but if it has your attention this seems a good time to capitalize on that motivation to learn as much as you can about it.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 18
- Joined: Sat Mar 02, 2019 2:04 pm
- Location: Missouri, USA
Re: Interactive Fiction Parser
Agreed. It's actually just as much about keeping me occupied as it is creating a game.FourthWorld wrote: ↑Fri Sep 06, 2019 3:05 amMore work, but if it has your attention this seems a good time to capitalize on that motivation to learn as much as you can about it.
D. John Downs | Old school HyperCard enthusiast | Novice LC Indy hobbyist
I have an extremely busy career, so please forgive my "come and go" manner.
I have an extremely busy career, so please forgive my "come and go" manner.
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Interactive Fiction Parser
LOL. I know that feeling well.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Interactive Fiction Parser
This really sounds great, I'll make sure to check if you do end up writing something like that! But it sounds quite complicated, you sound experienced and it could be something you could do, but for us beginners, going for a more "rail-based" interactive adventure (something between the "choose your own adventure" and "visual novel" genres) could be a much easier thing to write.hypercardjdowns wrote: ↑Sat Aug 31, 2019 7:09 pmThanks, Richard.
I've been debating this internally for quite a little while now. The trend in much recent interactive fiction is to provide a limited number of choices (a la Choose Your Own Adventure). I'm very torn about this, however. I'm quite old, so far as technology goes. My roots hearken to the likes of Adventure and Infocom. I see much of the new model as "gaming on rails." My heart pushes me toward a more open model.
I'm not talking a parser like Infocom's monster. Something simpler. I've been roughing out what I think (hope) would be a workable framework:
1. Receive input from user
2. Strip all punctuation from input (is this necessary in modern X-Talk?)
3. Strip articles, prepositions, and other unnecessary words
4. Replace synonym verbs with standard verbs (eg, EXAMINE to LOOK)
5. Strip overused verbs to make noun the focus in special cases (eg, LOOK, GO)
6. Ensure verb is the first word in the remaining word cluster
7. Compare remaining word cluster with available verb word clusters (66% match threshold?)
8. Assign an actionable “command” based on the closest matching word cluster
9. Use code to assess the command and take action within the game's current context
This really would be a passion project, something to do for fun as I head toward retirement in a few years.
-
- Posts: 3
- Joined: Sat May 29, 2021 7:56 pm
Re: Interactive Fiction Parser
I'm also interested in creating a text parser for an interactive fiction game. Like D. John Downs, I've struggled with the multiple choice vs. text parser question and I'm still undecided at this point. I'm an old Infocom junkie, so I really enjoyed discovering the Easter egg-type responses that you'd get if you typed in something funny or bizarre. Discovering those responses was a big part of the fun I had playing those games. My target audience for my game is high school students though, and I'm not sure if they would find a multiple choice game or an open text input game more engaging. That might be more of a marketing question and this is a technical topic, however I welcome your input. My reasoning is that young people grew up in the world of photo-realistic graphical games and are accustomed to a high degree of action, motion, sound, and excitement. So for them, a game with a text parser may seem quaint, old-fashioned, and irrelevant. However, the graphical games they play also give them the freedom to do anything. They can typically move in any direction to explore, shoot at anything (if it's a shooting game), etc. So a multiple choice game may seem overly restrictive to them. As I said, I welcome your opinions on this matter.
Back to the technical stuff. If I go with the multiple choice approach, as folks here have already pointed out, programming will be much quicker and easier, so I don't think I'll need any help with that. As for the text parser approach, I would love to not reinvent the wheel. If anyone can point me to existing open source code for a LC-based text parser for interactive fiction or even flowcharts for such a parser that aren't specific to LC, I'd be grateful.
D. John Downs, how is your game coming along? Are there any tips you can give me?
Thanks, everyone!
Scott
Back to the technical stuff. If I go with the multiple choice approach, as folks here have already pointed out, programming will be much quicker and easier, so I don't think I'll need any help with that. As for the text parser approach, I would love to not reinvent the wheel. If anyone can point me to existing open source code for a LC-based text parser for interactive fiction or even flowcharts for such a parser that aren't specific to LC, I'd be grateful.
D. John Downs, how is your game coming along? Are there any tips you can give me?
Thanks, everyone!
Scott
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: Interactive Fiction Parser
github has the code for an old text adventure game Castlequest
https://github.com/Quuxplusone/Castlequest
seems to have examples of parsing text input.
James
https://github.com/Quuxplusone/Castlequest
seems to have examples of parsing text input.
James
-
- Posts: 3
- Joined: Sat May 29, 2021 7:56 pm
Re: Interactive Fiction Parser
A belated Thank You, James!
Re: Interactive Fiction Parser
I have an IF template and would appreciate help migrating it to LiveCode, eventually wasm in lieu of JavaScript. How can I share the html file?