Text Game Engine with Web Interface


What is this?

This is web UI to play games written in a "scripting" language I created to make text game creation easier and faster.

The scripting language includes conditional statements, variables, ways to get game values and more.


Web Interface
  • Play text games through the web interface
  • All game sessions are automatically saved and can be resumed at any time
  • Choose from a menu of games with their name and a short description
Game Engine
  • Write text games quickly using the game scripting language

How it works


A C++ application is constantly running on the server side, managing games. A nodejs server acts as a bridge between the C++ program and the client using web sockets.

Full Language Readme

This is a program that simplifies making text based games

'Storylines' are essentially functions. Each place, or storyline has a name. These names are text surrounded by semicolons Example: ;1;. The storyline tells the game where to go, and which parts of the game to read when.

To declare a storyline, just put the storyline name on a line in the game.txt file, and make sure to end it with 'end'


    info: You are at storyline ;1;

The info declaration is the text that is read out to the player. In-game, this would look like:

You are at storyline ;1;

One of the things that you can add to storylines is options.

Options are declared by option: (text), and give users a choice of what storyline to go to next. If an option line if found, The game will prompt users for an option number to go to. Option numbers are decided by the order that the options are found in; if there are 2 options, the first option is option 1 and the second is option 2

If not otherwise specified, when an option is chosen, the option number is added to the current story. For example, if the storyline is ;1; and option 1 is chosen, the storyline becomes ;1.1;

	info: You are at storyline ;1;
		option: go to storyline ;1.1;

	info: You are at storyline ;1;

Conditional statements can be placed in the base of a storyline, and code is only evaluated if their condition is satisfied. Conditionals must end with an endif. Macros (part 5) are evaluated before conditions.

Note: Options are ended if a conditional is found

Boolean logic can also be applied to if statements. "&" is used for and, "|" for or, "==" to compare, and "!" to negate. Other comparators are "<=", ">=", "==", "!=", "<", and ">"

List of conditions that can be checked with explanations, syntax and examples:

  • item: Compare to item name
  • life: Compare to player life amount
  • gameclock: Compare to game timer (each time a player enters an option the game clock is increased by 1)
  • var: Compare to a variable value
if: (var(potatoquestion == true) & !var(crackerquest == NULL))
    option: Tell cracker64 you have the potatoes for him.
        goto: ;cracker.givepotato;

Conditions are evaluated recursively, allowing nested conditions.

Actions are placed within a storyline. They can be placed after an option line to only be ran when that option is chosen, or they can be placed alone in a storyline to be ran when the storyline is read.

List of actions with explanation, syntax and examples:


This ends the game with a message to the user


  • endgame: (message)
  • endgame: You lost

This can be used to send the player to a certain storyline in the game


  • goto: (storyline name)
  • goto: ;1;

This is used to give the player an item. Items modifiers are '+', '-', '/', '*', '='


  • item: (item name) (modifier) (quantity)
  • item: potato-1
  • item: potato=1

This randomly goes to one of the storylines provided. You can provide any number of storylines to choose from


  • rand: (storyline 1)|(storyline 2)|(storyline 3)|
  • rand: ;1;|;1.4;|;1.potato;|

Makes the player lose health. If the player dies, a message is shown. Health modifiers are '+', '-', '='


  • health: -20|In the morning your body is found lying next to the hotel.
  • health: +20|You gain 20 health
  • health: =100|You heal back to 100 health

create / set a variable that can be used later.


  • var: (var name)=(var value)
  • var: ran=true

Include a file


  • include: (file name)
  • include: moo.txt

There are a few simple macros that can be used in the option line, and the action lines. When the line is read in macros are replaced with the value that they lead to

List of macros with explanation and example:

$item((item name))

Returns item amount


  • info: You have $item(coins) coins

Returns current storyline number


  • info: You are at $(storyline)

Returns current health

$var((variable name))

Returns value of a variable. Undefined variables will return NULL


Returns result of calculation


  • info: $calc((5+3)*2) -> info: 16

Returns integer value of number


  • info: $int(5.5) -> info: 5
include: moo
include: moo/moo.txt

include statements can go anywhere, and once they are reached their file is loaded. They allow you to 'include' other text files, meaning that they are added to the files that the interpreter searches when looking for story lines and options.

Scripting language


    info: He gives you a link to the script.
    option: Run script
        info: -1 SESSION_ID
    option: Ask how to run the script
    option: Ask what LUA is
        info: You ask mniip about LUA. He is so enraged that you spelled the language of the gods incorrectly that he hacks freenode and bans you from every channel. He then comes to your house, shoots your family, and burns your house down.
        info: -1 family$(ENDL)-1 house
        endgame: You learn IRC is a horrible place with many haters and never join again. You live a lonely life with no friends.

    info: You run the script. TPT closes. You aren't sure why.
    option: Continue back to #powder
        goto: ;1.2;


When a game is loaded, the interpreter reads through the given game script file and parses it, moving all the data to objects in memory. This allows files to be loaded both at load time and runtime.

The interpreter was made in C++. It can load games and have multiple games running at once. The interpreter uses an instance of the class GameController to store every game session. In this class the player data, variables, and all the storylines are stored.

Each storyline is an object which contains an array of options, and an array of commands to be run when the storyline is called. Inside of each of these options is another array of commands to be run of the option is chosen.

Repository Statistics

Commit History