Feature Library

World upheavals: quakes that run out across the ground, faults that tear open, slopes that slump, hollows that sink and water that fills them

1.03 GPU · 0.36 CPU ms
A still of the World upheavals: quakes that run out across the ground, faults that tear open, slopes that slump, hollows that sink and water that fills them demo
Still
The live demo starts when it’s in view.Shake the valley (strength, epicentre), set the fault’s throw, the water and the light; go back to before; drag to turn round the valley

The HaTac engine’s world events and field solvers as one kit, in raw WebGPU.

On the CPU, a timeline on integer ticks moves a height lattice: a seeded, branched fault opens across it (one bank thrown down, the cut heaped on the other, volume kept), domes heave and cavities sink, each structure standing on it is told how far it dropped, tilted and whether the crack ran under it, and the same ticks give the same ground on any machine. On the GPU, the engine’s solvers run in physical order on one set of world fields: a quake whose wave reaches each cell at its distance over the wave speed (sampled the same on the CPU for a camera or a building), stress loaded by the shaking and fading, karst collapsing where stress passes its threshold (with a ledger, so a hollow never sinks twice), slopes relaxing to an angle of repose the stress weakens, and shallow water over the moving ground, with seeps toward a water table and drains at an outlet. The engine’s lava, eruption rasterizer, contact law and CPU scalar field come too. The demo is a river valley with a hamlet: a quake runs out from a ring on the ground, the floor tears open, the slopes slump, three hollows fall in, and the river and the groundwater fill what opened.

What it costs a frame

1.03 ms
0.36 ms
GPU
1.03 ms
CPU, median
0.36 ms
CPU, 95th pct
1.77 ms
Draw calls
0
Weight
Moderate

Measured 28 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 158, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 0.99–1.23, CPU 0.34–0.36 ms). What ran: The module alone: the solver chain on a 256² lattice of 1 m cells (quake, stress, collapse, slope, groundwater and shallow water) with the timeline on fixed ticks, a quake every 14 s (the first opens the fault), drawn as a flat map of its fields. Phones: tiers are being measured next.

How steadily it runs on RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference

Typical frame ?
16.65 ms
1% low ?
55 fps
Varies by ?
±0.40 ms
All metricsRTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference
p50p95p9916.03 ms18.02 ms +
How long each frame took. Most frames sit in the tall bars; a long tail to the right is hitching.

Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.

Frames

Median (p50) ?
16.65 ms
p95 ?
17.48 ms
p99 ?
17.77 ms
Slowest ?
18.77 ms
Mean ?
16.71 ms
Standard deviation ?
0.40 ms
1% low ?
55 fps
0.1% low ?
53 fps
Hitches ?
0 of 600
Over budget ?
0 of 600

Main thread

Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.0 / 0.4 / 0.4 ms

Input

No input during this run.

Memory

JavaScript heap ?
60.2 → 40.5 MB
Growth ?
-19.74 MB

Browser

JavaScript a frame ?
0.55 ms
All tasks a frame ?
1.26 ms
Layout / style ?
0.00 / 0.14 ms
Main thread busy ?
8%

Garbage collection

Collections ?
13 (9 minor, 4 major)
Pauses ?
28.3 ms in all, longest 2.6

What it needs

Renders with
WebGPUNeeds WebGPU: current Chrome and Edge, Safari 26+, Firefox 141+ on Windows.
Your browser
Checking…Looking for WebGPU
Depends on
NothingNo other packages
With an agent
install("world-upheavals")Your coding agent reads its pitfalls and installs it through the library’s MCP server. Set it up

What it’s for

  1. A disaster in a strategy or city game: a quake that opens a fault across the map, tilts and splits the buildings it runs under (each told by how much) and replays exactly from a save
  2. Ground that answers: slopes that slide when shaken, karst or old workings that cave in, a river that pours into the new crack and a lake that floods a sinkhole
  3. A seismic wave to feel: the same analytic motion for the camera’s shake, a structure’s sway and a GPU acceleration field that loads stress
  4. Any coupled field on the ground (heat, pollution, mining stress, mud, lava) on the same sparse solvers, sleeping where nothing changes

Pitfalls, in brief

  1. The demo needs WebGPU: the quake, the stress, the slopes, the collapse and the water are compute passes over storage buffers, and the ground is drawn from them; there is no WebGL path.
  2. Keep the CPU lattice the authority and the GPU fields the picture.
  3. Hand every tick’s edit to the GPU (fields.displace(events.step(tick))) and submit each encode before the next: the edits go up through the queue, so two encodes in one submission would both see the second frame’s edits.
  4. Two solvers that write the same field never sleep.
  5. Expect about fifty compute pipelines: each solver compiles an import pass per field it reads, its stencil, publish and compaction entries, and a NaN scan (field-solvers.ts, create(): the scan compiles whether or not checkFinite is ever called).
11 more in brief
  1. The groundwater pass rewrites depthRate (and depth, with drains), which wakes the whole water field.
  2. Give every sample an angle of repose it already stands at.
  3. The fault’s cut is a V centred on the line and its throw a dip within two widths: give it a width of several cells (the demo’s is 6 m on 1 to 2 m cells), or it publishes crack geometry without moving the ground conservatively (the engine’s README says the same about narrow faults).
  4. A quake solver is made per quake (its event is fixed at creation).
  5. Sample the quake often enough for its frequency (1.4 Hz in the demo’s settings): the host caps a step at 1/20 s.
  6. Use the signed acceleration for shaking and its magnitude for stress (the scalar solver’s accelerationGain does): adding the signed pulse to stress cancels the load.
  7. The water is the flow solver with cold settings (WATER_FLOW: solidus far below its temperature, no cooling), so it never deposits.
  8. Keep the buried-depth ledger when you edit a hollow’s capacity: clearing it lets the same space sink again.
  9. The engine’s settings are for a small site (a 500 m/s wave over 1.5 s, slopes failing at 75% weakening); UPHEAVAL_DEFAULTS are scaled to a valley a few hundred metres across at a metre a cell (a 90 m/s wave you can watch, 7 s of shaking, 30% weakening).
  10. Under reduced motion the camera does not shake and the drawn ground does not move (pass a ripple of 0), the first quake waits for a press instead of starting by itself, and the demo runs the quake and the fault to their end in one go (as the poster does), so the result shows at once.
  11. The lava, eruption and contact parts (createLavaSolver with a yield model, rasterizeEruptions, createLavaContact, createEventLava) come with the module but the demo does not show them; the engine’s eruption adapter (src/core/eruption.ts) is not lifted.
16 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Adapted from published work, named below.

Hannes Andersson: The HaTac engine’s world-events and field-solvers modules and their decisions (built for his game and proven there), the library host and the demo.

Delestre, Lucas, Ksinant, Darboux, Laguerre, Vo, James and Cordier: SWASHES, a library of shallow-water analytic solutions: The Ritter dam-break solution the engine checked its flow solver against (its README, section 4.1.2).

earthquakequakeseismicshakingfaultfracturecrackriftlandslideslopeangle of reposesubsidencesinkholekarstcollapsecavitydometerrain deformationheightfieldshallow waterfloodgroundwaterwater tableriver

Near it in the frame