OpenWorld Format

OpenWorld Format — specification

Version 0.3 (draft) · changes · openworld.observer · machine-readable schemas in schema/ · reference linter in scripts/check.mjs · reference geometry in public/shape.js and public/scenario.js

Contents

  1. Introduction
  2. Conformance
  3. The model at a glance
  4. Value types
  5. The world document
  6. Objects and containment
  7. Locations
  8. Floor plans: shape, scale, orientation
  9. Passages
  10. Contained objects
  11. Templates and instances
  12. Scenario: quests, nodes and clues
  13. Derived information
  14. Serialization
  15. Validation
  16. Versioning and extension
  17. Open questions

1. Introduction

1.1 What it is

The OpenWorld Format (OWF) is an open, text-based format for the worlds of tabletop role-playing games, as a game master prepares them. It describes two things that share their content:

A world is written as a folder of YAML files, one file per place, passage or character, so that people can write it by hand and keep it in Git. It is exchanged as a single .owf file, in JSON, that applications import.

1.2 What it does

A world document lets a consuming application, without any other input:

1.3 Design goals

  1. Stable ids. Every object has an id, unique in the world, that never changes, even when the object is renamed. Every reference is an id.
  2. One parent. Every object has exactly one parent, except passages (which sit between two locations), templates, the root location and top-level quests. Containment is the parent field of the child, never a list on the container.
  3. Relations become objects only when they must. A relation gets its own object when it links things many-to-many or carries attributes that belong to neither end. Passages qualify; containment does not.
  4. Object or field. Something is an object when it has identity (it is referenced or reused), state in play, or can move. Otherwise it is a field.
  5. Names, not rules. Creatures and items are referenced by name, with an optional catalog hint. The format never contains stat blocks or item rules, so a world carries no copyrighted game content.
  6. System-agnostic core. Game-system details go in a namespaced ext block (ext.dnd5e).
  7. Authored content only. The format describes the world as prepared. What happens at the table (play state) belongs to the consuming application.
  8. Derive, don't repeat. Anything that can be computed from the data (exits of a location, the direction of a door drawn on a plan, the scene a clue is found in) is not written, or is written only to state what cannot be derived.

1.4 Out of scope

1.5 Notation

The key words MUST, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, RECOMMENDED and MAY are used as in RFC 2119 and RFC 8174 when they appear in capitals.

Sections and appendices are normative unless marked informative. Examples are informative. Keys are English. Values are in the author's language.

2. Conformance

This specification defines requirements for four kinds of things.

Class What it is Must
World document An .owf exchange file, or a YAML folder Pass the JSON Schemas (§14) and every error rule of §15.2.
Producer (encoder) Anything that writes a world: an editor, a converter, an import from another tool Write only conforming world documents. Never write play state into the document. Keep ids stable across saves (§4.1). Keep unknown ext namespaces it read (§16.2).
Consumer (decoder) Anything that reads a world: a viewer, a virtual tabletop import, a printer Accept every conforming world document. Apply defaults for absent attributes (§6.4). Resolve templates (§11), derive what §13 derives, and ignore unknown ext namespaces. Follow the version rules of §16.1.
Linter A validator Report every error and warning of §15.

An editor is both a consumer and a producer: it MUST read every conforming world and MUST be able to save any world it read without losing information, apart from the layout of the YAML folder (§14.4).

A consumer MAY support only part of the model (for instance, only the map, or only locations and passages). It MUST then still read the whole document and MUST ignore, without failing, the objects and attributes it does not support.

3. The model at a glance

Informative.

world
├── location (root)                    access: open
│   ├── location                       e.g. a village
│   │   ├── location                   e.g. an inn, access: passages
│   │   │   ├── location ── shape      e.g. the common room, with a floor plan
│   │   │   │   ├── npc
│   │   │   │   ├── fixture
│   │   │   │   │   └── clue ──leads_to──▶ node
│   │   │   │   ├── loot
│   │   │   │   └── document
│   │   │   │       └── clue           what reading it teaches
│   │   │   └── location
│   │   └── …
│   └── …
├── passage  a ◀──────▶ b              between any two locations, at any level
├── template (mob, loot…)             reused through `from`
└── quest
    ├── quest                          a sub-quest
    └── node ── locations ──▶ location
        └── clue / event               no place on the map

Every object is one entry of a flat list. The tree above is drawn from the parent fields.

4. Value types

4.1 Id

An id matches ^[a-z0-9]+(-[a-z0-9]+)*$: lowercase ASCII letters, digits and single hyphens, neither at the start nor at the end. Example: inn-common-room.

