Simulation · Published v2
Ember Archipelago
A spreading fire crosses a planted island, leaving charcoal behind. Nearby heat ignites trees; each burning cell consumes its fuel. Recompile to restore the forest, or paint Fire to start another front.
No preview
Inside this simulation
Every named building block is public and reusable. These are the exact versions published with this simulation.
Source
// Separate phases let ignition observe burning neighbors before fuel is consumed.
property Fuel { fuel: Float<1.0> [0.0 1.0]; }
property Heat { heat: Float<1.0> [0.0 1.0]; }
model Ash : Fuel { fuel<0.0>; };
model Fire : Fuel, Heat;
model Pine : Fuel;
world { dimensions 3; cell Cube; neighborhood VonNeumann; }
behavior Ignite for Fuel { transform into Fire when sum n in neighbors[Heat] { n.heat } > 0.25 { set target.fuel = self.fuel; set target.heat = 1.0; } }
behavior BurnFuel for Fuel + Heat { update { set self.fuel = max(0.0, self.fuel - 0.06); set self.heat = max(0.1, self.fuel); } }
behavior Charcoal for Fuel + Heat { transform into Ash when self.fuel < 0.08; }
phase ignition { run Ignite on Pine; }
phase combustion { run BurnFuel on Fire; }
phase cooling { run Charcoal on Fire; }
visual Char for Fuel { color { rgba(0.16, 0.12, 0.20, 1.0) } }
visual Flame for Fuel + Heat { color { rgba(1.0, 0.12 + self.fuel * 0.65, 0.02 + self.fuel * 0.08, 1.0) } }
visual Forest for Fuel { color { rgba(0.10, 0.43 + self.fuel * 0.28, 0.21, 1.0) } }
visualize Ash with Char;
visualize Fire with Flame;
visualize Pine with Forest;