Download

A text-adventure template

So, Colossal Cave Adventure was a thing…

Which do you want to read:
A) Long story
B) Long story short

A. [Long story]
I’ve already mentioned this in my game’s devlog, but I made a text-adventure template half a year ago as a part of my Master’s Thesis project… and now that I was supposed actually start implementing it to the project I felt that it kind of sucked. So, I thought I should rebuild it from scratch (something I apparently like to do a lot), this time I’m making it room/area-based, like Colossal Cave Adventure. I’ve talked about it a bit on my devlog but figured, since the subject is kind outside of my actual game concept and idea that it would be better off on it’s own topic for anyone more interested in the template or implementation.

B. [Long story short]
I started making a text-adventure template. It’s room-based, like Colossal Cave Adventure for example and I figured I might as well make a topic about it for anyone who is interested in the idea.

Goals of the template:
No plugins
All blueprints
A game should be writable with spreadsheets alone, without having to touch the code at all.

Currently everything is displayed with widgets, which, as far as I know, is the best way to realize a text-based system.

Progress so far:
Moving between “rooms” (also shortcuts like “north” and “east” etc. are doable) and taking items from the rooms. All possible directions from each room are defined in spreadsheets per room, so they can be whatever the creator wants them to be, just like the used vocabulary and shortcuts.


Look/examine functions, for rooms and items. it’s also possible to add hidden items that are only revealed after the room is examined. And just like with directions items can also have several call names so players don’t need to guess a specific name but can guess any number of call names (again defined through spreadsheets). Inventory also works with a single word and items in it can be examined at any time with the same names that they can be obtained from the map with. (unless the one of the items in the map overwrites one of the call names (for example in the case of several swords)

Items can also be dropped, which changes their field description from their initial field description (in case the creator wants to make a more dramatic reveal of the items, like say for “the master sword on the pedestal”). I’ve also added some possible events (only a few so far) such as automatic movement between maps.

There is also support for NPCs that can be talked to and the player input can locked for specific conversation so the player cannot escape from it until they answer. For example in the case an NPC asks for the player’s name, which can be tied to a variable which can then be used wherever, same with choice based input locks where players can be given possible answer (and synonyms for each answer) which affect the response they get. The characters can be placed in different rooms and they can be given both multiple lines of dialogue, that change as you talk to them multiple times, as well as multiple stages of conversation that change with the story/room progress.

All events are recorded after they are launched as are their results so that they can leave a permanent mark… but it is also possible to make events and conversations that don’t record variables.
Again, everything is doable from spreadsheets, so that the writer doesn’t need to touch any code while writing the game and its assets.

it’s still under work, and there are quite a few things I’m planning on adding, like more event types, action types (like using and equipping items, attacking, etc.), and enemies and combat.
Since I doubt there is much interest for text-adventures I might release the system for free after it’s done and/or make a tutorial (or more detailed posts on this topic) on how to make it, if anyone actually is interested.
And if anyone interested has any questions or improvement or feature ideas, I’m all ears.

Ps. As it is currently part of my Master’s thesis project which does not require all the functions that I’m planning on adding to it, the progress will slow down after I meet the minimum requirements, and will remain more slow-paced until I finish my thesis.

Hello @BulletEye

I’m still a fan of Text-based games, although nowadays I would add Text-to-Speech Narration & Speech-to-Text Voice Recognition as I’m looking for games I can play hands-free while a do other tasks. Would be great for long road trips too.

I occasionally visit ironrealmsand choiceofgame just to see if text-based games are going strong. In fact, I attempted to write a coplayer IF story which did more to inspire me to develop a video game in UE4.

I commend your effort. Perhaps some Devs would consider the Text-based format to be a complete waste of UnrealEngine Power. But, I see things different, Perhaps its the foundation for computer games that can be played in multiple formats: 3D Visuals, 3D Text, 2D Text-only, Audio-only.

Providing multiple interactive formats has been something I’ve desired to accomplish as fan of Text-based games. At one-time or another I considered developing a ‘Narrator’ (glorified output logger) to annotate input/output events at runtime into text like a text-base game.

I can easily visualize this text-adventure engine coupled with procedural scene generator, using the text descriptions to query a object database to generate scenes similar to the Objectnaut data-driven engine used inScribblenauts. If we wanted to get real fancy, we could use ML to drive it.

Keep up the great work!

Hi @TechLord

Thanks for the interest!

The funny things is that I keep constantly joking with myself about the fact that “I keep using one the most powerful game engines today, to make stuff like visual novels and text-adventures.” But the reason why I opt to use UE is quite simple: it’s easier and it allows for near infinite expansion as is needed (from speech2text to graphics to whatever one might think of adding)
And what would any game engine be worth if you couldn’t even make a simple text-adventure game with them, right?

Actually, the first ever actual program that I coded was a small text-adventure game for one of my project courses in the first year of my Bachelor’s studies. I did it with pure C++. I did half of the things (like room descriptions), with text files and everything else was hardcoded. The game ran on the command prompt and naturally as my first game/program ever, and created in the span of three months, it wasn’t without its problems and bugs. But mostly it was quite a pain to make (given my experience, of course). Using blueprints (a god’s gift for developers) and spreadsheets make it a million times easier and more manageable (personal opinion).

Personally, I’m really into RPGs and interactive stories, so my interest in text-adventures is kind of due to that, because the most important part of RPGs is not the graphics.
Text-adventures manage to kind of give a different sense of playing a role than more visual games do and they also offer a bunch of interesting ways to play with the players. Unfortunately, games moved to graphics so quickly that I feel there are still a bunch of things that weren’t really experimented with enough in text-based games.

But text-adventures, along with other interactive novel systems that I’ve made for my thesis, have still been really good in teaching about interaction and agency in storytelling and writing. Thanks to them I’ve gotten a bunch of new ideas. And I know they will help me in writing both my current game and any future games I plan on making.

Hi @BulletEye I would use UE4 for a text-based game too as I’ve been focused on learning it for 5+ years. Why not? I think the only issue you have with using UE4 is the size of the Games:) From my perspective many games contain a Text-based game within them. Games that use text to narrate, dialogs, etc. As long as we use symbols for written/verbal communication, there will be room for text-based games.