4.2 Markdown

Attributes typed Markdown hold CommonMark text.

4.3 Check

A check says how something is found, opened, avoided or resisted. It is either:

4.4 Visibility

Value Meaning
visible Default. The players can see it when they are there.
hidden The players can discover it, usually through discovery.
dm-only Never shown to the players: background, a secret that cannot be discovered as such.

Visibility is the authored starting point. Being found is play state.

4.5 Direction

One of n, ne, e, se, s, sw, w, nw (true compass directions), up, down, in, out. Used on passage sides (§9.2).

4.6 Catalog hint

Creatures, NPCs, items and offers carry a name and MAY carry a catalog hint of the form <catalog>:<entry>, matching ^[a-z0-9][a-z0-9.-]*:.+$. Example: srd-5.1:dire-wolf.

Consumers resolve names and hints against whatever catalogs they have. A consumer SHOULD try the hint first, then the name, and SHOULD report names it cannot resolve. A world MUST stay readable without any catalog.

4.7 Extensions

ext is an object whose keys are namespaces matching ^[a-z][a-z0-9-]*$ and whose values are objects of any shape. It is allowed on every object and on creature, item and offer entries. See §16.2.

4.8 Grid and orientation

Both are set on the world or on a location and inherited (§7.3).

4.9 Other values

5. The world document

5.1 Top level

{
  "format": "openworld",
  "version": "0.3",
  "world": {
    "title": "The Misty Vale",
    "system": "dnd5e",
    "description": "A small example of the format.",
    "grid": { "size": 5, "unit": "ft" },
    "orientation": { "up": "n" }
  },
  "objects": [ { "id": "misty-vale", "type": "location" } ]
}
Key Value Meaning
$schema string OPTIONAL. Path or URL of the schema, for editors. Carries no meaning.
format "openworld" REQUIRED. Identifies the format.
version string "<major>.<minor>" REQUIRED. The version of this specification the document follows (§16.1).
world world info REQUIRED.
objects list of objects REQUIRED. Every object of the world, in one flat list (§6).

No other key is allowed.

5.2 World info

Key Value Meaning
title string REQUIRED. The world's title.
system string The game system it is written for. Free text; RECOMMENDED to match an ext namespace. Known values: dnd5e (Dungeons & Dragons 5th edition, 2014 rules), dnd5e-2024 (the 2024 rules, sometimes called 5.5).
description Markdown What the world is.
grid grid (§4.8) Default cell size for every floor plan.
orientation orientation (§4.8) Default orientation for every floor plan.

6. Objects and containment

6.1 Object types

type What it is Section
location A place that can be visited: region, town, building, room §7
passage A connection between two locations §9
mob One creature, or several that act together §10.1
loot One item, or several found together §10.2
clue Information the players can learn §10.3
npc One named, unique individual §10.4
trap A hazard with a trigger §10.5
fixture Something you interact with but don't take: altar, mirror, chest §10.6
event Something that happens §10.7
encounter-table A table to roll on, or a sequence of happenings §10.8
service What can be bought, sold or done here §10.9
document Something handed to the players, which they can keep: a letter, a map, a journal §10.10
quest A storyline of the scenario §12.1
node A scene of the scenario §12.2

The ten types from mob to document are the contained objects.

6.2 Shared attributes

Every object MAY carry these attributes. id and type are REQUIRED.

Attribute Value Meaning
id id Stable unique id (§4.1)
type one of §6.1 What the object is
name string Display name. When absent, consumers show a stand-in (§13.9).
parent id The one object it sits in (§6.3)
description Markdown What it is like, as the players would perceive it
notes Markdown For the DM only: tactics, reminders, background
tags list of strings Free grouping and search
visibility visibility (§4.4) Default visible
discovery check How a hidden object is found
presence string When it is there: "only at night", "after the festival"
where string Where it is inside its parent: "south alcove", "near the square"
template boolean This object is a template (§11)
from id This object is an instance of that template (§11)
ext extensions (§4.7) Game-system data

Each type adds its own attributes (§7 to §12). An object MUST NOT carry an attribute that neither this table nor its type defines; everything else goes in ext.

6.3 Allowed parents

Object parent MUST be
location a location; absent for the one root location
passage absent
npc a location or a passage
mob, trap, fixture, event, encounter-table, service a location, a passage, an npc, a fixture, a loot, an event or a node
loot, document the same, or a mob
clue the same, or a mob or a document
quest a quest; absent for a top-level quest
node a quest. REQUIRED.
any template absent

Rules:

6.4 Defaults and absent attributes

