So for the halloween I thought I would try making a text adventure using wastonx Assistant. Overall it was easy enough and you can download my attempt to see it working.
I wanted to make this just as much a learning exercise as well. So here is my approach.
Plot
The game involved the player trapped in a mansion and has to escape. To do so they need to get certain items and use them in certain ways.
At the same time I would have a ghost that randomly moves through the house and the player has to avoid the ghost or it would be game over.
Creating the map
I started with sketching out a basic map of the mansion as shown below.

The arrows denote up and down. Other lines were north, south, east and west. Location 0 was my inventory and location -1 was if something was removed from the game.
I created an action called “Where am I?” and created a step for each location. The location numbers lined up nicely.
For each step I also set the values of session variables that map to the direction the player go from that location. If the direction was 0 then they could not go that way.
Movement
I created an action “Go” which checks to see what direction to go in by checking each session variables value against the direction. Once a move takes place I update a current_location session variable and call “Where am I?” as a subaction to detail the new location.
Writing up the locations
Rather than write up for each location, instead I used Granite3 with Ollama to create the descriptions. As the model was just recently released I wanted to see how well it could do.
Overall the descriptions were ok except it had a thing for the air getting colder everytime you entered a room. I ran the descriptions a few times and chopped the bits I liked.
Creating the ghost
At first I planned to have the ghost randomly move around the house with it’s own ghost_location session variable. This would be updated every time an action took place (eg. get, drop, move, look, etc)
What I noticed almost straight away is that you ended up dying without even realising it. So I had to code in a way to give a player the chance.
With this I set up this flow.
- If the ghost is in the same location as player, then game over.
- Move the ghost.
- If the ghost is in the same location as player then warn them.
- If the ghost location matches any of the location directions for where the player is, then warn them of that direction.
This for the most part worked, but there was still incidents of the player getting jumped on without warning. Or forced the player to move to another location and back, sometimes that isn’t an option.
So I added a “hide”, “unhide” command to protect against the ghost if it was in the room and you didn’t want to move.
Hiding disabled the ghost but I forgot to disable doing actions. So you could hide and move around the mansion. So hiding was changed to lock you in the room and prevent taking actions.
Testing this was painful as I desperately roamed the house looking for the ghost. In hindsight locking the ghost to two rooms would have sped up debugging.
Coding game over
With the ghost causing game over I had to create a Game over and Game start action.
The reason for the game start is you cannot call to the Greeting built in action.
Without it the only way to restart was to restart the conversation through the web client UI.
Dealing with items
For these I created an array of objects in the following format.
{
"type": "synonyms",
"value": "Car keys",
"synonyms": ["car keys", "keychain", "keys"],
"location": 0,
"description": "Your car keys. Not much use until you get your car fixed."
}
The type of “synonyms”, value and synonyms fields allow you to construct the object as an entity.
The reason for an array instead of a dictionary is that there are two commands that make life easy.
That is filter() and joinToArray().
Because of how assistant handles variants, just using a normal dictionary can sometimes have side effects. Using those commands also negates the need for loops or complex formatting.
With this array the following commands need to work against it.
- inventory
- list items in area
- get an item
- drop an item
- examine
- extra commands (eg. read/light)
The get and drop used the technique of:
- Do they mention the item beforehand?
- Is the item in their pocket or location?
After that I swap out the location by the following:
- Filter the item in question to its own object.
- Filter out the item from the overall items.
- Update the object and add it to the list again.
Inventory and listing items in the room again was just a filter based on location and using joinToArray() to format the output.
Win condition
To win the game certain items have to be in certain locations and other items used in the right sequence. It was fairly straightforward. Only checking the conditions as needed.
Play testing
My son volunteered to test it. It was at this point you realise your peception of the game of the player isn’t yours. For example if you have “You sense an evil presence to the north” you don’t expect them to do it more than once. :/ I added in some clues and hints into the game to make it possible.
Speed running it took around 3 minutes to complete. It should take around 10 minutes.
Basic enough game but a good diversion to see how assistant can handle certain use cases. Hope you enjoy!













