Materials

A material world from categorical swaps. Sand falls, water spreads, oil floats, fire propagates and lava quenches—not because a continuum solver draws those shapes, but because each cell follows local rules for motion, heat and transformation. The sphere is a falling-sand laborat

The idea

A material world from categorical swaps. Sand falls, water spreads, oil floats, fire propagates and lava quenches—not because a continuum solver draws those shapes, but because each cell follows local rules for motion, heat and transformation. The sphere is a falling-sand laboratory for qualitative physics, not a calibrated continuum code.

Science and concept

A cellular world of mutually exclusive states

The simulation divides the viewport into a two-dimensional lattice. Each cell stores one material ID from a finite alphabet:

Empty · Wall · Sand · Water · Wood · Fire · Smoke · Stone · Oil · Steam · Lava · Ash

Additional arrays store temperature, lifetime and visual variation. At every substep, the engine inspects a local neighbourhood and may move, swap, transform or extinguish the current cell. The world therefore belongs to the broad family of cellular automata and lattice material models: global evolution is assembled from repeated local transitions.

The representation makes a strong simplification. One cell cannot simultaneously contain mixtures, partial volume fractions, pressure, velocity and chemical composition. A water cell is “water” because its discrete label says so. Exchange often occurs by swapping two labels, not by moving a continuous mass through space.

That simplification is not a flaw if it is understood. It makes causal rules visible and computation fast enough for direct painting. It becomes misleading only when the result is described as real fluid dynamics or thermodynamics.

Update order is part of the physics

A naive falling-sand automaton that scans every row left-to-right can develop a systematic sideways bias. AL.Floys counters this by alternating or pseudo-randomising horizontal traversal. It also marks updated cells so a particle is not moved repeatedly in one substep.

These are algorithmic decisions, but they have visible consequences. In a discrete in-place simulation, update order acts like an additional rule of motion. The engine’s world is therefore determined not only by “sand falls” but by when cells are visited, which alternative direction is tried first, and how stochastic ties are broken.

The same lesson generalises across computational science: implementation scheduling can become model behaviour when local updates share state.

Granular matter is not simply a solid or liquid

Real sand can support a static pile like a solid, flow like a liquid and disperse like a gas under different conditions. Granular physics includes friction, force chains, jamming, dilation and inelastic collisions. The AL.Floys model captures only a visual subset. A sand or ash cell tries to fall into empty or less obstructive material; if blocked, it tries diagonal directions. Repetition creates piles and avalanches with an apparent angle of repose.

That angle is not derived from grain shape, friction coefficient or stress. It is an emergent property of the neighbourhood and movement probabilities. The engine can therefore demonstrate rule-generated pile geometry, but it should not report a physical friction angle.

Density becomes an ordering rule

Each material has a hand-authored density value. Granular cells can displace selected fluids and gases; oil and water can exchange so that the lighter oil rises; lava, water and oil have ordered invasion rules. This produces stratification and buoyancy-like behaviour.

The mechanism is categorical rather than mechanical. There is no pressure gradient or Archimedean force. “Density” determines whether one cell is permitted to replace another. The visible result can resemble sedimentation or flotation, but the causal model is a local priority relation.

This is still conceptually rich. It shows that a macroscopic ordering—sand below water, oil above it—can arise from many local comparisons. It also gives the visitor a chance to ask what is lost when a continuous physical quantity becomes a discrete rule.

Liquids are local spreading heuristics, not Navier–Stokes fields

Water, oil and lava first attempt downward or diagonal movement. If blocked, the simulation scans laterally within a dispersion range for a permissible target, allowing pools to level and fill containers. Material-specific viscosity and dispersion values tune how quickly this occurs. A second horizontal-relaxation pass improves settling.

No cell stores a velocity vector. There is no momentum advection, pressure solve, incompressibility constraint, vorticity equation, surface tension or free-surface reconstruction. A stream does not continue moving because of inertia; it moves because the local scan again finds permitted space.

The correct claim is that the automaton creates fluid-like redistribution, not fluid mechanics.

Gases reverse the preferred direction