Producers MAY omit an attribute whose value is its default, and SHOULD do so. Consumers MUST treat an absent attribute as its default, or as "not stated" when it has none. An absent list means an empty list. null is not a valid value for any attribute.

7. Locations

7.1 Attributes

A location is any place that can be visited.

Attribute Value Meaning
access open (default), passages How its children are reached (§7.2)
conditions list of strings Darkness, fog, magical silence, difficult terrain… Free text.
shape string Text floor plan (§8)
legend map of one character → id What the non-built-in characters of shape stand for (§8.2)
origin { x, y }, integers ≥ 0 Where shape sits on the parent's grid (§8.6)
grid grid (§4.8) Cell size. Inherited (§7.3).
orientation orientation (§4.8) Which way is up in the drawings. Inherited (§7.3).

legend and origin MUST NOT appear without shape.

7.2 Access

A location with no child locations is a room; access makes no difference to it.

7.3 Inherited attributes

grid and orientation are inherited. The value for a location is its own, else its nearest ancestor's, else the world's (world.grid, world.orientation), else none for grid and { up: n } for orientation. The whole object is inherited, not its keys one by one.

8. Floor plans: shape, scale, orientation

A location MAY carry a shape: its floor plan drawn as a grid of characters, one character per cell. Shapes are optional; a world MAY mix locations with and without them.

id: guards-corridor
type: location
grid: { size: 5, unit: ft }
shape: |
  .A...
  ..t.B
  .....
  .C...
legend:
  A: armoury-door
  B: courtyard-door
  C: cellar-stairs
  t: trapped-flagstone

8.1 Parsing

  1. Remove every carriage return (U+000D). Remove trailing line feeds. Split on line feeds into rows, numbered from 0 at the top.
  2. A row whose first character is > is a marked row: remove that one > (§8.4). If any row is marked, the shape is hex; otherwise it is square.
  3. Remove trailing white space from each row.
  4. Column x of row y is the x-th character (counting from 0, by Unicode code point) of the row. A cell beyond the end of its row, or outside the rows, holds a space.

Tabs MUST NOT appear in a shape. Lines MAY differ in length.

8.2 Characters

Character Meaning Part of the location?
. Floor yes
# Solid: a pillar, a thick wall, a block of rock, when its size matters no
space Not part of the location no
> Only as the first character of a row: the row is shifted (§8.4). Not a cell. —
any other character Defined by legend. The cell is floor with something on it. yes

In YAML, a shape is a literal block scalar (|). A block whose first line starts with a space needs an indentation indicator (|2).

8.3 Walls are borders

A shape holds only the location's own cells. A wall runs along every edge between a cell that is part of the location and a cell that is not (a space, a #, or beyond the drawing). Two rooms side by side touch directly: the wall between them has no thickness on the grid. Curves and diagonal walls are drawn as steps.

The outer edges of a cell are its edges whose neighbour is not part of the location.

8.4 Square and hex grids

Square grid. Each cell has four sides: up, right, down, left. Cell (x, y) covers the square from (x, y) to (x+1, y+1) in cell units, y downwards. Its neighbours are (x, y−1), (x+1, y), (x, y+1), (x−1, y).

Hex grid. Hexagons are pointy side up. Each cell has six sides: up-right, right, down-right, down-left, left, up-left.

id: hanged-mens-wood
type: location
grid: { size: 1, unit: mi }
shape: |
  ......
  >........l
  ........r
  >..p......

8.5 Scale and orientation

Scale. The inherited grid (§7.3) gives the size of one cell. Consumers MAY use it to show distances and sizes. A shape without any grid in effect is drawn without a scale.

Orientation. The inherited orientation says which compass direction is at the top of the shape as drawn, which is the way the author copied it from the source map. A map with north on the left has orientation: { up: e }. Shapes are always written as printed; all directions in the data stay true compass directions. Viewers SHOULD use orientation as the starting rotation of their map views, and MAY let the user turn the view.

To turn a grid side into a true compass direction (used in §8.7):

  1. Take the side's screen angle, counter-clockwise from the right: right 0°, up-right 60°, up 90°, up-left 120°, left 180°, down-left 240°, down 270°, down-right 300°.
  2. Its bearing on the drawing, clockwise from the top, is 90° − angle.
  3. Add 90° × q, where q is 0, 1, 2 or 3 for up = n, e, s, w.
  4. Divide by 45°, round to the nearest integer, take it modulo 8, and index n, ne, e, se, s, sw, w, nw.

With up: n, the up-right side of a hex is ne, its right side e. With up: e, a square's up side is e and its left side is n. The rounding never meets a tie.

