Dave's Text Game Engine

I built my text game engine in 2003. It is actually something like the fourth incarnation of various text-based online game systems I've built. This is by far the most complete, versatile, and easiest to use.

Check out the Script Language Reference for full specifications of the language itself. This page primarily deals with an extremely high-level view of the engine's workings. Probably the best introduction to this is the game I built using it: The Iron Guppy.

Content Main Area Section

There are three files that make up the body of the text game engine. I will explain the purpose of each of these as a sort of introduction. After that, it's up to you to view the source files and figure out the rest.

Please contact me if you are thinking of implementing this engine for yourself. I would be happy to give you the source and get you started. I need to put some thought into attaching a license (such as GNU) to it so that I retain a copyright while still allowing everyone to use and modify it for free.

gameEngine.php

The gameEngine.php file contains the basic mechanics needed to

View gameEngine.php

gameParser.php

The gameParser.php file contains the meat of the engine. It reads the .gam script file for the game and translates the source into a structured object (from gameClasses.php) which can be manipulated by gameEngine.php. It must understand:

View gameParser.php

gameClasses.php

The gameClasses.php file contains classes for containing the game script objects, actions, and action blocks. The resultant objects created from these classes can perform their own if/else checks and return the correct results based on the scripted game logic. These classes are the meat of the game portion of the engine.

View gameClasses.php

A ConTEXT Highlighter File

My favorite Windows text editor is ConTEXT created by Eden Kirin. ConTEXT uses syntax highlighter files to perform syntax highlighting for tons of different languages. For fun, I created a highlighter file for my game script syntax. I used it in ConTEXT to export the highlighted source I show in The Iron Guppy Script page.

Download Game_File.chl