intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Jan 19, 2019 4:47 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Thu Jan 10, 2019 12:04 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5526
Location: Burlington, VT
If you want to write your own parser that works that way, I'd be interested to see it. (I mean, seriously. I like new parsers. But it'd be a lot of work.)

That's not the way the Inform parser works, though, and I'm not sure if there are other parsers that work that way. When the user enters "look hat" it resolves "hat" against every object in scope. If there is a hat not in scope, it doesn't check it. So when it hits the parser error, it doesn't know that "hat" matches something not in scope.

There can be some grammar tokens that match against every object in the world whether it's in scope or not, but that requires looping over every object in the world when it's parsing the command, which takes time.

And then your suggestion about the "silver teapot"... phew. Now if the player types "look top hat" and there's no top hat in sight, the parser is to respond "You don't see a hat here," unless presumably there's a hat that's not a top hat there, in which case it had better be "You don't see a top hat here." And if the player typed "x silver" (no noun) then it needs to print "You don't see anything silver here," which means the parser has to individually keep track of which words are adjectives and which words are nouns instead of referring to the object. This is hard.

Whereas keeping track of individual objects and which ones the player has seen is relatively doable and allows "x silver" to sensibly respond "You last saw the tarnished silver teapot in the mudroom" if the player has seen the teapot, or "You haven't seen anything that can be described that way" if they haven't.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jan 10, 2019 12:49 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5884
Quote:
which means the parser has to individually keep track of which words are adjectives and which words are nouns instead of referring to the object. This is hard.


Especially if your game includes a silver top, a top hat, a hat band, a band stand...


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jan 10, 2019 12:52 am 
Offline
User avatar

Joined: Thu Aug 22, 2013 2:48 pm
Posts: 123
I'm generally with zarf and matt w on this matter. In a largish game with, say, 500 objects, you certainly don't want to be looping over every object-and-input-word combination at runtime. This is not just a matter of performance: A limited scope is helpful because it helps with disambiguation. "PICK UP CLOSED" may reasonably ask the player which of the closed, portable objects in scope to take. If there are no closed, portable objects nearby, but there are two closed doors in the room, it gets more interesting: I think it's all right (but perhaps not ideal) to ask the player which of the closed doors to attempt to take. It would be distracting to ask whether they perhaps meant the cigar case that's inside the safe, over in the library.

matt w wrote:
And if the player typed "x silver" (no noun) then it needs to print "You don't see anything silver here," which means the parser has to individually keep track of which words are adjectives and which words are nouns instead of referring to the object. This is hard.


Indeed. English, in particular, strikes me as a language where words are often used ambiguously as adjectives or nouns. The green house, the golf green, the green party. The antique silver, the silver antique.

But let's get back to the original example of the hat in the box. It would be interesting to try an approach where containers can be flagged as having known contents. The flag is set when the container is first opened or examined/searched. When computing the current scope, descend into open or transparent containers as usual, but also into containers with known contents. Then, when attempting to pick up the hat, the action should be deemed unlikely during disambiguation, because the hat is out of reach. If the action is attempted anyway (because "hat" truly only refers to the object that's currently out of reach, albeit in scope), then it would perhaps be prudent to attempt an automatic action like "first opening the box", and then ultimately rely on the normal reachability rules to determine whether taking the hat is possible.

_________________
Dialog. Tethered.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jan 10, 2019 5:18 am 
Offline
User avatar

Joined: Sat Jun 25, 2016 12:13 pm
Posts: 257
You guys are suffering from thinking that WHATEVER INFORM DOES IS GOSPEL!

Inform does a lot of things right, but this is not one of them.

Looping over 500 objects in 2019. OMFG!! How awful!

OK Inform excuseniks, here's Jinxter from 1987 with an extra hat to demonstrate;

Image


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jan 10, 2019 7:56 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5526
Location: Burlington, VT
jkj yuio wrote:
You guys are suffering from thinking that WHATEVER INFORM DOES IS GOSPEL!


Nah. I'm suffering from having to use, and design around, the existing Inform parser, because writing a parser that would work a different way would be a lot a lot of work.

