Skip to content
Devlog

Turning rubble eruptions into secondary explosions

A building coming down into a pile of broken concrete and dust

Rubble that jumps, and our call

On October 8, after a building came down and its rubble settled, part of the pile jumped. A burst of pieces flew up out of it with nothing near to throw them, twice in one session.

The usual fix would be to make it stop by breaking the debris into smaller pieces or tuning the physics until piles stay quiet. We kept the eruptions and gave them a reason. If the game could detect one as it happened and set off an explosion at its center, a physics glitch would become a secondary explosion.

Why it happens

Wreckwing’s buildings fall as thousands of separate pieces, each a solid body in the physics engine (Jolt). In a deep pile, pieces get pressed into one another, and the engine pushes overlapping bodies apart. Most of the time it does this gently. Now and then a group of pieces comes apart at once and leaves the pile fast. We have not traced which contacts cause each eruption, and the fix does not need it, since it works from what the pieces do.

What we built

Real buildings have gas lines, and the game already sets some off as a building collapses. An eruption became one more of those.

  • Every other physics step (30 times a second), the engine lists every moving piece of rubble rising faster than 7 m/s.
  • A collapse sends rubble down, and an explosion sends it outward, so most pieces flying up fast have a known cause. A piece counts as explained if an explosion in the last 4 seconds could have thrown it there: within three times the blast’s reach, plus 60 m for each second since it went off.
  • Where 12 or more unexplained pieces are rising inside the same 8 m square, that is an eruption. A gas-line explosion goes off at their middle: a flash, a fireball, dust and the sound of a blast. The same square cannot erupt again for 3 seconds.
  • The explosion is drawn and heard only. It pushes nothing, so the physics plays out exactly as it would have, and a replay of a session still ends in the same state.

Getting it to fire only when it should

The first version counted a piece as explained only within three reaches of a blast, for 2 seconds. Across the test scenes it fired 13 times. Ten of those were plain debris from real explosions: pieces thrown 3 to 4 reaches out and still rising half a second later. Letting the explained distance grow with time since the blast (60 m a second, which is faster than debris flies) left 2 of the 13, and both are real:

  • A deep heap of 2,000 pieces, with no explosion anywhere, throws 25 of them up at once.
  • Inside the pile of a falling 80-story tower, 13 pieces are thrown 12 m up.

Tests check that twenty pieces rising together with no charge near make one eruption at their middle, that a charge nearby explains them, that eight pieces are too few to count, and that a blast’s debris still rising 20 m out half a second later belongs to the blast.

In the game’s development build, ERUPTIONS=0 turns eruptions off and ERUPTIONS=log lists each one.

Provenance

How this post was made

Drafted by
A Claude Code session in the game's repository, October 8, 2026.
What it did
Wrote the eruption detector and its tests, measured it across the test scenes, and drafted this entry for the dev journal.
Reviewed by
Alex van Rossum,

On the roadmap: Trees, fire and smoke

Linear MIP2-660commit bb0ae4d