Page 1 of 1
Interactive Fiction Parser
Posted: Sat Aug 31, 2019 5:59 pm
by hypercardjdowns
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?
Re: Interactive Fiction Parser
Posted: Sat Aug 31, 2019 6:49 pm
by FourthWorld
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?
Re: Interactive Fiction Parser
Posted: Sat Aug 31, 2019 7:09 pm
by hypercardjdowns
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.
Re: Interactive Fiction Parser
Posted: Sat Aug 31, 2019 10:25 pm
by bogs
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!
Re: Interactive Fiction Parser
Posted: Fri Sep 06, 2019 1:05 am
by mwieder
Re: Interactive Fiction Parser
Posted: Fri Sep 06, 2019 1:59 am
by hypercardjdowns
mwieder wrote: ↑Fri Sep 06, 2019 1:05 am
You might be interested in...
Thank you.
Re: Interactive Fiction Parser
Posted: Fri Sep 06, 2019 2:06 am
by mwieder
The LISP-inspired source for the Zork parser is also now on github.
Re: Interactive Fiction Parser
Posted: Fri Sep 06, 2019 3:05 am
by FourthWorld
bogs wrote: ↑Sat Aug 31, 2019 10:25 pm
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!
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.
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.
Re: Interactive Fiction Parser
Posted: Fri Sep 06, 2019 3:08 am
by hypercardjdowns
FourthWorld wrote: ↑Fri Sep 06, 2019 3:05 am
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.
Agreed. It's actually just as much about keeping me occupied as it is creating a game.
Re: Interactive Fiction Parser
Posted: Fri Sep 06, 2019 4:46 am
by mwieder
LOL. I know that feeling well.
Re: Interactive Fiction Parser
Posted: Thu Sep 26, 2019 6:54 pm
by Galeb_G4
hypercardjdowns wrote: ↑Sat Aug 31, 2019 7:09 pm
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.
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.
Re: Interactive Fiction Parser
Posted: Sat May 29, 2021 8:19 pm
by scott93933
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
Re: Interactive Fiction Parser
Posted: Sun May 30, 2021 3:09 pm
by jameshale
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
Re: Interactive Fiction Parser
Posted: Mon Aug 16, 2021 1:01 am
by scott93933
A belated Thank You, James!
Re: Interactive Fiction Parser
Posted: Sat Nov 27, 2021 6:57 pm
by cookiejar
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?