Skip to content

Data tables

For creatorsAdd-on 1.58.0+

A data table is a list of rows that your game reads: the weapons a hero can carry, the stops on a route, the levels of a maze, the way a car handles. Facts kept in a table stay out of the graph’s wiring. To change a price you edit one number, and the graph stays the same. Tables live inside your .blend, so the .blend stays the whole source of the game.

A table is a JSON file with a rows list. Each row is one thing. Each field in a row is a column:

{ "rows": [
{ "id": "bat", "name": "Bat", "kind": "melee", "damage": 35 },
{ "id": "pistol", "name": "Pistol", "kind": "gun", "damage": 25, "ammo": 60 }
] }

Rows are counted from 0: bat is row 0, pistol is row 1. A row doesn’t need every field. A missing field reads as empty.

  1. Open a Text Editor and press New.
  2. Rename the text block to data/<name>.json, for example data/weapons.json. The data/ at the front and the .json at the end are what make it a table.
  3. Type or paste the table.
  4. Save the .blend.

That’s all. Every text block named data/….json goes into the cartridge when you build it, and Play serves it to the viewer while you test (see Limits). A table that isn’t valid JSON stops the build, so a broken table never reaches players. A table you delete in Blender is gone from the next build (add-on 2.2.0).

The Data Table node reads one field of one row:

Setting or pin What it is
src the table, such as data/trail.json (default data/table.json)
field the column to read, such as mile
row (input) the row number, from 0
Value (output) that field’s value. A row or field that isn’t there reads as empty
Rows (output) how many rows the table has

The trail reads its route this way: src is data/trail.json, field is mile, and the row pin takes the stop the wagon has reached. Its rules never hold a single place name or mile. See the trail.

The viewer loads every table a graph names before the graph starts, so On Load can read them straight away.

Some parts of the viewer read a table without any graph. The scene names the table with a tag, or uses the default file:

Table Default file Scene tag What it holds
Weapons data/weapons.json player.weapons one row per weapon the hero can carry: id, name, kind (melee or gun), damage, reach, cooldown, ammo, model, hotkey, grip and more. player.weapons.start lists the ids the hero starts with. See weapons
Handling data/handling.json vehicle.table one row per kind of car: id, mass, accel, topSpeed, grip and more. A vehicle’s vehicle.handling tag names its row’s id. See make a vehicle
Levels data/level.json (none) one row per painted level, written for you by the level bake (below)

You rarely type the handling table yourself. The add-on writes it: Make ▸ Make Vehicle in Properties ▸ Object ▸ Simulacrum starts the car’s row from the Handling preset you pick, and the Vehicle panel’s fields edit that row. A row is shared, so every vehicle on it changes; the button beside Handling row (Own Row) gives one vehicle a row of its own. A vehicle.<field> tag on a single vehicle wins over its row.

A grid level can be painted in Blender and baked into a table. The level is an Empty; the tiles and markers are its children.

Tag On Values What it does
level the level Empty 1 makes it a level
level.size the level Empty w,h in cells, such as 21,21 the grid’s size
level.cell the level Empty metres (default 1) one cell’s size
level.marks the level Empty names, such as start,exit marks the level must have
level.data the level Empty a table (default data/level.json) where the bake writes
level.index the level Empty 0, 1, … its row, when several levels share one table
level.name the level Empty text the row’s name
cell.value a tile, a child of the level a number the value of the cell it stands on
level.mark an Empty, a child of the level a name, such as start a named spot, written as startX and startY
sim.source the level Empty and each child 1 keeps the object in the .blend only. The baked table carries the level, so the tiles themselves never publish

Add the tags as custom properties, or with Add Tag in Properties ▸ Object ▸ Simulacrum ▸ Tags: from add-on 2.2.0 the bake reads both. (Older add-ons read only custom properties named exactly as in the table.)

Press Bake Levels in the 3D viewport’s header, which shows once the scene has a level, or Bake in Properties ▸ World ▸ Simulacrum ▸ Levels, to check every level. Each level becomes one row with its name, its grid and each mark’s position. Marks named with a trailing number, such as sentry0 and sentry1, also form lists sentryX and sentryY.

The bake refuses two objects on one cell, an object outside the level, and a missing required mark. It warns about a tile that stands off its cell’s centre. Every build bakes again, so what ships always matches what you painted. To add a second level, paint it under a second level Empty with level.index = 1.

The maze chaser paints its maze this way.

The viewer reads each table once, when the scene loads. After you edit a table, reload the viewer page to see the change.

To try values while the game runs, copy them into variables first: an On Load chain reads the table and sets the variables, and the rest of the graph uses the variables. Then the Inspector’s Set Live Value changes them on the spot (see watch and debug a running game). Copy the values you settle on back into the table.

  • The Inspector shows and edits variables, not tables. A table changes only when you edit it and reload.
  • In Play, Blender serves the tables, sprite sheets and painted levels only while Send Meshes is on in the Play settings. It is on by default. Before add-on 2.2.0, Play also served them only to a scene with a rules graph.
  • A table the viewer can’t find reads as empty: no rows, and every field empty.
  • A text block made by a Python script needs a fake user, or Blender drops it when you save the .blend.
  • When the bake finds a problem, Blender’s status bar says how many. The list of problems is in Properties ▸ World ▸ Simulacrum ▸ Levels: one box per level with its cells by value, its marks and up to eight errors, or Clean.