Smoke and steam seek upward, diagonal-up and sideways cells and decay after a finite lifetime. Open-top boundaries allow them to escape. The same lattice machinery that makes heavy cells fall can make light states rise by reversing the priority of movement.

This symmetry is educationally useful. The visitor sees that “upward buoyancy” in the model is not a force calculated from surrounding fluid. It is a different transition rule assigned to a material category.

Heat is an auxiliary diffusing field

Temperature is stored separately from material identity. The engine averages local neighbours according to hand-authored conductivity values and relaxes temperature toward an ambient setting. Heat capacity changes the rate of response. Hot fire or lava can therefore warm nearby cells and sustain reactions.

The numerical field is only qualitatively thermodynamic. Heat exchange is not derived from cell size, mass, density and measured thermal conductivity. Energy is not globally conserved; ambient cooling removes it; reactions create or delete it according to rules. Temperatures displayed in degrees Celsius supply an intuitive scale but also create false precision.

A more honest public label would be Temperature scale (°C-like) or an explicit Field Note stating that the numeric values are stylised thresholds, not calibrated laboratory temperatures.

Combustion and phase changes are rule networks

Wood near fire or sufficiently high temperature may become fire or ash and emit smoke. Oil can ignite. Water above a threshold may become steam; steam below another threshold may condense. Lava contacting water can create steam and may become stone.

These transformations create compelling causal chains, but they are not chemical kinetics. There is no oxygen concentration, fuel mass, stoichiometry, reaction rate law, latent heat, pressure or conservation of products. The system models the qualitative dependency graph of familiar events:

heat + fuel → flame + smoke
water + sufficient heat → steam
steam + cooling → water
lava + water → steam + solidified rock

This makes Materials particularly suitable for playful hypothesis testing, provided the copy describes rules as inspired by physical relations rather than physically exact.

A hierarchy of local behaviours

One reason the sphere feels richer than a single sand automaton is that several local systems are layered in a deliberate order: heat diffusion, reactions, granular motion, liquid motion, density correction, gas motion and decay. Each pass changes the state seen by later passes.

The world is therefore not one universal cellular rule. It is a heterogeneous rule ecology in which material classes receive different update operators. The conceptual question becomes: how can a coherent-looking material world be assembled from a patchwork of local approximations?

History

Cellular automata were developed as formal systems in which a lattice of discrete cells updates according to local rules. Their scientific importance lies in showing that repeated neighbourhood operations can generate large-scale structures, propagation and computation.

Granular-flow researchers used cellular automata well before interactive falling-sand sandboxes became a popular software genre. Baxter and Behringer’s 1990 work introduced automata informed by experiments on irregular grains and reproduced features such as alignment, channel formation, defects and free-surface shape. Such models were not identical to today’s pixel sandboxes, but they established a serious scientific lineage for treating granular motion through local discrete rules.

Interactive falling-sand systems later turned the same broad idea into a direct-manipulation world: every pixel or cell represents a material; users paint powders, liquids, solids and reactive states; simple local rules generate piles, flows and chain reactions. Despite the genre name, mature examples commonly contain far more than sand.

The AL.Floys engine was explicitly developed from an earlier prototype called Sand / Materials / Sand Lab. The design brief aimed to preserve the immediacy of painting sand, water, walls, wood, fire and smoke while adding oil, steam, lava, ash, heat, density and phase-change rules in a modular simulation architecture.

The lineage is best expressed as:

cellular automata → discrete granular-flow models → interactive falling-sand material sandboxes → AL.Floys multi-material, heat-and-reaction extension

It should not be narrated as a progression toward full physical realism. The strength of the medium is legibility and interactivity, not convergence on a continuum solver.

What this simulates

