home/ modules/ simulating-natural-systems

Simulating natural systems: automata, flow fields, and growth

  • learner can implement cellular automata (Game of Life, Langton's Ant, continuous CA) from local neighbour rules
  • learner can build Perlin flow fields and noise fields that steer motion organically
  • learner can grow organic structures via diffusion-limited aggregation and circle packing

Build a 'nature of code' simulation suite: a Game-of-Life/Langton's-Ant automaton, a Perlin flow field steering particles, and a growth process (DLA or circle packing), each running as a self-contained live sketch.

Nature simulations are the visual backbone of an audiovisual live set: an automaton pulsing on the beat, a flow field carrying particles through a breakdown, a dendritic growth blooming over a build. This module turns three families of natural-system algorithms into self-contained sketches you can drop into a projection rig and mutate live — where every sketch must keep running while you edit it, so clean state handling matters as much as the rule itself.

The arc starts with the most constrained system: grid automata. Begin from the local-neighbour-rule model and its non-negotiable two-phase update (compute all next states, then apply), instantiate it as Conway’s two survival/birth rules, then loosen it twice — Langton’s Ant swaps the synchronous grid for a single agent writing its memory into the environment, and the continuous-value averaging CA trades discrete states for fluid wave propagation. Next you leave the grid’s lockstep for continuous space: 2D noise traversal (nested loops, per-axis seeds, the typewriter-style row reset) generates smooth fields, noise-driven grid displacement clusters shapes organically, and mapping noise to angles yields the flow field that steers your particles. Finally, growth: DLA’s snap-to-nearest-neighbour accretion and collision-frozen circle packing each build structure no one designed.

The nine required atoms gate the capstone directly — each of its three sketches fails without its rule set, and the noise-traversal mechanics recur in all field work, which is why the two-phase CA update and 2D noise loop are drilled to automaticity. Supporting atoms deepen rather than gate: the random-walk lineage behind DLA, emergence as the unifying idea, organic geometry as the aesthetic frame, plus pointers toward the Nature of Code track and camera-input extensions.

Runnable examples

Generated from the context/ instrument corpus by concept (redistributable idioms only). Do not edit — regenerate with gen-module-examples.mjs.

modulation-warp

osc(4).modulate(src(o0), 0.6).out(o0)

hydra-0022 · CC0-1.0

s0.initP5(); src(s0).modulate(noize(), 0.3).out()

p5live-0038 · CC0-1.0

feedback-trail

osc(4).modulate(src(o0), 0.6).out(o0)

hydra-0022 · CC0-1.0

function draw(){ fill(0, 20); rect(0, 0, width, height); circle(mouseX, mouseY, 40) }

p5live-0003 · CC0-1.0

noise-field

noise(4, 0.1).out()

hydra-0002 · CC0-1.0

float h21(vec2 p){return fract(sin(dot(p,vec2(12.9898,78.233)))*43758.5453);}

glsl-0013 · public-domain

flow-field

let ang = noise(x*0.01, y*0.01) * TWO_PI

p5live-0008 · CC0-1.0

blur-soften

filter(BLUR, 4)

p5live-0073 · CC0-1.0

noise-drift

let x = noise(frameCount*0.002)*width, y = noise(frameCount*0.003)*height

p5live-0007 · CC0-1.0

Atoms in this module

Required — these gate the capstone

Cellular automata generate emergent global patterns from cells that update on local neighbour rules
Concept L2 First instrument HF
Conway's Game of Life produces biological patterns from two simple rules about neighbor count
Principle L3 Craft H
Langton's Ant produces ordered structure from two purely local per-step rules
Concept L3 Craft H
Cellular automata with continuous state values (0–255) produce fluid wave-like patterns
Concept L3 Craft H
Perlin noise mapped to angles at each grid cell creates a smooth flow field that steers particles or arrows organically
Concept L3 Craft H
2D Perlin noise maps x,y coordinates to smooth organic texture fields
Procedure L3 Craft H
A 2D Perlin noise field can displace every point in a regular grid to create organic cloud-like structure
Concept L2 First instrument H
Diffusion-limited aggregation grows organic dendritic clusters by snapping each new particle onto the nearest existing one
Concept L3 Craft H
Circle packing fills a region by growing circles until they touch, then freezing each on collision
Concept L3 Craft H

Supporting — enrichment, not gating

An iterative random walk accumulates small random steps to produce an organic wandering line
Concept L2 First instrument H
The Nature of Code is a 12-chapter, 67-video p5.js track on simulating natural systems in code
Fact L2 First instrument H
Emergence is complex organized behavior arising from many simple local interactions
Concept L3 Craft H
Organic geometry builds natural-looking forms from strictly geometric primitives
Concept L2 First instrument HL
Frame differencing detects motion by comparing pixel values between consecutive video frames
Concept L3 Craft H
Domain-warping noise with noise is the core organic visual move — turbulent, liquid, marbled
Principle L2 First instrument HG