Friday, January 17, 2014

Dev Log: Horror Text Adventure #35

I've been watching a lot of videos on AI and such, and in particular Watson and the Knowledge Graph, etc.  Since I've been trying to figure out a better system for text parsing for awhile, I think all that video-watching gave me an epiphany in the middle of the night.  I think I figured out a better way to create a dictionary.  (Not that it's anything like a knowledge graph, it's just better than what I had.)  Before, the dictionary has a convoluted way of knowing what the entire command is, but if you deviate by a single word it gets completely lost.  So I needed to try something better than that.

So right now I'm making a dictionary of verbs, which basically correspond to functions.  I'll probably also add some prepositions at some point (is that what words like "of" and "in" are called?) so you can look AT a box and you can look IN a box.

So I basically rewrote a lot of the dictionary code.  I *think* it's simpler now, as well, or at least has fewer lines of code.  Though the verb still needs to be the first word the player types.  I'll possibly fix that later, though I can't imagine what else the player might think of typing first besides a verb or game command.  But the player could type "walk bjhhjgf north kjgfd" and the player character will still walk north, and all other junk gets ignored.  I'll probably also need to put ignored words in the error box, so if the player needed a word and it was just a typo, they know what happened.  When the situation presents itself.

So anyway the examine code has been re-implemented, at least as good as it was before--better, in fact, so the player can get a description of multiple items with the same name (so if the player is holding an item and there is another of that item in the room, too, the player gets a description of both).  It has the problem of not being as specific with the error messages anymore, but that's alright for now.

I also reworked the take command, so that should work okay now, too.  Though it checks to see if there is a takeable item called what the player typed, I don't think it checks for duplicates, so I'll also be fixing that later.

The player can also move, as well, just as before.  So mostly it's all in the background, and there's very little difference on the player's end.

After the marathon of fixing the whole dictionary, I was surprised I only had three syntax errors and one runtime error... though of course the runtime error got evil on me.  Still, not bad for rewriting 100+ lines!

It feels good when things are ordered well, so I can see how much progress I've really made.  Too often you can't really tell what you've done, and it feels like you're stuck in the mud.

No comments:

Post a Comment