Aspect Current implementation
Entities / field One material ID per grid cell, plus temperature, lifetime, visual variant and updated flags.
Material classes Empty, immovable solid, granular, liquid, gas and reactive/energy-like states.
Granular update Bottom-oriented movement into empty, liquid or gas cells; diagonal alternatives; stochastic traversal.
Liquid update Downward/diagonal displacement followed by lateral search and relaxation; material-specific dispersion/viscosity.
Gas update Upward/diagonal/sideways movement with finite lifetime and optional escape at the open boundary.
Density rules Hand-authored density values and explicit invasion/swap permissions, including oil–water ordering.
Heat Local conductivity-weighted averaging and relaxation toward ambient; no conserved total energy.
Reactions Probabilistic water–steam transition, condensation, combustion, smoke generation and lava–water steam/stone reaction.
Boundary modes Solid walls, open top or toroidal wrap.
Randomness Seeded traversal, movement alternatives, reaction probability, lifetime and rendering variation.
Rendering interpretation Pixel or smooth material palette, optional temperature glow and visual jitter.
Public simple controls Initial scene, gravity, fluid dispersion, visual style and brush softness.
Public tools Brush, Spawn and Erase with selectable material targets; Clear Canvas field action.

Current implementation defect: Clear Canvas restores the current scene

The field action is described as clearing painted materials while preserving required boundary walls. SandSimulation.applyAction('clear-field'), however, calls reset('sand-clear-' + Date.now()). Reset re-applies the current initialScene through applySandInitialScene().

Consequences:

  • In Blank Sandbox, the action appears to work because the configured scene is already empty.
  • In Avalanche & Delta, Combustion Chamber, Volcano Meets Sea, Hourglass or Layered Density Tank, the action reconstructs the preset scene instead of clearing it.
  • Date.now() introduces nondeterminism into an otherwise seeded simulation action, weakening replay and snapshot reproducibility.

This is a P0 contract defect. The fix should directly clear mutable cells to Empty, reset temperature/lifetime to ambient defaults, then reapply only boundary cells required by the current boundary mode. It should use the existing deterministic RNG/episode seed if any variation is necessary. Add tests for non-empty initial scenes and deterministic action replay.

Current product defect: the showcase is blank

The definition assigns showcasePresetIndex: 0, and the first preset is Blank Sandbox. The mobile showcase likewise uses a blank mobile table. A sphere intended as part of a scientific atlas can therefore open with no material motion and no visible evidence of its generative principle.

Blank canvas is valuable as a creative preset, but it is a weak canonical first encounter. Recommended showcase:

  • desktop: Avalanche & Delta;
  • mobile: a reduced-resolution Avalanche & Delta Mobile or Layered Density Tank Mobile;
  • keep Blank Sandbox as the first explicit creation preset, not the automatic demonstration.

Current epistemic issue: degrees Celsius imply more calibration than exists

The control schema labels ambient temperature in °C and uses familiar boiling/ignition-like thresholds. Because the model does not conserve energy or use calibrated material quantities, the values should be treated as a Celsius-inspired simulation scale. Either soften the unit label or place the qualification prominently beside the thermodynamics controls.

Current telemetry issue: “energy” is normalised mean temperature

The generic statistics channel uses a normalised temperature-derived value as energy. It is not physical energy. The UI should label it Mean temperature index or Thermal activity, never Energy, unless the telemetry surface supports an explicit per-engine label.

What to look for

Pile formation — local diagonal rules produce a macroscopic slope

Sand falls until blocked, then explores diagonal space. A stable triangular pile appears without a global surface solver. Compare its slope under different gravity and update regimes.

Avalanches — stability is conditional

Adding grains near the top can trigger a cascade down the surface. The pile alternates between local stability and discrete rearrangement.

Sedimentation and flotation — categorical density sorts the world

Sand sinks through selected fluids; oil rises relative to water; gases rise through empty space. The final layering reveals repeated local swaps.

Pooling and lateral relaxation — liquids search for lower configurations

Water fills cavities and levels approximately. Watch the limits: flow lacks inertia and pressure waves, so narrow channels and fast pours may look algorithmic.

Interface reactions — boundaries become active

Lava and water transform primarily where they meet. Wood burns from contact with fire or heat. The most informative regions are therefore material interfaces, not homogeneous interiors.

Thermal lag — state changes follow heat transport

A cell may warm before it transforms. Observe whether temperature glow precedes combustion or boiling-like transitions.

