Guinevere: Text-based Adventure Template
Guinevere is an HTML template that allows you to make simple text-based adventure games by editing some JSON data.
All of the data the game needs is contained in a single HTML file, so games can be played on basically any device with an up-to-date browser. That includes Windows, Mac, Linux, Android and iOS.

How to use Guinevere
Example File
Here is an example showing a few incredibly basic screens with the mechanics of the game: Guinevere Example.
And here is the same template as a download link so you can edit it yourself: Guinevere Template.
Basic Information
Near the top of the HTML template, you’ll find a few standard HTML elements you’ll want to edit like the page title, favicon and meta description. You could also add opengraph tags and other things you need to personalise your game here.
Below that you’ll find the area where the JSON data for the game appears. This is broken into two parts: the game’s basic information and the game’s actual scenes (the content of the game).
It’s pretty self explanatory what you have to edit in the game_info constant:
// Game Information - Information about the game that appears on the title screen.
const game_info = {
title:'Game Title',
creator:'Creator Name',
flavour_text:'Extra flavour text for the menu. Can even be text art.',
information:'Extra information for the information screen. Could be a credits screen or a guide on how to play.'
}Editing the Game Content Itself
The actual game content which the player will play through is stored in the constant “game_scenes” which looks as follows:
const game_scenes = {
first_scene: {
text:'You are in room 1',
options: [
{text:'Go to room 2', next:'second_scene'},
{text:'Go to room 3', next:'third_scene'}
]
}Each “scene” of the game will have a block of text, which is effectively a description of the current area or part of the story the player is in. Each scene then has several clickable buttons the player can press to advance through the game.
As you can see in the code above each scene is an object with two properties:
- text – the text that will appear describing the situation the player is in.
- options – an array of objects representing each of the buttons the player can click.
As you can also see in the code above, the options array contains an object for each button which has its own properties.
The properties of each button are the real meat of how the game works. Here’s the list of properties each option can have:
- text – the label that appears on the button the user will click. (REQUIRED)
- next – go to this scene if the player clicks the button. This is the name of the scene object as shown in the JSON data.
- flag_on – flag to turn on upon clicking this option.
- flag_off – flag to turn off upon clicking this option.
- condition – the name of a flag to check whether this button should show up. If used, you must also specify condition_type.
- condition_type – the number to check, 1 or 0, for whether the flag is on or off. If it doesn’t match this option won’t be shown.
- message – add a message to the current screen.
What are flags and conditions?
Flags are effectively your game’s variables. They can be turned on and off by clicking buttons, and they are saved to the browser’s local storage so the game can check them later (even if the player closes the browser window and comes back!)
You should use flags to keep track of whether your player did certain things in your game, like picking up an item, unlocking a door, or making a specific choice that will change the path they take later.
The condition and condition_type property are checked before the game decides whether or not to show an option to the player. This allows you to check flags and show the correct options to alter the way the game is played. For example:
second_scene: {
text:'This is the second room, you see a blue door ahead.',
options: [
{text:'Back to room 1', next:'first_scene'},
{text:'Blue Door', condition:'blue_key', condition_type:'0', message:'The door is locked. You need a Blue Key.'},
{text:'Blue Door', next:'fourth_scene', condition:'blue_key', condition_type:'1'}
]
}In the scene above you’ll notice we’ve defined three options. The first one is a simple button that takes the player back to the previous scene. But the second two buttons have conditions…
Both buttons are titled ‘Blue Door’, but one of them appears if the flag ‘blue_key‘ is not set. This button will simply show a message to the player saying that the door is locked.
The other ‘Blue Door’ button only appears if the flag ‘blue_key’ is set, meaning that the player has obtained the blue key item and can now pass through the door to another scene.
How does the player obtain the blue key? Let’s look at another example scene:
third_scene: {
text:'This is the third room, there is a blue key on the floor.',
options: [
{text:'Back', next:'first_scene'},
{text:'Pick up key', flag_on:'blue_key', message:'You gained a blue key.'}
]
}In this scene the player is presented with a button which allows them to pick up a key. It will set the flag ‘blue_key‘ to be on, and show a message saying that the player gained a key. When the player returns to the room in the other example, they will be able to progress through the door.
And with that we’ve explained all the properties that options buttons can have. With them, your player can collect items and make choices while moving from scene to scene. And there you have the mechanics of a simple text-based adventure game!
Styles and Other Customisation
After the JSON section of the template you’ll find the styles. If you have knowledge of CSS styles you can do pretty much anything you want with this. The structure of the games on the screen is very simple, you can edit the colours, the width, the fonts etc.
If you scroll down past the functions that control the actual game, you’ll find the body of the HTML document. It is, again, incredibly simple. As long as you keep the div “game_main” and its contents intact, the game will continue to work. This means you can customise the area around the game to your heart’s content.
Finally I would note that anywhere text appears in the JSON you can also use HTML tags. So you can add bold, italic, underlined or different colours of text on the fly. If you want to break out of the “text-only” aspect of the game you can also add images and other elements, although you may need some extra javascript to make sure they load in properly.
Download & Stay in Touch!
You can download the HTML file below, as well as contribute to us if you found this useful and want to help us make more things in future. If you have any suggestions for changes or additional features, just drop me a mention or a message on bluesky!


