Skip to content

vandamm/TBQ

Repository files navigation

TBQ: Text Based Quest games engine

Build Status Dependency Status

TBQ is a tool to run simple text-based adventures in node.js. Currently it has structure based on rooms containing objects that can be interacted with.

Usage

Create a data file (e.g. data.json), you can find format explanations in corresponding file. Then use the engine:

const TBQ = require('tbq');
const game = TBQ.createGame(require('data.json'));

do {
  var playerInput = /* Somehow get command entered by player */
  var actionResult = game.exec(playerInput);
  if (actionResult.text !== null) {
    /* Output actionResult.text to player */
  } else {
    /* Output some help */
  }
} while (!actionResult.end)

Each game.exec(playerInput) call returns { text, end } object (text property is null if command is invalid in given circumstances).

License

MIT

About

Text Based Quest games engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published