8.6 Placing shapes: origin and levels

origin: { x, y } places cell (0, 0) of a location's shape on its parent's grid: cell (x', y') of the child is cell (origin.x + x', origin.y + y') of the parent's grid.

8.7 Passages on a plan

A passage in a location's legend is drawn on that location's plan.

The direction of a side can then be derived, and the side's direction MAY be omitted (§9.3). To derive it for the end of passage P in location L:

  1. Let C be the cells of L's shape that hold P's legend character. If there are none, nothing is derived (absent).
  2. Let E be the outer edges (grid sides) shared by every cell of C.
  3. If E has more than one side and the other end L2 of P is placed on the same grid as L (both have origin, the same parent, and L2 has a shape with P in its legend), keep only the sides of E across which some cell of C faces a cell of L2 that holds P's character in L2's legend. Neighbours are computed with L's own row parity (Appendix B) and translated through both origins.
  4. If exactly one side is left, the side's direction is that side turned into a compass direction (§8.5).
  5. Otherwise nothing is derived: ambiguous if some cell of C has an outer edge (a corner, the end of a corridor), floor if none does (a trapdoor in the middle of the room).

Geometry of a passage. When both ends' cells sit on one assembled level and face each other across an edge, the passage is a door in that wall and has no length. Otherwise consumers MAY draw it between its cells; the route of a longer passage stays in its description. A hallway whose shape matters is a location with its own shape, not a passage.

9. Passages

9.1 Attributes

A passage connects two locations, a and b, at any level of the hierarchy, and is described once. It has no parent.

Attribute Value Meaning
a, b location ids The two ends. REQUIRED. MUST differ.
nature string What it is (§9.4). Free text.
flow both (default), a-to-b, b-to-a Which way it can be crossed: one way for a drop or a slide
closure open (default), closed, locked, barred Its state at the start
lock check How to open it when locked
key list of ids What opens the lock, usually the loot holding the key
side_a, side_b side How it is seen and used from each end

The passage's description says what it is ("a narrow, damp tunnel"). A side's description says how it goes from that end. Traps, guards or clues on a passage are contained objects whose parent is the passage.

9.2 Sides

Attribute Value Meaning
direction direction (§4.5) Where it leaves this end's location
label string Detail or non-compass wording: "north wall, behind the tapestry", "following the river"
description Markdown What you see and experience starting from this end
visibility visible (default), hidden Hidden from this end only
discovery check How it is found from this end
revealed_by other-side, or the id of an event What reveals a hidden side: opening it from the other end, or the event

9.3 When direction is required

A side MAY omit direction when one can be derived from the shape of its location (§8.7). A compass direction written anyway MUST equal the derived one. up and down MAY always be written and take precedence over a derived one (a door in the west wall that opens onto stairs going down).

direction is REQUIRED:

9.4 Nature

Suggested values: door, gate, stairs, ladder, trapdoor, dumbwaiter, lift, shaft, tunnel, corridor, street, road, path, bridge, window, portal. Other values are allowed. Consumers MAY pick an icon from it.

9.5 More than two ends

A passage always has two ends. Something that links three or more places (a crossroads, a hall of doors) is a small location with one passage to each place.

When the places are stacked one above the other (a dumbwaiter serving three floors, a lift, a well), use one small location per stop: a passage from each place to its stop, and up/down passages from stop to stop. A single location for the whole shaft cannot say at which stop the party is, so its exits would point the wrong way.

10. Contained objects

Each type below takes the shared attributes (§6.2) and adds its own.

10.1 mob

Attribute Value Meaning
creatures list of creature entries, at least one REQUIRED unless from is set. One entry for a lone creature, several for a mixed group.
behavior Markdown Patrols, flees at half strength…

A creature entry is:

Key Value Meaning
name string REQUIRED. As found in the catalog.
count integer ≥ 1 Default 1
catalog catalog hint §4.6
ext extensions e.g. ext.dnd5e.hp to override the stat block

Statistics come from the stat block the consumer resolves. Current hit points are play state.

A mob MAY hold the loot, documents and clues it carries, as its children (§6.3). The players get them once the mob is defeated.

10.2 loot

Attribute Value Meaning
items list of item entries One entry for a single item, several for a hoard
coins { pp?, gp?, ep?, sp?, cp? }, integers ≥ 0 Platinum, gold, electrum, silver, copper
container string Chest, corpse, under the floorboards

An item entry is:

Key Value Meaning
name string REQUIRED
quantity integer ≥ 1 Default 1
catalog catalog hint §4.6
rarity common, uncommon, rare, very-rare, legendary, artifact
value string Free text: "50 gp"
notes Markdown For the DM
ext extensions

