A minimalist text game (interactive fiction) engine, inspired by the original Quest engine.
It's an engine for creating text based games, or interactive fiction using javascript.
Games are specified by passing the engine a 'world' object. A world consists of 3 properties:
const myWorld = {
rooms: {},
items: {},
actors: {}
}
Rooms describe places in game, items describe interactable objects, and actors are NPC characters the player interacts with.
A simple room object must have at least 3 properties:
- description, which can be either a string or a function with the signature (state, world)
- items, an array containing item references
- actors, an array containing actor references
const room = {
description: "You walk into a dark room.",
items: [],
actors: []
};
Additionally you can use the game engine hooks to specify extra behaviour:
- onEnter(state, world)
- onExit(state, world)