johnsquibb/adventure-game-framework

This package is abandoned and no longer maintained. No replacement package was suggested.

A PHP framework for console text adventure games.

0.2.1-alpha 2021-07-10 02:09 UTC

This package is not auto-updated.

Last update: 2023-12-09 15:32:09 UTC


README

A PHP framework for console text adventure games.

Build and play games that use text commands such as:

> go north

> look inside the chest

> take key from chest

> unlock the cellar door

> turn flashlight on

Installation

Run composer install from the project directory.

Unit Tests

A suite of PHPUnit tests is located in the test directory.

Run the unit tests: composer test

Architecture

The Game Execution diagram shows how the framework components interact during a game run. The example game's main.php demonstrates how a game can be set up and run.

Examples

Demo Game

The examples directory contains a game that demonstrates the framework abilities. Run the game on the command line using:

composer example

In the same directory is a diagram showing the layout of the demo game.

Automated Testing

A test client can be used to run automated tests.

Run the example:

composer example-test

The test client will play the game by running each of the test cases in the provided order. The client reports any errors, halting game execution. See test.php for more details.

Optionally specify the number of milliseconds to wait between each test, for example: composer example-test 100 to wait 100 milliseconds between each test. The default wait value is 1000 milliseconds.

TODO

  • Basic Logging - errors, warnings, etc.
  • Stats tracking - number of moves, number of visits to location, number of item uses, etc.
  • Improve save/load system to allow for multiple files using choice system.