A container that matters in itself (it is locked, trapped, holds a clue) is a fixture or a loot with children.

10.3 clue

Attribute Value Meaning
content Markdown What is learned. REQUIRED unless from is set.
targets list of ids What it points to on the map: locations, NPCs, objects, events
node id of a node The scene where it is found (§12.3)
leads_to list of node ids The scenes it points to (§12.3)

Clues make two graphs beside the graph of passages: targets gives reasons to go somewhere on the map, leads_to joins the scenes of the scenario. leads_to SHOULD NOT list the same node twice.

10.4 npc

Attribute Value Meaning
catalog catalog hint Stat block to use
role string Innkeeper, burgomaster, spy
goals Markdown What they want
personality Markdown How to play them
attitude friendly, neutral (default), hostile Starting attitude toward the players

An NPC is one unique, named individual. An unnamed guard, or several identical guards, is a mob.

10.5 trap

Attribute Value Meaning
trigger string What sets it off
detect check How to spot it
disarm check How to disable it
save check How to resist it
effect Markdown What happens
armed boolean, default true Its state at the start
resets boolean, default false Re-arms after triggering

Damage dice and types go in ext (e.g. ext.dnd5e.damage: "4d10 bludgeoning").

10.6 fixture

Attribute Value Meaning
interactions Markdown What happens when it is used

Fixtures are often the parent of clues, traps and loot.

10.7 event

Attribute Value Meaning
trigger string Time, action or condition. REQUIRED unless from is set.
effect Markdown What happens
repeat once (default), each Whether it can happen again

The children of an event appear when it happens.

10.8 encounter-table

Attribute Value Meaning
mode roll (default), sequence roll: roll the die. sequence: the entries happen in order, one each time, with no die.
die d<N>, e.g. d12 REQUIRED when mode is roll
when string When to roll, or when the next entry happens: "each hour of travel"
entries list of entries, at least one REQUIRED unless from is set

An entry is { range?, text?, mob? }:

An entry SHOULD have text, mob or both. In sequence mode the list order is the order of the happenings.

10.9 service

Attribute Value Meaning
offers list of { name, price?, catalog?, ext? } name REQUIRED; price free text ("2 sp")
hours string When it is available

10.10 document

A document is something the DM hands to the players, or may choose to: a letter, a map, a page of a journal, a wanted poster. The players can keep it and read it again. A painting on a wall or an inscription carved in stone is not a document but a fixture, which may hold clues.

Attribute Value Meaning
form string What it is: letter, map, journal, scroll, poster… Free text.
text Markdown Its content, as the players read it
id: smugglers-letter
type: document
name: The smuggler's letter
parent: captains-cabin
form: letter
description: A damp letter, its wax seal broken, tucked under the captain's pillow.
visibility: hidden
discovery: { skill: Investigation, dc: 12 }
text: |
  Tide's in on the third night. Same cove, same lantern.
  Bring the crates to the chapel; the priest has the key. — M.
contents:
  - id: letter-names-the-cove
    type: clue
    content: The smugglers land at the cove on the third night.
    leads_to: [n-smugglers-cove]
  - id: letter-names-the-priest
    type: clue
    content: The village priest is in league with the smugglers.
    targets: [father-anselm]

11. Templates and instances

An object is unique by default: it exists once and can move during play.

Consumers MUST resolve every instance before anything else in §13. Required-attribute rules (creatures, content, trigger, entries) apply to the resolved instance.

12. Scenario: quests, nodes and clues

A world MAY describe its adventure beside its map. The adventure is a set of nodes, the scenes the players can reach. Clues found in one node point to others. Nodes belong to quests, so a large campaign can be looked at one quest at a time.

The scenario and the map share their clues: a clue (§10.3) sits somewhere on the map, or in a node when it has no place, and it can lead to nodes.

12.1 quest

A quest is a storyline: the main plot, a side quest, one chapter of a campaign.

Attribute Value Meaning
parent id of a quest The larger quest it is part of. Absent for a top-level quest.

A quest takes the shared attributes (§6.2): description says what it is about, notes how it can go. Quests have no place on the map. A world MAY have several top-level quests.

12.2 node

A node is a scene of the adventure: a place to explore, a person to meet, an organisation to deal with, an event that happens.

Attribute Value Meaning
parent id of a quest The one quest it belongs to. REQUIRED.
locations list of location ids Where it takes place, if anywhere
start boolean, default false The quest starts here
end boolean, default false The quest ends here
proactive boolean, default false It comes to the players (an ambush, a messenger); it needs no clue leading to it

