Docs/JSON

Objects and prefabs

Define reusable prefabs and static map placements in objects.json.

API version 1Lua 5.1Updated 2026-11-07

Prefabs made of the game's own scenes (houses, sheds, fences, modular parts) and the static buildings a scenario places on public maps. Live: /scenario reload resynchronises the loaded maps. Needs the piece export (Pieces.json and Pieces.collision in the exports folder, made with RTV_EXPORT_AREA=Pieces); without it a scenario with object definitions fails to load. The design is in docs/buildings.md; Lua placement is in the Lua reference.

{
  "limits": {
    "max_buildings_per_area": 64,
    "max_pieces_per_area": 512,
    "max_shapes_per_area": 8192
  },
  "prefabs": {
    "checkpoint": {
      "doors": true,
      "pieces": [
        {
          "asset": "shack_brick",
          "offset": [0, 0, 0],
          "yaw": 0
        },
        {
          "asset": "fence_military",
          "offset": [6, 0, 2],
          "yaw": 90
        }
      ]
    }
  },
  "placements": {
    "Village": [
      {
        "id": "north_camp",
        "prefab": "checkpoint",
        "position": [10, 0, -40],
        "yaw": 90,
        "snap": true
      },
      {
        "id": "north_fence",
        "asset": "fence_wood",
        "position": [24, 0, -40]
      }
    ]
  }
}

Layering: limits merge key by key. A prefab replaces the inherited prefab of the same name (null deletes it). A map's placements list replaces the inherited list of that map (null or [] clears it).

  • limits: per area, counting buildings from every source. Defaults 64 buildings, 512 pieces, 8192 collision shapes (maximums 1024, 8192, 100000). A prefab or a map's placements that exceed them is a load error; Lua and console placements are refused at run time.
  • prefabs.<name>: name [A-Za-z0-9_-]{1,48}.
    • pieces lists one or more {asset, offset, yaw} entries. asset takes a unique short name or an exact path in Pieces.json. offset is metres in the prefab's frame. yaw is degrees around +Y and defaults to 0.
    • doors (default true): false leaves doorways open. No door shapes are added on the server and clients drop the door nodes.
  • placements.<Map>: public maps only (hideout maps cannot have buildings), and only maps in scenario.json maps.
    • id (required, unique per map, [A-Za-z0-9_-]{1,48}) keeps a placement stable across reloads.
    • Exactly one of prefab (a named arrangement) or asset (one exported object). Both use position [x, y, z] and optional yaw in degrees (default 0).
    • snap (default true): move down to the first static surface found by a ray from 2 m above to 50 m below; false keeps the exact height.

Use server.fetch_assets() in Lua to discover asset references. Short names are case-insensitive. If a name is ambiguous, use a path such as Prefabs/Village/Campsite.tscn, with optional res://.

Placement refuses (the building is skipped and [building] scenario placement skipped is logged) when the prefab is unknown, a limit would be exceeded, there is no ground, or the padded bounds hold a living player or AI actor, a transition or the map spawn. Overlap with map geometry is allowed. At map load saved AI actors inside a new building are relocated instead of refusing it.

Loot: containers (cabinets, fridges, crates), loot spawners and fixed pickups in the scenes work like the map's own. Each placed piece registers its loot sources on the map (ids like c:RTVBuildings/<building id>/P0/<node>), so they roll with the map's loot tables, presets, zones and loot.json rules, and the optional economy counts them. Removing a building removes its loot and what it spawned; looted state is kept under the building id, so a building that keeps its id keeps its looted state across restarts. Needs a revision 3 piece export.

Buildings are re-applied on every load and are not saved. The patched navmesh is cached in <data>/nav-cache/<Map>-<hash>.nav; the hash covers the map's navigation stamp, the piece export, the navigation settings and the resolved placements, and older files for the map are deleted when a new one is written.

A ready-to-copy example is scenarios/example/objects.example.json; it is not named objects.json so the example scenario still loads on servers without a piece export (rename it to use it, after checking its scene names against your Pieces.json).

Errors name the file, path and reason, for example mine/objects.json: placements.Village[0].prefab: unknown prefab "x".

Found a mistake or missing detail? Tell us in the Discord.