Some explosions from my 3D falling-sand sim / game Falling Cubes, now that I've got pressure somewhat working.
System summary
- Each explosion / shockwave is its own cube type. It uses the 9 shared bits also used as velocity bits to store both the direction it's expanding from and how many expansion steps it has left (effect cubes are static and don't need velocity). Every update it spreads copies of itself into neighboring cubes if they're allowed to be overwritten by the explosion / shockwave effect, or if the force is high enough to completely destroy them.
- Explosion / shockwave effects injects pressure at its starting position and at the expanding positions The amount of pressure depends on the base strength of the explosion and how many expansion steps remain .
- The pressure system compares the pressure in adjacent pressure cells against each cube type's pressure tolerance to determine whether any additional cubes should be crushed.
- Explosions also inject temperature, based on the calculated strength causing various cubes to melt into lava, glass etc in the clips.
Still struggling with cubes ending up doing a bit too much bouncing at the top of the pressure / force gradient so to speak, and the force ending up in a bit to “square” of a shape when reaching the edges of the cube-shaped map.