Gas lifetime and venting — products leave the active world

Smoke and steam rise, spread and decay or escape through an open top. The boundary condition materially changes the apparent reaction products.

Grid and traversal artefacts — the computation becomes visible

At coarse resolution, diagonals, single-cell gaps and directional preferences become legible. These are not merely graphical flaws; they reveal the discrete ontology of the model.

How to explore

First 30 seconds

  1. Load Avalanche & Delta. Watch sand and water separately before painting anything: identify falling, diagonal piling, downward liquid flow and lateral settling.
  2. Reduce Gravity toward zero. Observe which changes stop and which continue; gas rise and reaction rules are not all controlled by the same parameter.
  3. Restore the preset and increase Fluid dispersion. Follow how quickly water finds lateral space.
  4. Load Layered Density Tank and watch the ordering of sand, water, oil and gas-like cells.
  5. Do not rely on Clear Canvas inside a non-empty preset until its reset bug is fixed.

Three experiments

Experiment Question Do Watch for Why it matters
Granular stability How does a local falling rule create a pile and avalanche? Load Hourglass or paint a wall funnel; compare low, default and high Gravity with resets between trials. Fall rate, pile slope, intermittent surface cascades and bottleneck discharge. Connects cell swaps to granular-looking form while exposing the model’s qualitative nature.
Density ordering Can repeated pair exchanges create stable layers? Load Layered Density Tank; add a narrow vertical stroke of sand, then water and oil in reversed order. Sand descent, water/oil exchange, trapped pockets and eventual stratification. Makes categorical density rules visible.
Reaction at an interface Why do transformations localise where materials meet? Load Volcano Meets Sea; compare phase change enabled and disabled in the advanced controls, or paint a controlled water band against lava. Steam generation, local stone formation, cooling front and reaction count. Separates movement from state transformation and reveals the heuristic reaction network.

A fourth useful experiment after Clear Canvas is repaired: start from a truly empty field, build identical containers, and compare Water and Oil under the same geometry.

Parameters that teach

Parameter What it really controls Increase it Decrease it What to watch
Initial scene Reset-time arrangement of materials and boundaries. Categorical. Categorical. History dependence and staged experiments.
Resolution Number of lattice cells across the world. Finer geometry, greater cost and smaller visible grid artefacts. Coarser, faster, more obviously cellular behaviour. Numerical ontology, not grain diameter.
Substeps Number of local update cycles per frame. Faster model-time advance and more reactions/motion. Slower evolution. Pacing versus changed update ordering.
Gravity Probability/strength scale for downward granular and liquid movement. Faster settling and discharge. Slower or suspended heavy materials. Which material classes obey the parameter.
Fluid dispersion Lateral search range for liquids. Faster spreading and levelling. Narrower, more column-like flow. Pool shape and channel filling.
Gas diffusion Sideways/upward exploration of gases. Broader smoke/steam plumes. Narrower rising columns. Product dispersal.
Boundary mode Whether edges are walls, open at top or periodic. Categorical. Categorical. Accumulation, venting and wrap artefacts.
Heat enabled Whether the auxiliary temperature field evolves. Enables thermal lag and coupling. Removes heat transport while some direct rules may remain. Which reactions truly depend on temperature.
Cooling rate Relaxation toward ambient. Faster loss of hot regions. Longer thermal persistence. Flame/lava influence range.
Ambient temperature Reference value for cooling and new/empty cells. Warmer baseline. Cooler baseline. Treat as a stylised scale, not calibrated °C.
Combustion enabled Enables fuel-to-fire/ash/smoke transformations. Categorical. Categorical. Reaction dependency.
Phase change enabled Enables water/steam and lava/water transformations. Categorical. Categorical. Interface-specific changes.
Brush softness Probability/falloff of painted material. Softer, sparser edges. Denser, harder strokes. Intervention geometry, not material physics.
Visual style / temperature glow Rendering only. Different legibility of state and heat. Different legibility. Do not interpret as changed dynamics.

Presets as experiments

Avalanche & Delta