The Lack of Visuals is the power of Text/Audio-based Novels and Games because reading/hearing the descriptions can invoke the Mind’s Eye Viewer, The Imagination. Which more powerful then just a screen. In the Mind’s Eye Viewer you can not only See, but you Hear, Taste, Smell, and Touch.

Today’s progress:

I planned on implementing a help/manual message, that could be accessed from anywhere in the game and I started thinking a message is basically a paragraph of dialogue → so asking for help or for a manual is akin to talking to a character → and since I already have characters why not create a subcategory of characters that could be talked to anywhere (kind of like Navi from Ocarina of Time or Sein from Ori and the Blind Forest)… thus I created Global NPCs.

](filedata/fetch?id=1868395&d=1614948447)
They can be talked to anytime and they are also defined in the spreadsheets so they can answer to any name or word the writer wants. And their dialogue can have multiple turns just like a regular NPC and their dialogue can also be updated just like that of a regular NPC.
](filedata/fetch?id=1868396&d=1614948447)
I also made a log-type Global NPC that instead of changing the text when it is updated it adds to what it already has, it could be used for journals or maps, for example.

While the regular Global NPCs are updated the same way as regular NPCs are, log-types are updated through events. (figured this would make the distinction and use clearer)

Ps. I know there is bloat from the engine for this kind of game… but you just have to find and add something to justify that, like sounds or maybe something visual like special effects, stylized text or styled widgets (I remember there was this one text-adventure that was as if it was written on the pages of an old book, don’t remember the name but it should be on Steam)… but that’s an issue for another time.

More progress:

Today, I fixed my event handler function, now it supports multiple triggers (as was originally intended to), it is also a lot cleaner. I added a specific trigger to tell whether the event should be happen when entering a room as well. But my main aim for today was random trigger events, i.e. events that may or may not happen.


Also added an “add item” event just to test the random trigger.

Fixing old functions took more time than intended so I didn’t get much “new” stuff done. However, for tomorrow I have grander goals and more time to realize them…

More progress:

Today I made an initializer class for the player character, in case there is anything that the writer might want to give or define for the player, such as character traits or variables, beginning equipment and items… speaking of I also implemented equipment based on equipment slots, that can be defined as wanted per character (for example different equipment slots for different species or classes or whatever).


I also had to add item attributes, such as usable, equippable, etc. so that only specific items can be equipped.

In theory this also supports multiple characters, but I have yet to implement a party system. That’ll most likely come sometime in the future, after I come up with a smart way to do it. I want to first get everything working for a single playable character, and then I’ll see how a party system could be added. After all it’s the combat that has me most worried in a text-based party system.

Progress report:

I spent the past couple weeks implementing the story from my visual novel to this system and added functions as was necessary to meet the minimum requirements for my Master’s project.
The added stuff includes (but is not necessarily limited to, in case I forgot something):

New event types:
Such as, adding and removing characters. This also works as a way to update character dialogue on each room, for example Villager(1) has dialogue A, B, and C and you add Villager(2) so now his dialogue is D, E, and F.
Also added automatic equip and unequip events.
As well as an event for erasing items, whether they are equipped, in inventory or in the room. (I wasn’t sure if I wanted to make it so it would erase the item no matter where it was, but figured it would be better not to give it that much power.)

Use command for items (use potion, use dagger, etc.) and also item specific commands (light torch, burn witch etc.). All of the these are defined in the events so they can do whatever, just like the item specific commands can be whatever is defined per item. As such one can also add triggers to each command (for example, witch can’t be burned if torch is not lit, or a magic book can’t be read if it hasn’t been deciphered, etc.)

I also added a bunch of new triggers:
for example the <OR> trigger which allows for multiple different sets of triggers, and if one of the sets is fulfilled the event launches.
There’s also triggers for items, whether they are equipped or in inventory.
And for previously launched events, as well as choices made in locked input events.
I included triggers also for examinations (for example, having examined a certain book could launch an event with some NPC)
All of these also work with NOT (’!’) so that if an item is NOT equipped or an event has NOT been launched the trigger will be fulfilled.
And I also added a Repeat trigger, which allows for the events where it is marked to be repeated as much as necessary as long as all other triggers are also fulfilled.

Oh, returning to items, I also added an ‘environment’ item type, which cannot be picked up or taken, but can similarly to other items be used. For example, a car or a horse, etc.

I might’ve forgotten something, but I feel like these were the most important additions that I did in the past couple weeks.
Now I’ll focus on cleaning up and typo checking my entire master’s project, after which I’ll put up the demo, so anyone interested can check what the system, as it is now, can do.

I won’t repeat myself too much, coming from my original game post, but…

I finished the demo of my game, which also includes the current version of this text adventure system. So anyone who wants to see what it can do, you can try it here:

As I was implementing the story, I found a bunch of bugs and problems that had kept their heads hidden during my previous building and testing. It was a pain fixing them, but now everything should work as intended.

Not that I could ever keep regular updates going, but I’ll be taking a small break from working on this (simply because I’ve worked on it so much with a constant deadline ticking at my back). I’ll return to it eventually as I’ve found some pretty good uses for it and ideas on how it can be improved.