OptionalburnLifetime in ticks for cells of this material when its
simulation is 'fire'. After this many ticks the cell
turns to air (id 0). Required for 'fire' materials —
registering a fire material without burnDuration throws.
Must be in 1..256 (the cellTimers Uint8Array saturates
at 255, so values above 256 would never reach the threshold
and the cell would silently burn forever). Ignored for
non-fire materials.
Worked example: burnDuration: 4. A freshly-lit fire cell:
So the cell is alive at the start of ticks 0..3 and dies
during tick 3. burnDuration: N means "die on the Nth tick"
(lives N ticks total, including the tick it was lit on).
For demo 09's "burn long enough to walk a wood plank" feel
we use burnDuration: 40 (~⅔ s at 60 fps).
Fallback flat color, packed as 0xRRGGBB. Used when no texture is set.
Mass density for derived debris bodies.
When false, the material cannot be carved (indestructible bedrock).
0..1, scales destruction radius for carve operations on this material.
OptionalflammableIf true, an adjacent 'fire'-simulation cell can ignite
this material — converting it in-place to the fire material
id. Combine with 'static' for solid burnables (wood, dry
grass) or with 'oil' for flammable liquids.
Defaults to false when omitted.
OptionalflowOptional override for the maximum number of cells this fluid can flow horizontally per tick when blocked from vertical motion. Higher = more "responsive" spread; lower = more granular / viscous. Reasonable values per kind:
4 (default; fast leveling)3 (slightly viscous, floats on water)2 (treacly)6 (aggressive)1 (barely flows)Must be in 0..16. 0 disables horizontal flow entirely
— useful for granular materials with simulation: 'sand'.
Ignored for 'static' and 'fire' materials. When omitted,
fluids fall back to the module-default 4; 'sand'-
simulation materials always use 0 regardless of this
field.
Friction coefficient applied to debris bodies.
Stable id stored in the bitmap. Must be in the range 1..255.
Human-readable name. Used for debugging and material lookup.
Restitution (bounciness) applied to debris bodies.
OptionalsettleOptionalsettlesIf a fluid cell of this material doesn't move for
settleAfterTicks consecutive ticks, it's promoted in place
to material id settlesTo. The promoted material is typically
a 'static'-simulation variant of the same visual color so
the pile becomes part of the static collider mesh.
Both fields must be set together for settling to engage —
registering with one but not the other throws at registration
time. settleAfterTicks must be in 1..256 (the cellTimers
Uint8Array saturates at 255, so a threshold above 256 would
never be reached and the cell would silently never promote).
Worked example: settleAfterTicks: 3. A sand cell that
lands and can't move:
So the cell is promoted on the third stationary tick.
settleAfterTicks: N means "promote on the Nth stationary
tick" — the cell lives N - 1 full ticks as the moving
variant before the Nth tick promotes it. For ~½ s at 60 fps
use settleAfterTicks: 30; demo 09 uses this.
Bridges fluid sim and physics: a sand pile that's been at rest long enough becomes part of the terrain and dynamic bodies can stand on it.
OptionalsimulationSimulation kind for the cellular-automaton step. Defaults to
'static' when omitted — i.e. existing v1 materials behave
identically without changes.
OptionaltextureOptional Phaser texture key for tiled rendering.
Description of a material that can occupy a bitmap cell.
Material id
0is reserved for air and is never registered. Registered material ids must be in the range1..255so they fit in one byte.