Implementing ChatGPT's Parser

That’s kind of where I was going with this. I was big into a few roguelikes for years, but eventually started to feel I was making too many thoughtless moves. I use the game of Go as one standard: right now I’d rather think deeply to make 100 moves than blaze through ten thousand. Now I dimly envision a roguelike with more thinking than doing.

Seems like if the IF player is going to put much work into individual inputs, they’ll have to be playing a game that calls for the same degree of deep thought every move. Hoping some people can spell out their ideas in this direction for me.

Was that where SpiritAI was aimed? I tried to do a bit of research and got the impression it had to do with making deeper NPCs, but I don’t fully understand what the concept was.

3 Likes

I hadn’t considered the processing power required. That’s a good point. And I imagine is has a rather large … database? … of what it “knows” as well.

2 Likes

So, just read something disturbing about ChatGPT.

Long story short, they contracted with underpaid workers in Kenya to identify and tag abusive and illegal content all day long, so this material could be fed back into ChatGPT to help it identify and filter out the ugly stuff.

ChatGPT basically ate the internet to produce what it does, but, as anyone familiar with the internet knows, the most vile and evil stuff imaginable is among that same data set. Rather than the impossible task of filtering out the bad stuff from the training sets, ChatGPT has a secondary part that is trained soley with nasty labeled data sets so it can recognize the really awful stuff, and censor it out of ChatGPT’s original responses to queries.

The article starts out fairly tame and but then goes far beyond typical global south labor exploitation.

Like, ALL the content warnings on the link below.

I swear you can’t use or buy anything without a hidden moral crisis these days.

ETA: Oh no… that was an unpleasant rabbit hole to end the day with…

Apparently, it isn’t just OpenAI that pays pennies to read & label horrifying content. Google, Meta, & Amazon employ literal refugee camp residents to label all of their nasty data. Parody really is dead.

Again, clickers beware.

13 Likes

I’ve been thinking about this. Inform standard syntax is good for English but may not be too good for other, more exotic languages.

I usually just use VERB NOUN [POS NOUN2] which translates to Action-Object-Indirect. Sometimes we add characters too, in terms of ordering an NPC to do something.

But what if we want to change the word order?
POLLY, EAT CRACKER
EAT CRACKER, POLLY!

PUSH GREEN BUTTON
GREEN BUTTON, PUSH!

How does Inform Parser compares to the original Infocom? Or to Magnetic Scroll?

Can we have a game where we just specify the object, and have the game intelligently choose the appropriate action? :thinking:

1 Like

SCUMM games did this. Each interactable object had a default verb and right-clicking would activate that. Mostly it was just “look at”, but doors would default to “open”.
image
Left-clicking would “walk to door”, but right would “open door”. I haven’t actually left-clicked anything (in the game that is) before taking that screenshot.

I feel like that would translate easily into IF.

> GREEN BUTTON
(assuming you mean to press the green button)
The conveyor belt starts running.
4 Likes

As long as the game lets one LICK GREEN BUTTON too, if one were so inclined, I’m on board.

6 Likes

Do you have a green tongue? I would expect licking green buttons to rub off on the player somehow… or have other side effects

Alice says: "Hey! a green button! I wonder what will happen if we press it?"
Bob> lick green button
You lick the green button.
Alice says: "WTF are you doing, Bob???"
You start foaming at the mouth.
Alice says: "Looks like the paint on that button does not agree with you."
Your tongue turns black and starts to smoke.
Alice says: "Help! We need a doctor pronto!"
Your vision turns black and you collapse, still foaming and spewing blood.
[NOW THIS WAS A DUMB MOVE. CARE TO TRY AGAIN?]
Bob> yes I should not listen to advice on the intfiction.org forum.
7 Likes

Sure, but then you have to design a game where the inputs are object names. Assume that no player will ever type a verb.

(Myst more or less has this design philosophy. You click on an object and the game does the appropriate thing. That’s not entirely true; I’m simplifying away a couple of puzzles. But that’s the kind of game design which results from this idea.)

3 Likes

As it turns out, the green button is very very cold, so your tongue sticks to it.
:stuck_out_tongue:

Regarding what we use as parser commands when playing:
I know this makes me a bit of a weirdo, but I kind of enjoy using full sentences. Simply because I can. LOL … When moving I’ll use the std “n,s,w,e, etc,” but a lot of times I’ll use full sentences for other stuff. When reading the transcript back when need be it just … reads better i guess? i dunno. LOL

2 Likes

Or would you? Again, SCUMM games did this with their default verb – left click to do whatever the sentence bar says (“walk to door”), right click to do what the automatically highlighted verb says (“open door”). If your IF parser is given only a noun as input, and that noun refers to an object with a known default verb, have it say something like “(assuming you mean to open the door)” and try doing that instead :woman_shrugging:

Heck, you might even make it change the default verb, so an already-opened door defaults to “close” instead.

3 Likes

