Scriber (Scriber v0.1.2)

Copy Markdown View Source

Entry point for the Scriber roguelike.

A run is played in a terminal. The map is drawn either as sprites composited into one image per frame, or as characters, depending on what the terminal supports and what Scriber.Renderer has been told to do. Each stratum's gate opens for an access code written into real files on disk, read through Scriber.Console.

Example

Scriber.play(seed: 1234)

Equivalently, from the shell:

mix scriber --seed 1234

Summary

Functions

Register the game's widgets and start a run. Blocks until the run ends.

Register every module in widgets/0 with drafter's widget registry.

The widget modules the game adds to drafter's registry.

Functions

play(opts \\ [])

@spec play(keyword()) :: term()

Register the game's widgets and start a run. Blocks until the run ends.

Options

  • :seed — integer the whole run derives from. The same seed produces the same map and the same access codes, and names the run's directory on disk. Drawn from system entropy when omitted.
  • :record — keep a Cauldron2D.Replay of the run in its world. Default false

Environment

  • SCRIBER_MODEpixel or text, or a specific pixel protocol; see Scriber.Renderer

register_widgets()

@spec register_widgets() :: :ok

Register every module in widgets/0 with drafter's widget registry.

Each module is loaded before it is registered. Registration tests function_exported?(module, :component_tag, 0), which answers false for a module the VM has not loaded, so an unloaded widget registers nothing and its tag then renders as an empty pane rather than raising.

Must be called before Drafter.run/2 for the game's tags to resolve. Idempotent.

widgets()

@spec widgets() :: [module()]

The widget modules the game adds to drafter's registry.