12.3 Clues in the scenario

A clue leads to the nodes in its leads_to. The node where it is found is settled as follows:

  1. Its own node, if set.

  2. Otherwise, follow parent up from the clue's parent:

    • if a node is met first, the clue is found there;
    • if a location is met first, its places are that location;
    • if a passage is met first, its places are both its ends, a and b;
    • other objects (fixture, loot, npc, mob, event, document) are passed through.

    If the chain ends without any of these, the node is unsettled (nowhere).

  3. Look for the nodes whose locations include one of the places. Exactly one: the clue is found there. Several: unsettled (ambiguous). None: replace the places with their parents (each id once, skipping ids already tried) and look again, up to the root. If nothing is found, the node is unsettled (none).

A clue that has leads_to and an unsettled node SHOULD state node. A clue's node MAY name a node whose locations don't include the clue's place: the author's choice wins.

The Three Clue Rule. Players miss clues, misread them or ignore them, so a conclusion the adventure depends on needs more than one way to reach it. The incoming clues of node N are the clues whose leads_to includes N and whose own node (above) is not N; clues whose node is unsettled count. A node SHOULD have at least three incoming clues. Quest starts and proactive nodes are exempt: the players do not need to find them.

Which clues the players found and which nodes they reached are play state (Appendix A).

13. Derived information

This section defines what consumers compute from the data. A consumer that shows any of these MUST compute them as defined here. Templates are resolved first (§11); templates themselves take no part in any of the following.

13.1 Indexes

13.2 Exits of a location

The exits of location L are the passages with L as one end. For each, from L:

A passage with flow set one way is still an exit at both ends; consumers SHOULD show it at the end it cannot be taken from as not crossable from there (the hole in the ceiling).

13.3 Exits through descendants

The exits through descendants of L are the passages with exactly one end within L (and not L itself) and the other end outside it: the inn's front door is an exit of the inn even though its end is the common room.

13.4 Places reachable without passages

From an open location, each of its child locations is reachable directly (§7.2), and consumers MAY offer to go back up to an open parent from any of its children. A passages location is never stood in: a consumer asked to show one SHOULD show it as an overview of its children and its entrances.

13.5 Clue targets

The clues pointing to object X are the clues whose targets include X. Consumers SHOULD show, on a location, the clues pointing to it or to its children.

13.6 Assembled level

The level of a location P is the set of its child locations that have an origin, placed on P's grid (§8.6), plus P's own shape at (0, 0) if it has one. Consumers MAY draw it as one plan, with walls between the rooms and the passages that join two placed rooms drawn as doors in the shared wall (§8.7).

13.7 Scenario graph

For display, the scenario is a directed graph:

The layout is the consumer's choice. Laying the graph out from the quest starts, in the direction of the edges, is RECOMMENDED.

13.8 Scenes of a location

The scenes of location L are the nodes whose locations include L or one of its ancestors. Consumers MAY show them on the location.

13.9 Display names

When an object has no name, consumers SHOULD show a stand-in rather than its id:

14. Serialization

The model has two forms. Both are UTF-8 text.

Form Used for Written by Schema
Folder of YAML files Authoring, Git history People, or an editor schema/file.schema.json, one file at a time
.owf file (JSON) Exchange: what applications import A converter, or an editor. Not edited by hand. schema/world.schema.json

Both forms carry the same information. Converting one into the other and back MUST give the same set of objects with the same attributes.

14.1 The .owf exchange file

14.2 YAML folder

Recommended layout. One file per location, passage, NPC, quest and template, named after its id. Other objects nested in their parent's contents. Subfolders by kind (locations/, passages/, npcs/, templates/, quests/) or by area.

14.3 From a folder to an .owf file

  1. Read world.yaml; copy format, version and world.
  2. Read every other .yaml file, in the code-point order of their paths relative to the folder.
  3. For each file, lift its object: remove contents and $schema, add parent when the object was nested, append it to objects, then lift each object of its contents in order, with the current object as parent.
  4. Validate the result against world.schema.json and the rules of §15.

14.4 From an .owf file to a folder

An editor that saves a folder chooses a layout. The layout carries no meaning, so any layout that lifts back (§14.3) to the same objects is correct. The RECOMMENDED way:

  1. Write world.yaml.
  2. Give a file of its own to each location, passage, NPC, quest and template, and to any object whose parent is absent or would not otherwise be in a file.
  3. Nest every other object in the contents of its parent, removing its parent key, keeping the order of objects. A node MAY be nested in its quest's file.
  4. Keep the existing file of an object when the folder already has one, so that a save changes as few files as possible and Git history stays useful.