The discussion on this topic has kind of drifted by now (in a good way), but I still want to add something to the original question: I think ChatGPT does indeed show some potential at being a usable text-adventure parser pre-processor (whether such a pre-processor would be a good thing for the game-play experience is another question entirely). You can feed natural-language sentences into ChatGPT and make it spit out sanitized text-adventure commands. The results aren’t entirely amazing, but they aren’t that bad, either. I could post examples, but I don’t want to flood the topic with a super-long post, so I’ll keep it short:

  • “take the bottle from the table” (Take bottle, 95%)
  • “swim in the ocean if it’s possible” (Swim, 80%)
  • “I would like to give the flower to the man I just spoke with” (Give flower, 80%)
  • “do you love me?” (Not a text-adventure command, 0%)
    (I was impressed by number 1 and 4 and disappointed by number 3.)
2 Likes

I’m not saying that pursuing better parsers is a bad idea, but I’m curious what problem we’re trying to solve here. As a player, I always thought the Infocom style parser hit a pretty sweet spot of being advanced enough to allow me to express what I wanted, while being simple enough not to overwhelm me with choices.

(Arguably, it could even be a bit too clever for its own good. Did you know that in a few cases in a few Infocom games it makes a real difference if you specify that you want to perform an action “carefully”? I had no idea until the source code leaked, and I’m not sure I like it.)

To me, other things are much more important for a pleasant gaming experience. Compare these two exchanges from Zork I (Infocom) and Guild of Thieves (Magnetic Scrolls):

>OPEN SACK
Opening the brown sack reveals a lunch, and a clove of garlic.
>OPEN BAG
The swag bag is now open.
>LOOK IN BAG
The swag bag contains a lamp.

Magnetic Scroll’s parser had a few tricks up its sleeve (e.g. “USE SHIRT TO THE THE HOE AND THE RAKE TOGETHER” or “PLANT THE POT PLANT IN THE PLANT POT WITH THE TROWEL”), but having to type and extra command to find out what was in a container… that one bugs me.

I also liked how Infocom games would often set “it” to point to relevant objects outside of what you explicitly typed. E.g.

>WEST
The kitchen window is closed.

>OPEN IT
With great effort, you open the window far enough to allow entry.

Little touches like that can make a lot of difference. At least to me.

But I’ve never designed a game, so I’m curious… As a designer, have there been cases where there was something you really wanted to implement but couldn’t because you knew the the parser just couldn’t handle it?

6 Likes

I’m curious what problem we’re trying to solve here.

I thought we were convincing the original poster that it is a bad idea.

1 Like

Wait, really? I didn’t know they ever incorporated adverbs—which situations were those?

3 Likes

I don’t think it’s so much that people are trying to solve problems for current players as that they’re wondering if this could provide a solution to the problem of parser games being inaccessible to new players.

4 Likes

The parsing is quite primitive. Here’s a bit of code from the PARSER routine in Deadline:

			     (<OR <EQUAL? .WORD ,W?CAREFULLY ,W?QUIETLY>
				  <EQUAL? .WORD ,W?SLOWLY ,W?QUICKLY
					        ,W?BRIEFLY>>
			      <SETG P-ADVERB .WORD>)

Which I think means that if any of these words appear anywhere in the command, that’s the adverb. Actions can then check what P-ADVERB is.

Sometimes it’s just cosmetic, as in this example:

>CLIMB STAIRS QUIETLY
The stairs are still quite noisy even when walking up very slowly.
Stairs
You are on a landing halfway up the flight of stairs. You notice that the stairs
do indeed make quite a noise when stepped upon.

One example from Seastalker has a much bigger impact. In the crawl space of the submarine, all your commands will go through this routine:

<ROUTINE CRAWL-SPACE-F ("OPTIONAL" (RARG <>))
 <COND (<==? .RARG ,M-BEG>
	<COND (<EXIT-VERB?> <MOVE ,ENGINE ,SUB> <RFALSE>)>
	<COND (<GAME-VERB?> <RFALSE>)>
	<COND (<==? ,P-ADVERB ,W?CAREFULLY> <RFALSE>)>
	<COND (<AND <PROB 20 ;10>
		    <FSET? ,ENGINE ,ONBIT>
		    <NOT ,SUB-IN-TANK>
		    <NOT ,SUB-IN-DOME>>
	       <TELL
"|
Suddenly the " D ,SUB " begins to shake violently! Your foot has
knocked an engine bearing out of alignment! It will be necessary to
surface at once and await rescue! Your mission must be aborted.">
	       <FINISH>)
	      (<AND <PROB 20 ;10>
		    <FSET? ,GASH ,INVISIBLE> ;<NOT >>
	       <FSET ,ARM ,MUNGBIT>
	       <FCLEAR ,GASH ,INVISIBLE>
	       <TELL
"There's a sharp pain in your right arm! A flood of wet warmth and a
spreading red stain mean you've seriously gashed your arm
on a sharp metal corner!" CR>
	       <RFALSE>)>)

