Skip to content

Erg scene (erg-scene/2)

Generated from docs/erg-scene-2.schema.json (https://melange.dev/schema/erg-scene-2.json). The guide is erg.md.

The editable scene of a level that uses level objects, a Survivor twin, a level script, new terrain blocks, a painted surround or trimmed base frames; a scene without any of them is written as erg-scene/1. The editable scene the level service sends to the Erg editor, followed by one binary frame per blob. Positions, scales and voxel coordinates are .xan units as stored; the editor shows world units (x20). Never written into a pack.

Property Type Required Default Description
format string Yes Must be "erg-scene/2".
stem string Yes Pattern: ^[^.]+$. 1 to 48 characters.
title string Yes Pattern: ^[ -~]+$. 1 to 40 characters.
base object Yes
registry object Yes
kind kind Yes
databank object Yes
water water Yes
spawns spawns Yes
hmp hmp Yes
units object Yes
frames array of object Yes At most 4096 items.
details array of object Yes At most 65536 items.
blobs array of object Yes At most 8192 items.
objects objects Yes Level objects. Each is a detail added to the level and named by its knot; deleting the detail deletes the object. Knots: CRATE_<n>, TP_<g>_<n> (g = the group), TRIG_<n> (n 0-255, no leading zeros) and minefactory; a detail named telepad is never written. At most 8 telepad groups and 1 mine factory.
script script Yes Metadata only: the text is script.lua next to the project patch (sim/<slug>.lua in a pack).
trims array of trim Base frames cut down in the build, one entry per frame at most. The scene keeps the whole grid (voxel ops still address it); the built level holds only the kept box, which is what the game’s 16-bit cell count sees. Every cell outside the box must be empty, and no detail on the frame may have a voxelPos. A box holding solid cells moves the frame by its offset from the grid’s centre and its details and child frames back by as much; an all-empty box keeps the frame where it is (a base frame out of the cell count for one cell). At most 4096 items.
previews object of string level.load only, not part of the saved document: resource name -> preview asset key, for every distinct detail resource in the scene.
Property Type Required Default Description
key string Yes Registry name, e.g. Multi.DinerMight. 1 to 79 characters.
source string Yes One of: "game", "pack".
file string Yes Level file stem of the base. 1 to 63 characters.
sha256 sha256 Yes
Property Type Required Default Description
levelType integer Yes From 0 to 16.
themeType integer Yes 5 = the databank’s theme. From 0 to 11.
scripts array of string Yes 1 to 8 items. Items: Pattern: ^[^,]+$. 1 to 63 characters.
previewType integer From 0 to 16.
Property Type Required Default Description
theme "" or theme
timeOfDay string One of: "", "DAY", "EVENING", "NIGHT".
materialFile string At most 120 characters.
heightmapBase string At most 64 characters.
heightmapSecond string At most 64 characters.
Property Type Required Default Description
worldPerXan integer Yes Must be 20.
Property Type Required Default Description
id integer Yes An object index of the base; -1..-64 for a new frame. From -64 to 16777216.
new boolean An added terrain block: under the Scene frame, no rotation, one scale 0.5-4 on every axis, each size 1-32 (the game asserts on 32: new blocks are 1-31), no heightMap (its corner offsets are corners).
corners array of number A new frame’s corner offsets in voxels, (X+1)*(Z+1) row by row along x (see erg-patch-2 addFrame.corners); absent means zeros. Only on a new frame. Items: From -64 to 64.
parent index or null Yes null for the root only.
name string Yes At most 127 characters.
pos vec3 Yes
rot rot3 Yes Euler angles in radians.
scale vec3 Yes
size array of integer Yes X, Y, Z voxels; at most 262144 in all. Exactly 3 items. Items: From 0 to 255.
voxels ref or null Yes Blob of X*Y*Z u32 LE words, index (z*X + x)*Y + y.
heightMap ref or null Yes Blob of (X+1)*(Z+1) f32 LE corner offsets, index z*(X+1) + x.
folder boolean Yes 1x1x1 with identity rotation and scale.
Property Type Required Default Description
id index Yes
src index or null Yes Object index in the base .xan; null for an added detail.
frame index Yes
name string Yes At most 127 characters.
resource string Yes At most 127 characters.
pos vec3 Yes
rot rot3 Yes Euler angles in radians.
scale vec3 Yes
voxelPos vec3 Yes
role string Yes Derived by the server; read-only. One of: "scenery", "spawn", "object", "camera", "light", "emitter", "sound", "collision", "marker", "other".
Property Type Required Default Description
ref ref Yes
kind string Yes hmp: the surround (hmp.ref), 100x100 f32 heights 0..1 then 100x100 u8 blend (50000 bytes), frame 0. One of: "voxels", "heightMap", "hmp".
frame integer Yes From -64 to 16777216.
bytes integer Yes From 0 to 1048576.

Type: integer. From 1 to 16777216.

Property Type Required Default Description
frame integer Yes A frame of the base with voxels. From 1 to 16777216.
min array of integer Yes The kept box’s first cell (x, y, z). Exactly 3 items. Items: From 0 to 255.
size array of integer Yes The kept box’s size; min + size is within the frame’s size. Exactly 3 items. Items: From 1 to 255.

Type: integer. From 0 to 16777216.

Type: array of number. Exactly 3 items. Items: From -1000000 to 1000000.

Euler angles in radians. Type: array of number. Exactly 3 items. Items: From -1000 to 1000.

Property Type Required Default Description
xan string Yes Pattern: ^[0-9a-f]{64}$.
xom string Yes Pattern: ^[0-9a-f]{64}$.
hmp string (Pattern: ^[0-9a-f]{64}$) or null

Type: string. One of: "ARABIAN", "WILDWEST", "CAMELOT", "PREHISTORIC", "BUILDING", "ARCTIC", "ENGLAND", "HORROR", "LUNAR", "PIRATE", "WAR".

Property Type Required Default Description
level number (From -1000 to 1000) or null World units, sea level 0; null keeps the default.
Property Type Required Default Description
mode string Yes One of: "random", "knots".
Property Type Required Default Description
mode string Yes One of: "copy", "none", "flat", "paint".
ref ref paint: the blob of the painted surround; copy: the base’s surround, when level.load was asked for it.
Property Type Required Default Description
survivor boolean false Also registered as a Survivor map (Multi.<stem>.S).

Metadata only: the text is script.lua next to the project patch (sim/<slug>.lua in a pack).

Property Type Required Default Description
present boolean Yes
sha256 string (Pattern: ^[0-9a-f]{64}$) or null

Type: integer. From 1 to 99.

Level objects. Each is a detail added to the level and named by its knot; deleting the detail deletes the object. Knots: CRATE_<n>, TP_<g>_<n> (g = the group), TRIG_<n> (n 0-255, no leading zeros) and minefactory; a detail named telepad is never written. At most 8 telepad groups and 1 mine factory. Type: array of one of: type = “crate”, type = “telepad”, type = “trigger”, knot = “minefactory”. At most 256 items.

Property Type Required Default Description
knot string Yes Pattern: ^CRATE_(0|[1-9][0-9]{0,2})$.
type string Yes Must be "crate".
crate one of: variant 1, kind = “health” Yes
Property Type Required Default Description
knot string Yes Pattern: ^TP_[1-8]_(0|[1-9][0-9]{0,2})$.
type string Yes Must be "telepad".
group integer Yes The group in the knot name; a pad sends a worm to another pad of its group. From 1 to 8.
Property Type Required Default Description
knot string Yes Pattern: ^TRIG_(0|[1-9][0-9]{0,2})$.
type string Yes Must be "trigger".
trigger object Yes
Property Type Required Default Description
knot string Yes Must be "minefactory".
type string Yes Must be "minefactory".
factory object Optional settings; a field left out keeps the game’s kMineFactoryData value. Written only when one is set.
Property Type Required Default Description
kind string Yes One of: "weapon", "utility".
contents string Yes A weapon or utility name of the install (level.objects). Pattern: ^[A-Za-z][A-Za-z0-9_]{0,62}$.
count count
hitpoints integer 25 From 1 to 1000.
parachute boolean false
Property Type Required Default Description
kind string Yes Must be "health".
amount integer Yes From 1 to 500.
hitpoints integer 25 From 1 to 1000.
parachute boolean false
Property Type Required Default Description
index integer Yes From 0 to 255.
radius number 60 From 1 to 1000.
teamCollect integer 0 From 0 to 8.
teamDestroy integer 4 From 0 to 8.
hitpoints integer 1 From 0 to 1000.
wormCollect boolean false

Optional settings; a field left out keeps the game’s kMineFactoryData value. Written only when one is set.

Property Type Required Default Description
activation integer NumMineActivation (game 20): at a turn start the factory fires when fewer mines than this are in the level, min(activation - mines, 10) of them; 0 never fires. From 0 to 255.
inactiveTurns integer NumTurnsInactive (game 7): turn starts the factory waits after it is placed and after each fire. From 0 to 255.
schemeMines boolean true false: the scheme’s 15 random start mines are not placed (its oil drums are).
keepKnot boolean false true: when the factory’s drop from its knot hits no land it stays at its knot (Melange 0.13+).
launchHeight integer Map units over the factory its mines appear at when it fires (20 when only launchRadius is set), instead of the game’s placement over random worms and objects (Melange 0.13+). From 1 to 255.
launchRadius integer Map units round the factory its mines appear within (default 0), so they fall round it (Melange 0.13+). From 0 to 255.
launchers array of array of integer 1-8 launch points [x, y, z], whole world units: a fire’s mines are shared out over them and erupt straight up from within launchRadius of each (Melange 0.13+ of the erg-mcp branch). 1 to 8 items. Items: Exactly 3 items. Items: From -100000 to 100000.
throw object The mines are lobbed out from the launchers (or the factory) to landing points minRange-maxRange map units away and landed by Melange where the flight meets the land (the erg-mcp branch). Fields at their defaults are left out when written.

The mines are lobbed out from the launchers (or the factory) to landing points minRange-maxRange map units away and landed by Melange where the flight meets the land (the erg-mcp branch). Fields at their defaults are left out when written.

Property Type Required Default Description
minRange integer 0 From 0 to 500.
maxRange integer Yes From 1 to 500.
apex integer 15 Map units the arc tops out over the higher of its ends. From 1 to 255.
pattern string "random" One of: "random", "ring", "targets".
avoidWater boolean true A landing point whose ground is under the water is drawn again.
targets array of array of integer [x, z] whole world units; pattern targets aims targetShare % of a fire’s mines within scatter of one of them. At most 16 items. Items: Exactly 2 items. Items: From -100000 to 100000.
scatter integer 10 From 0 to 255.
targetShare integer 50 From 0 to 100.
volley integer 0 At most this many mines a fire, whatever the engine’s min(activation - mines, 10) asked; 0: the engine’s count. From 0 to 10.
avoidRadius integer 0 Map units a landing point keeps off each avoid line; 0: none. From 0 to 50.
avoid array of array of array of integer Polylines of [x, z] whole world units (trails, say): a landing point within avoidRadius of one is drawn again. Needs avoidRadius. At most 8 items. Items: 2 to 32 items. Items: Exactly 2 items. Items: From -100000 to 100000.