When an editor writes YAML:

15. Validation

15.1 Schema

The JSON Schemas check the shape of each object: required keys, value types, enumerations, patterns, and no unknown keys. world.schema.json checks an .owf file; file.schema.json checks one YAML file (either world.yaml or one object with its contents). They use JSON Schema 2020-12.

15.2 Errors

These rules need the whole world. A document that breaks one is not conforming.

  1. Ids are unique.
  2. Every referenced id exists: parent, a, b, from, targets, key, encounter entry mob, revealed_by (unless other-side), legend values, locations, node, leads_to.
  3. Exactly one non-template location has no parent (the root). Every other non-template object without a parent is a passage or a top-level quest.
  4. Parents follow §6.3, and no parent chain loops.
  5. Passage ends are locations, and a ≠ b. A passage has no parent. revealed_by, when not other-side, is an event.
  6. from points to a template of the same type. Templates have no parent and no from.
  7. Every character in a shape is ., #, a space, or a key of legend; > appears only as the first character of a row; no tab. Every legend key is one character other than ., #, > and space, and is drawn in shape. No two keys map to the same id. legend and origin appear only with shape.
  8. Every legend id is a passage with this location as one end, or a non-location object whose parent chain reaches this location.
  9. A side has a direction when §9.3 requires one. A compass direction that can also be derived from a shape equals it.
  10. A location with origin has a parent and the same grid and orientation as that parent. Placed siblings' cells do not overlap.
  11. An encounter-table in roll mode has a die, and a range on every entry.
  12. In a hex shape, shifted and plain rows alternate and are marked accordingly. A placed hex shape puts its shifted rows on odd rows of its parent's grid. The shapes placed under one parent, and the parent's own shape, use one kind of grid.
  13. A node has a parent, which is a quest. A node's locations are locations. A clue's node and leads_to are nodes.

15.3 Warnings

A document with warnings is conforming. Linters SHOULD report them; editors SHOULD show them where the author works.

  1. A location that no passage reaches (at it or within it) when its parent has access: passages.
  2. A node with fewer than three incoming clues (§12.3), unless it is a quest start or proactive.
  3. A creature, NPC or item name the consumer's catalog cannot resolve (checked by consumers).
  4. A location with a shape that leaves one of its passages out of legend.
  5. A clue with leads_to whose node cannot be settled (§12.3).
  6. A quest with nodes of its own, none of them a start.

15.4 Reference tools

node scripts/check.mjs <folder> [out.owf] validates a YAML folder against both schemas and every rule above, and optionally writes its .owf file. node scripts/check.mjs --self-test checks that the schemas reject known bad files and that shape and scenario rules give the expected results. public/shape.js (floor plans) and public/scenario.js (node of a clue, Three Clue Rule) are shared by the linter and the reference viewer, and can be reused by other implementations.

16. Versioning and extension

16.1 Versions

version is <major>.<minor>. This document is version 0.3. The changes from one version to the next are listed in CHANGELOG.md.

Consumers:

Producers MUST write the version whose rules the document follows, and MUST NOT write attributes from a later version under an earlier version number.

16.2 Extensions

Anything the core does not define goes in ext, under a namespace:

- id: rolling-boulder
  type: trap
  trigger: the central flagstone
  save: { skill: Dexterity, dc: 15 }
  ext:
    dnd5e: { damage: "4d10 bludgeoning" }
    my-tool: { colour: "#a33" }

17. Open questions


Appendix A. Play state conventions (informative)

Play state is not part of the format (§1.4). Applications that want to exchange it, or simply to stay consistent, MAY use the following, which the reference viewer uses. Play state is stored per world, and keys are built from ids, which never contain a colon (§4.1).

Key Set when
list of visited location ids the party has been in the location
<id>:found a hidden object, or a trap with detect, has been found
<id>:done a trap triggered, a clue seen, a loot taken, a document given to the players, a mob defeated, an event happened (not for repeat: each)
<id>:disarmed a trap has been disarmed
<passage>:a:found, <passage>:b:found a hidden side has been found from that end
<node>:reached the players have reached a scene

A clue counts as found when it is done or found, or when the document it sits in is done. What a mob carries (its loot, documents and clues) becomes reachable when the mob is done; consumers MAY then hand it to the party. An object with no state recorded is in its authored state.

Appendix B. Hex grid reference

Pointy-top hexes, one unit wide between flat sides. Row y is shifted or plain as defined in §8.4.

Neighbours of cell (x, y), as (dx, dy):