Which, as I understand it, means:

  • Leaving the room (EXIT-VERB?) is safe.
  • Meta-verbs (“VERBOSE”, “SAVE”, “SCORE”, etc.) are safe.
  • Any action that’s done “carefully” is safe.
  • Otherwise, there’s a 20% chance that you’ll either wreck the submarine (if the engine is on) or injure your arm.

And that’s just annoying!

What I found at a quick search through the code (but haven’t always verified in game):

  • [Deadline] Examining the note paper carefully will reveal indentations on it.
  • [Deadline] Examining or reading the newspaper carefully is the same as reading the second section.
  • [Deadline] Examining the bookshelves carefully should reveal the hidden button if George has used it, even if you didn’t see him do it.
  • [Deadline] Climbing up the stairs quietly or slowly will tell you they’re still noisy.
  • [Deadline] Reading or examining something carefully takes more time.
  • [Witness] I think the game prevents you from examining objects in the office carefully while you’re sitting down. It’s a bit unclear to me.
  • [Witness] Apparently there’s a difference between comparing Stiles’s shoes to plaster casts of footprints and doing it carefully. One may tell you they seem to match, while the other may tell you they match perfectly. (Putting the cast on the shoes has the same effect.) But the game doesn’t seem to actually use the information that you’ve matched the footprints perfectly, even though it sets a variable to indicate that you’ve matched them.
  • [Witness] Same thing with the boots, but this time the information that you’ve matched them seems to actually be used, albeit only (?) to say that this is not enough to incriminate Phong.
  • [Witness] You can find the medical report by searching Monica’s dressing table carefully, even before she tells you about it.
  • [Witness] You can examine Mr. Linder’s papers carefully, and the game will tell you that you look more thoroughly instead of quickly. You still won’t find anything.
  • [Witness] Examining the clock carefully after the murder will reveal the powder around the keyhole, without having to examine the keyhole separately.
  • [Witness] Comparing the green wire to the green wire spool carefully says they fit perfectly, rather than just appearing to be similar. Again, the game doesn’t seem to do anything with this information, even though it sets a variable to flag that you’ve matched them.
  • [Witness] If you compare the two handguns carefully it will say they are virtually identical, rather than just appearing to be very similar. Again, a variable is set to flag that you’ve made the match but it’s not used.
  • [Witness] Reading or examining things carefully takes longer.
  • [Cutthroats] Doing anything slowly takes more time, same as if you’re thirsty, hungry, drunk, or tired. I think.
  • [Seastalker] It looks like the adverb “privately” can be used as an alternative way of asking or telling about a private matter.
  • [Seastalker] “SEARCH ROOM CAREFULLY” takes longer time than just “SEARCH ROOM”, and the game will say “careful search” instead of “brief search”.
  • [Seastalker] Examining the file drawer near the start of the game carefully will say that you look more thoroughly, instead of quickly. You still won’t find anything, though.
  • [Seastalker] If you examine the submarine’s reactor carefully, the game will refer you to the manual.
  • [Seastalker] The aforementioned crawl space nonsense.
  • [Seastalker] Examining or reading any object carefully takes more time.

I may have missed a few.

Either way, I get the impression that it was an idea that originated with Deadline, lived on in a few games, but never really caught on. And that’s a good thing, if you ask me.

7 Likes

Interesting! I know a couple of other games that have used adverbs, and it always ends up feeling really hard to use as a player for me:

And apparently this game (which I haven’t tried):

2 Likes

The problem to solve is finding a different sweet spot from the one we’ve been jumping up and down on for forty years. :)

I am not personally invested in this problem, but someone could be.

5 Likes

I know this is a bit off-topic, but… imagine the underpaid workers helping training the AI recognize bad words, but instead underpaid workers are looking at images to mark regions in the images as interesting so an AI can learn. And imagine that some of those images are taken by cameras in people’s homes and that some of those workers for fun share funny private images online. That is how bad things are now.

OK, well, back to parsers I guess. I will not further derail this.

5 Likes

Regarding parsers, I am impressed by what some parsers can parse, but I rarely type anything more advanced than “x mailbox” or, rarely, “look under bed” or “give carrot to troll”. If that was all a parser could handle and games were made within those limitations I would probably never miss having a more advanced parser. I always thought the Infocom style parsers that can handle very long and complex sentences were mostly to show off and for advertising, not that useful in practice. I find playing games with simpler two-word parsers quite liberating as I know the correct thing to type to solve a puzzle is not going to be something worse than guessing the correct verb and noun.

And judging from every time I looked in a walkthrough for a game it is extremely rare that a player need to input anything more than 2-3 words to complete most games? Even if most modern games will accept long inputs you can happily play through and complete most games without ever typing anything that a low-end 1980’s parser would probably almost be able to handle? So AI-driven parser whatever that would mean sounds like overkill to me.

5 Likes