My last blog post about AI Dungeon focused on how to use the user interface to corral the AI in the directions that you want to story to go. In this post I will discuss how to use the input text itself to accomplish some of this. This approach can be more rewarding because it reduces that nagging feeling that you’re cheating somehow.
Complex Actions
The first, and probably most important thing you need to know is that you can make several things happen at once using complex sentences, or even multiple sentences as input. For example, if you want to say “By Grabthar’s hammer, I avenge thee”, and then plunge your sword into your enemy, then doing this in two actions just may not work. It’s best to do it with one action, something like this:
Yell “By Grabthar’s hammer, I avenge thee”, while plunging my dagger into Sarris’ heart.
Similarly you can also suggest actions for other non-player members of your party. This is almost essential if you want to conduct a coordinated attack:
Slash my sword across the dragon’s belly, then Rasputin casts a spell to pour salt into the dragon’s wounds.
You can even suggest actions for your enemies:
Retreat backwards avoiding my carefully laid trap. As the orc follows you he steps right into the bear trap, seriously harming himself and virtually immobilizing him at the same time.
Note that if you use multiple sentences the AI will only translate ‘I’ into ‘You’ in the first sentence, and so you really have to refer to yourself as ‘You’ in any subsequent sentences.
Literary Devices
Because the AI was trained by reading millions of web pages, and perhaps even uncopyrighted literature, it has some sense of how stories are put together. This includes at least some of the more obvious literary devices, especially mood and foreshadowing.
Mood
You can set the tone of your game/story just by the way you describe things. Choose some adjectives that are gloomy, sad and dark, and you’ll see bad things start to happen. Similarly, describe thing using bright, upbeat and happy adjectives, and you may see more positive events happen. You should be aware though that the AI tries to generate conflict, so positive events may be a little less likely.
Foreshadowing
Often, just the act of mentioning something can make it happen. For example, saying “OK mom, I’ll take the the food basket to grandma. I just hope I don’t see that big bad wolf on the way.” will definitely increase your chances of encountering the wolf. So if you want something to happen, even if that means encountering a specific enemy or situation, then be sure to mention it. The more you mention it, the more likely it will happen.
The reverse is also true. If you want to avoid something, then definitely don’t mention it. Sometimes I will want to discuss some topic with a character, but I want to avoid triggering it into occurring. In these cases I’ll often just not discuss it after all, or if I do I’ll choose obscure ways to refer to the topic that I don’t think the AI will understand. It’s a bit like how parents will use special language and innuendo to discuss sex in front of their young kids.
Forgetting and Ignoring
As I mentioned in my last post, that AI can be very forgetful. It is unlikely to remember anything past about 10 or so full lines of text. While this can be frustrating, it can also come in handy sometimes. If something happens that you wish hadn’t, instead of redoing or altering the text, you can sometimes just ignore it and eventually it will be as if it never happened. Of course, if the AI does refer to it again, that you’ll have to take more drastic action.
Similarly, sometimes the AI will deliberately place potential obstacles in your path in order to generate conflict. How you react to these will affect what happens. For example, suppose your character walks into his apartment building and sees a big guy standing there apparently looking for someone. If you react to this man or even mention him in any way, then he will probably react to you as well. For example, doing the following “Walk past the big man, ignoring him completely” will probably not work because you mentioned him in your attempt to ignore him. However, if you really do ignore him in every way, as if he were nothing more than a piece of the scenery, then you have a better chance. For example: “Walk through the lobby to the elevator and push the button for my floor” might work.
Creation by Assertion
Perhaps the most powerful trick that you have available to you is the ability to create things just by referring to them as if they had always been there. A simple example of this is your inventory. The AI does not keep track of what you do or don’t have in your possession. This means that you can create items out of thin air just by asserting that they are there.
Pull the gun out of my pocket and shoot him.
You can even create people this way. It’s often fun to have friends with
you on your adventures. Try typing this as your first command the next
time you play:
Turn to my travelling companion Pippin and say “Well, we’ve made progress, but we still have a long road ahead of us.”
This idea is also applicable when it comes to having conversations. As a general rule, the AI simply will not remember the details of discussions that you previously had with other characters. In some cases it can get really frustrating when you have to rehash an issue that you already resolved. To avoid this, it can be really valuable to remind characters of what they said or agreed to previously.
Do you remember when you said ‘X’ and then agreed to ‘Y’. Well …
In fact, you can even do this when you never even had such a conversation. You can even change history by giving the characters reminders of events that directly contradict what actually happened before. Just make sure that enough time has passed between then and now.
It is possible to control the story itself in a similar way by asking leading questions. For example, asking “Who poisoned the King?” could result in almost any answer, perhaps leading you down a whole complicated sub plot that really isn’t much fun. Instead, if you ask “Do you think the evil Necromancer is responsible for poisoning the King?”, then you will very likely get some form of “yes” as an answer.
In fact, you will probably find that you must do this on occasion. Sometimes the AI just seems to run out of ideas and will get stuck. In some cases the AI may even encourage you to fill in the blanks by dropping it’s own leading hints, something like this “As you talk to the old man, you realize that he looks familiar…” If you respond by saying “Dad? Is that you?” then from that point on, the old man will be your long lost father.
Be Creative
As a personal note, I find it particularly fun to use these advanced techniques in unusual and creative ways. You often have a lot more options available to you in a given situation than you realize.
One way to do this is to subvert one type of trope or storyline by using another. For example, one time I had a character who discovered a ghost in his house. I didn’t really want to play a ghost story, so I decided to try out some of these techniques. I spoke to the old woman’s ghost as if she was just a neighbor who had come by earlier looking for her dog. I told her that I had found the dog, and when I opened my basement door the dog came running out and rushed up to her, all excited to see her (creation-by assertion combined with several complex-actions). Pretty soon she was thanking me and giving me a hug for finding her dog (she was still cold and clammy to the touch though). Then the two of them left together, happy to be reunited.
You can do this sort of thing on a smaller scale too. Sometimes the AI will have your character do or say things that are exactly the opposite of what you would have chosen. Instead of just altering the text, it can be fun to see if you can repair the situation, or even turn it to your advantage. One approach that I’ve used is to quickly invent some backstory that explains why you did or said it. You may find that you can actually advance the plot more quickly this way.
For me, experimenting and probing to see what the AI will accept and what it won’t adds a whole new dimension to the game. Using these techniques to find creative ways to solve problems actually makes the game even more fun.