Skip to content

Rooms & Zones

Rooms are the fundamental spatial unit in TalesMUD. Everything in the game world exists in a room: players, NPCs, items. Zones are logical groupings of rooms.

A room contains:

FieldTypeDescription
namestringDisplay name shown to players
descriptionstringProse description of the room
areastringZone/area grouping (e.g., catacombs, oldtown)
exitsmapDirectional exits to other rooms
actionsarrayInteractive objects and triggers
spawnersarrayNPC spawn configurations
itemsarrayItems present in the room
coordinatesobjectX, Y, Z for world map visualization
onEnterScriptIDstringLua script ID to run when a player enters
backgroundstringBackground image name for the game client

Exits are directional links between rooms. Standard directions:

  • north, south, east, west (aliases: n, s, e, w)
  • up, down
  • Custom exits with any name

Each exit specifies:

{
"direction": "north",
"targetRoomId": "R0102",
"hidden": false,
"description": "A narrow passage leads north."
}

Hidden exits are not shown in the room description until revealed via script:

-- Reveal a hidden exit for a specific character
tales.game.revealExit(roomID, "north", characterID)
-- Check if revealed
local revealed = tales.game.hasRevealedExit(characterID, roomID, "north")

Actions are named interactive triggers in a room. Players interact with them via the room action command. Actions can have Lua scripts:

{
"name": "lever",
"description": "An iron lever set into the wall.",
"scriptId": "SCR0012"
}

The script fires when a player uses the action. Context includes the acting character and room.

The area field groups rooms into logical zones. Areas are used for:

  • World map organization
  • Exploration XP bonuses (first time discovering an area)
  • Script conditions (if ctx.room.area == "dungeon" then ...)
  • Enemy and NPC balance by zone

Rooms can have x, y, z coordinates for world map visualization in the Creator UI. The coordinate system is open — assign any values that make geographic sense for your world.

{
"coordinates": { "x": 3, "y": 7, "z": 0 }
}

Room spawners automatically create NPC instances on a schedule:

{
"npcTemplateId": "ENM0001",
"maxCount": 3,
"respawnTime": 60,
"currentCount": 1
}

The spawner tick runs every 5 seconds. If currentCount < maxCount and the respawn timer has elapsed, a new NPC instance is created.

Each room can have a background image displayed in the game client (above the terminal). Images are stored in BACKGROUNDS_PATH (default: ./uploads/backgrounds). Set the background field to the image filename.

World content is authored as Markdown files in the zones/ directory and exported to YAML in data/:

zones/
└── Z03_gloomfen_marsh/
└── rooms/
└── R0301_marsh_edge.md
data/
└── rooms/
└── R0301.yaml

Never author content directly in data/ — always use zones/ and the export tooling.

GET /api/rooms — List all rooms
GET /api/rooms/:id — Get room by ID
POST /api/rooms — Create room
PUT /api/rooms/:id — Update room
DELETE /api/rooms/:id — Delete room