The strongest public showcase. It simultaneously exposes granular settling, water displacement, lateral flow and evolving interfaces without requiring the visitor to construct a scene first.

Mobile Sand Table

A low-cost empty creative canvas. Keep it as a mobile interaction preset, but not as the only automatic showcase.

Combustion Chamber

Contains wood and an initial fire seed. It is the cleanest regime for tracing ignition, flame lifetime, smoke generation and ash.

Volcano Meets Sea

The most visually dramatic reaction preset. It should be framed as a qualitative rule world, not a geophysical eruption model.

Hourglass

The best granular-flow experiment because boundary geometry constrains discharge through a bottleneck and exposes scan/order artefacts.

Layered Density Tank

The best density and material-ordering experiment. It makes the hand-authored hierarchy of sand, water, oil and gases explicit.

Blank Sandbox

Essential for creation and controlled experiments after the Clear Canvas action is repaired. It should not be the default scientific showcase.

Recommended learning order:

Avalanche & Delta → Layered Density Tank → Hourglass → Combustion Chamber → Volcano Meets Sea → Blank Sandbox

Interactions

Brush

Paints the selected material probabilistically with a falloff controlled by brush softness and pointer strength. For fire, lava, smoke and steam it also initialises temperature or lifetime state.

Spawn

Paints a denser region than Brush. For liquids it is deliberately close to a full pour, making it the better tool for volume comparisons.

Erase

Sets cells to Empty, restores ambient temperature and removes lifetime state. Protected boundary cells may remain.

Clear Canvas

Intended to remove all mutable material while retaining structural boundary walls. Currently broken for non-empty initial scenes because it performs a reset and re-applies the scene. Do not document it as reliable until fixed.

The distinction between Brush and Spawn is probabilistic fill density, not a different material law. UI copy should make that difference explicit or consider naming them Paint and Pour for this sphere.

What this does not mean

This is not a particle-based molecular simulation. One pixel is not one molecule or grain with measured mass and momentum.

It is not a continuum mechanics solver. There is no Navier–Stokes pressure field, granular stress tensor, force chain, viscosity equation, surface tension, compressibility or momentum conservation.

The temperature field is not calibrated thermodynamics. Heat and reaction rules do not conserve energy; phase changes omit latent heat; combustion omits oxygen, fuel accounting and stoichiometry.

The density values are ordering coefficients used in local swaps, not measured kilograms per cubic metre.

Lava–water interaction is an evocative rule, not a volcanic, hydrothermal or rock-formation model. Fire is a reactive state with a lifetime, not a plasma or resolved flame front.

The simulation’s scientific value lies in qualitative local causation and discrete modelling, not predictive fidelity.

Why it belongs

Materials contributes a manipulable world of local physical metaphors. Gravity applies a universal force to moving particles. Flow approximates a continuous velocity field. Phase Separation evolves a conserved composition field. Materials instead assigns different local rules to different categories of matter and lets their interfaces negotiate the world. It makes the modelling act visible: to simulate familiar material behaviour, the programmer must decide which distinctions, priorities and transformations matter.

Sources

Foundational and scientific context

  1. G. William Baxter and R. P. Behringer, “Cellular automata models of granular flow”, Physical Review A 42, 1017(R) (1990). DOI: 10.1103/PhysRevA.42.1017.
  2. Heinrich M. Jaeger, Sidney R. Nagel and Robert P. Behringer, “Granular solids, liquids, and gases”, Reviews of Modern Physics 68, 1259–1273 (1996). DOI: 10.1103/RevModPhys.68.1259.
  3. Jonathan Devlin and Micah D. Schuster, “Probabilistic Cellular Automata for Granular Media in Video Games” (2020), arXiv:2008.06341. Useful modern context for qualitative game-scale granular automata; not a direct source for the AL.Floys rules.

Computational-genre context

The accepted term falling-sand simulation/game denotes interactive two-dimensional cellular or particle sandboxes that commonly include many materials besides sand. The AL.Floys history document explicitly identifies this lineage and the earlier Sand prototype, while requiring the implementation to remain qualitative rather than physically exact.

Enter this field →