Author Topic: Text parser autocomplete  (Read 2571 times)

0 Members and 1 Guest are viewing this topic.

Offline troflip

Text parser autocomplete
« on: June 22, 2016, 09:58:19 PM »
http://icefallgames.com/Games/CascadeQuest/

What do you think? Useful?

(down arrow to commit the selected autocomplete term, and right/left arrows to switch terms - keyboard controls don't quite feel right yet, I know).

I think it would be hard to get this working with Sierra's interpreter (there's no way to access the vocab resource from script, so you'd have to pre-process it offline and load it from a text file, and it would probably be pretty slow). But possibly ScummVM could do something like this (although it required some changes on the game script side too, but that could probably be avoided). Of course, it wouldn't be "historically accurate".


Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Collector

Re: Text parser autocomplete
« Reply #1 on: June 22, 2016, 11:26:45 PM »
I like. My main peeve with the parser is having to play "what word am I thinking of now" with the developer when the synonym list is incomplete. I imagine that this is especially frustrating for non-native speakers. It would probably also help slower typists during timed events.
KQII Remake Pic

Offline MusicallyInspired

Re: Text parser autocomplete
« Reply #2 on: June 23, 2016, 12:35:54 AM »
THAT is nice!
Brass Lantern Prop Competition

Offline OmerMor

Re: Text parser autocomplete
« Reply #3 on: June 23, 2016, 02:24:33 AM »
VERY nice Phil!

Offline gumby

Re: Text parser autocomplete
« Reply #4 on: June 24, 2016, 09:06:19 AM »
Very impressive.  Definitely better than Scumm games where you had an array of verb buttons.  I wonder how it would scale with a large vocab.  EDIT:  Seems to scale just fine.  How did you decide which verbs to display upon the first character input?  For example, 's' brings up a set of words, 'sw' brings up a different set.  Just alphabetically displaying the first x matches?

Dang it, making me reconsider my current point-and-click approach with Zork.

I think it would be hard to get this working with Sierra's interpreter (there's no way to access the vocab resource from script, so you'd have to pre-process it offline and load it from a text file, and it would probably be pretty slow).

For clarification, do you mean loading portions of vocab from a text file or loading them from text resources?  I've done something similar to this by putting all verbs in a text resource, nouns in a text resource, etc.  I did this to augment the parser functionality, things like noun disabiguation.  But that was a new game, not retrofitting an existing game (not even sure if doing something like that would be possible?).
« Last Edit: June 24, 2016, 09:28:13 AM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline troflip

Re: Text parser autocomplete
« Reply #5 on: June 24, 2016, 01:36:42 PM »
How did you decide which verbs to display upon the first character input?  For example, 's' brings up a set of words, 'sw' brings up a different set.  Just alphabetically displaying the first x matches?

I do a prefix match, then I sort them according to this:
- hard-coded list of common words have highest priority (look, take, man, woman, use etc...)
- any recently used words have the next highest priority (the more recent, the higher priority)
- anything in any currently loaded said string has the next highest pri
- then comes all the other words

From that sorted list, I display the first n that fit within a certain number of space on the screen.

I'm thinking about prioritizing verbs for the first word, and then deprioritizing them for subsequent words in a phrase too.

For clarification, do you mean loading portions of vocab from a text file or loading them from text resources?  I've done something similar to this by putting all verbs in a text resource, nouns in a text resource, etc.  I did this to augment the parser functionality, things like noun disabiguation.  But that was a new game, not retrofitting an existing game (not even sure if doing something like that would be possible?).

I suppose a text resource *could* work, but that seems awkward. You could probably just extract the vocab resource to a folder and have your script code load it and work on that. I load the vocab resource and put it into a blob that is optimized for fast traversal (attached code)... it uses the minimum memory possible. But actually I think the vocab resource is laid out in a pretty similar way.

The problem is that - if implemented in game scripts - this would be loaded into the heap. So there goes a bunch of heap space. My 11KB vocab ends up being about 8k when I load it (I prune out short words). I guess you *could* use a text resource (which would go in hunk space), and maybe try to stick all words of one letter in an entry. But you'd want to do it in a compressed form, again. I guess you could have an offline tool that loads the vocab resource and copies the section for each letter directly into a text resource entry. I don't know if there is a limit on the size of entries in a text resource. In my case, all the s words (the most common letter to start with I think) fit into about 1000 bytes.

So if you did that, then at most you have all the data for a particular letter in heap space at once (since you'd have to load them into a buffer to start processing them).

Then comes the problem of sorting them (to provide the best words to the player) from script. There are over two hundred s words, so when you type 's' in my case, that's a 200 item sort. No problem for C# code on a modern computer, but I dunno how it would be in the Sierra interpreter running on DOSBox.

Actually, if the word priorities are from a fixed set of numbers, a bucket sort would be pretty fast.

Of course, at some point you're decompressing the strings to their full size also, and so that's going to use up more heap. Unless you can be clever and only decompress the final top n strings you present to the player.

It certainly would be an interesting challenge getting this to work.

« Last Edit: June 24, 2016, 01:40:31 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Text parser autocomplete
« Reply #6 on: June 24, 2016, 04:04:56 PM »
Where were we at with the VGA SCI1 parser interpreter? Can this be used with that? Would be interesting to experiment with.
Brass Lantern Prop Competition

Offline Kawa

Re: Text parser autocomplete
« Reply #7 on: June 24, 2016, 04:17:43 PM »
Where were we at with the VGA SCI1 parser interpreter? Can this be used with that? Would be interesting to experiment with.
> PUNCH MAN
You would, but you can't reach.

Offline lskovlun

Re: Text parser autocomplete
« Reply #8 on: June 24, 2016, 04:30:03 PM »
Where were we at with the VGA SCI1 parser interpreter? Can this be used with that? Would be interesting to experiment with.
> PUNCH MAN
You would, but you can't reach.
Surely you mean:
You are not close enough.

Offline troflip

Re: Text parser autocomplete
« Reply #9 on: June 24, 2016, 04:37:43 PM »
Where were we at with the VGA SCI1 parser interpreter? Can this be used with that? Would be interesting to experiment with.

From what I recall, I uploaded a version of the Xmas Card demo where the parser was fully working. This could be used as the base for a VGA parser-based template game. Of course, Companion is optimized for compiling/editing SCI0 and SCI1.1 games. Should work for SCI1, but I wouldn't be surprised if there are bugs since it's not a well-tested code path.

No reason autocomplete couldn't be used with that, but right now the autocomplete functionality only exists in my Unity-based interpreter (which isn't released, and only supports SCI0). So someone would need to write SCI-script-based autocomplete functionality.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Text parser autocomplete
« Reply #10 on: June 24, 2016, 06:02:44 PM »
Surely you mean:
You are not close enough.
I know what I wrote. There is no Ego on-screen so I put the player in the audience. Lacking tomatoes, you can't reach from there and you can't move closer.

Offline troflip

Re: Text parser autocomplete
« Reply #11 on: June 24, 2016, 07:02:21 PM »
I know what I wrote. There is no Ego on-screen so I put the player in the audience. Lacking tomatoes, you can't reach from there and you can't move closer.

Idea: implement a first person shooter (or first person something) in SCI. Have a separate process that parses a scene/model file given the player's current location and direction, and generates a vector pic resource for it (as seen from the player's eyes - it could even do lighting)... make it export the pic patch file and then tell the SCI interpreter to load it.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Text parser autocomplete
« Reply #12 on: June 24, 2016, 07:05:09 PM »
Railshooter, man. With SEQ transitions between action scenes.

Offline troflip

Re: Text parser autocomplete
« Reply #13 on: June 25, 2016, 12:42:16 AM »
Possibilities are endless...


Link in the OP updated with better keyboard management. Tab autocompletes the first word, down arrow highlights first word... following which right and left arrow change words and return commits the word. So... more like today's typical search box autocompletes.
Check out my website: http://icefallgames.com
Groundhog Day Competition


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.128 seconds with 24 queries.