Dave's PHP Text-Based Game Engine

A simple engine for games played with hyperlinks

Introduction

I built this 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 Dave's PHP Text Game Engine 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.

How It Works (Game Engine Files)

There are three PHP 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. If you are at all interested in seeing the source code or using the engine, please contact me. All inquiries welcome, including hobby/free use.

gameEngine.php

The gameEngine.php file contains the basic mechanics needed to:

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:

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.

A ConTEXT Highlighter File

My favorite Windows text editor is ConTEXT created by Eden Kirin (and in some sort of limbo as I write this...). 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 (.gam) syntax.