I think I've elsewhere said that it'd be cool to have a parser that worked by associating things with dictionary words, and for each dictionary word looking up a list of things that could be associated with it at that moment and seeing if it was applicable--rather than the Inform model, which if I'm not mistaken associates dictionary words with things and for each word loops over applicable things to apply the dictionary words to it. But I don't have a few spare years to write such a parser. (And if I'm not mistaken that model is built in to the z-machine and glulx virtual machines, so I'd have to write more than a new parser.)

The Jinxter model could be fine if I could program in it, but there isn't a readily available language for writing Magnetic Scrolls-format adventures, is there?


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jan 10, 2019 8:55 am 
Offline
User avatar

Joined: Thu Aug 22, 2013 2:48 pm
Posts: 123
My primary argument was about disambiguation. I even made a suggestion about how to solve the problem, by carefully altering the definition of scope.

That being said, I happen to care about performance. Many recent text games are noticeably laggy on modern hardware, suggesting that something is seriously wrong inside them. The Dialog parser is fast, declarative and amenable to custom modifications, so I recommend using it as a sandbox for trying out new parser ideas. I'm currently looking at techniques for making it even faster, by combining compile-time analysis with runtime code for dealing with object names that change during play (such as "open" and "closed").

_________________
Dialog. Tethered.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jan 10, 2019 10:24 am 
Offline

Joined: Wed Aug 26, 2015 11:18 am
Posts: 108
Location: The Netherlands
Disambiguation is important, because it helps mapping user input to game objects without asking unnecessary questions (like which of 2 items the player wants to drop while he is only carrying 1 of them).

I made a disambiguation system where the story author can add disambiguation rules to actions.

If the parser finds more than one hit for a subject, it will check with the action if there are disambiguation rules. Next it runs the possible hits by the disambiguation rules and the candidates get points awarded if they comply. In the end, the one with the most points wins.

With this system, each action can have its own rules.

Example:

Code:
“drop [o_object1] in [o_object2]”
  DISAMBIGUATION_RULES
    if testflag(o_object1.f_takeable) then score(5) endif
    If owns(o_actor, o_object1) then score(10) endif
    If testflag(o_object2.f_container) then score(10) endif
  END_RULES

The parser will make permutations if there is more than 1 disambiguity in the user input. So if there are 3 hits for object1 and 2 hits for object 2, it will run 2 x 3 = 6 evaluations against the disambiguation rules.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Jan 10, 2019 11:28 pm 
Offline

Joined: Thu Nov 05, 2015 7:15 pm
Posts: 22
ADRIFT has four levels of scope to decide which object(s) you are probably referring to.
- Does it exist
- Have you ever seen it
- Can you currently see it
- Will it pass the restrictions of the task
Here is what it does:
Quote:
> look
Middle of nowhere.
There are no buildings or plants here at all, just a flat plain of bare nothingness.
Also here is a big heavy chest and a silver teapot.

> inventory
You are wearing a white shirt, and are carrying the silver hat and a top.

> x hat
It is a shiny silver color, but made out of plastic, not the metal.

> open chest
Player opens the big heavy chest. Inside the big heavy chest is a top hat.

> x hat
Which hat? The top hat or the silver hat.

> top
The top hat is like something out of an old music-hall act, though battered and stained with years of wind and rain.

> get hat
(from the big heavy chest)
Ok, you take the top hat from the big heavy chest.

> put hats in chest
You put the top hat and the silver hat inside the big heavy chest.

> close chest
You close the big heavy chest.

> x hat
You can't see any hats!

It keeps adjectives and nouns separate in object names, always using adjectives for disambiguation.
Get automatically figures out that there is only one hat nearby that you are not already holding.
Put hats recognises the plural and looks for all objects in inventory that match the noun "hat".


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Jan 11, 2019 1:47 pm 
Offline
User avatar

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2841
Location: US - Central
jkj yuio wrote:
OK Inform excuseniks, here's Jinxter from 1987 with an extra hat to demonstrate;

Is this "Jinxter" system available to use and write new games in?

_________________
http://hanonondricek.wixsite.com/pyramidif
https://pyramidif.itch.io/


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Jan 12, 2019 6:32 am 
Offline

Joined: Wed Aug 26, 2015 11:18 am
Posts: 108
Location: The Netherlands
HanonO wrote:
Is this "Jinxter" system available to use and write new games in?

This blog gives more information.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group