Side Plain row Shifted row
up-right (0, −1) (+1, −1)
right (+1, 0) (+1, 0)
down-right (0, +1) (+1, +1)
down-left (−1, +1) (0, +1)
left (−1, 0) (−1, 0)
up-left (−1, −1) (0, −1)

Geometry, in units of the flat-to-flat width, y downwards. With R = 1/√3 (centre to corner) and row height h = √3/2:

For square grids, cell (x, y) has corners (x, y), (x+1, y), (x+1, y+1), (x, y+1); up joins corners 0–1, right 1–2, down 2–3, left 3–0.

A placed shape uses the same formulas with (x + origin.x, y + origin.y). On a hex level the parity of the parent's grid decides which rows are shifted (§8.6).

Appendix C. A complete example

Informative. A village, an inn with a trapdoor to its cellar, a wolf pack template, and a two-scene quest. As a YAML folder:

# world.yaml
format: openworld
version: "0.3"
world:
  title: The Misty Vale
  system: dnd5e
  grid: { size: 5, unit: ft }
# locations/village.yaml
id: village
type: location
name: Mistholm
description: A dozen houses huddled around a chapel.
# locations/inn.yaml
id: inn
type: location
name: The Hanged Man Inn
parent: village
access: passages
# locations/common-room.yaml
id: common-room
type: location
name: Common room
parent: inn
origin: { x: 0, y: 0 }
shape: |
  ..P..
  .....
  ...t.
legend:
  P: inn-door
  t: cellar-trapdoor
description: |
  > [!read]
  > A fire crackles in the hearth.
contents:
  - id: chapel-rumour
    type: clue
    content: A drunkard swears he saw light under the chapel.
    targets: [cellar]
    leads_to: [n-the-cellar]
    discovery: { skill: Insight, dc: 12 }
# locations/cellar.yaml
id: cellar
type: location
name: Cellar
parent: inn
# passages/porte-inn.yaml
id: inn-door
type: passage
nature: door
a: village
b: common-room
side_a: { direction: s, label: the low door under the sign }
# side_b.direction is derived: P is on the top edge, and up is north
# passages/cellar-trapdoor.yaml
id: cellar-trapdoor
type: passage
nature: trapdoor
closure: closed
a: common-room
b: cellar
side_a:
  direction: down
  visibility: hidden
  discovery: { skill: Perception, dc: 15 }
side_b: { direction: up }
# templates/wolf-pack.yaml
id: wolf-pack
type: mob
template: true
name: Wolf pack
creatures:
  - { name: Wolf, count: 4, catalog: "srd-5.1:wolf" }
# quests/la-lumiere.yaml
id: q-the-light
type: quest
name: The light under the chapel
contents:
  - id: n-the-inn
    type: node
    name: A night at the inn
    locations: [inn]
    start: true
  - id: n-the-cellar
    type: node
    name: The cellar
    locations: [cellar]
    end: true

Lifted into the exchange file (§14.3), the clue becomes:

{ "id": "chapel-rumour", "type": "clue", "parent": "common-room",
  "content": "A drunkard swears he saw light under the chapel.",
  "targets": ["cellar"], "leads_to": ["n-the-cellar"],
  "discovery": { "skill": "Insight", "dc": 12 } }

Its node is n-the-inn: it sits in common-room, which no node names, so its parent inn is tried, and n-the-inn takes place there (§12.3). n-the-cellar has one incoming clue, so a linter warns that the Three Clue Rule asks for three. n-the-inn is a start and is exempt.

A full example world, adapted from Morgansfort: The Western Lands Campaign, is in examples/morgansfort/, with its exchange file morgansfort.owf.

Appendix D. Glossary

Term Meaning
Ancestor Any object up the parent chain
Contained object A mob, loot, clue, npc, trap, fixture, event, encounter table, service or document
Document Something handed to the players, which they keep; the clues it holds are learned by reading it (§10.10)
Door A passage drawn on a cell with an outer edge (§8.7)
Exit A passage seen from one of its ends (§13.2)
Incoming clue A clue that leads to a node from another node (§12.3)
Instance An object made from a template with from (§11)
Level The rooms placed with origin under one parent (§8.6)
Node A scene of the scenario (§12.2)
Outer edge A side of a cell whose neighbour is not part of the location (§8.3)
Place (of a clue) The location or passage ends where a clue sits, used to settle its node (§12.3)
Play state What happens at the table; kept by applications (Appendix A)
Quest A storyline of the scenario (§12.1)
Root The one location without a parent
Shape A location's text floor plan (§8)
Side A passage as seen from one end (§9.2)
Template An object made to be reused, with template: true (§11)