Skip to content

BRASS LANTERNA text adventure engine on npm

Three packages for classic parser games in a CRT terminal. Write your own world as data, mount it on a page, or load a Z-machine story file. The demo plays the Zork trilogy.

The Brass Lantern mark, an amber lantern
  • Bring your own story files

    Type LOAD at the menu to play a Z-machine game from your own computer. It stays in your browser; nothing is uploaded.

Install ​

sh
npm install @brass-lantern/engine @brass-lantern/vue vue pinia

Three packages ​

PackageWhat it is
@brass-lantern/engineThe game itself: parser, rules, saves and the Z-machine bridge. Runs anywhere, no DOM.
@brass-lantern/vueThe CRT terminal, themes and mountGame, as a Vue 3 component.
@brass-lantern/serverOptional. An Express route that lets players type like people, through Gemini.

A game on a page ​

ts
import { mountGame } from '@brass-lantern/vue';
import '@brass-lantern/vue/style.css';
import type { World } from '@brass-lantern/engine';

const world: World = {
  startRoom: 'study',
  rooms: {
    study: {
      name: 'The Study', description: 'A desk, a chair, and the dark.',
      exits: {}, items: ['lantern'], npcs: [], onEnter: [],
    },
  },
  items: {
    lantern: { name: 'brass lantern', aliases: ['lamp'], description: 'Unlit, for now.', portable: true, tags: [] },
  },
  npcs: {}, events: {}, dialogue: {}, flagLabels: {},
};

mountGame('#app', {
  cartridges: [{ kind: 'world', id: 'study', title: 'THE STUDY', world }],
  storagePrefix: 'study',
});

Then build a real one, or read Using the library for the component, themes and options.

Built with Brass Lantern ​

Office Space: The Text Adventure is a full-length game on this engine: four chapters from a very bad Monday at Initech to a field, a baseball bat and a printer that has it coming. It runs with the intent server, so you can type like a person.

Brass Lantern v2.1.1 · Released under the MIT License. · Why a brass lantern?