Holiday 2012. I was sitting on my coach with my laptop warming my legs, playing around with a very early version of Megaton Rainfall (although it wasn’t named at that time). On screen I had a simulation of buildings collapsing depending on where you shoot them. It was looking fantastic. I remember thinking “Oh my god, this is cool,” and I decided I would finish this game until the end (which involved quitting my job).



Like everyone else, I like Hollywood blockbusters with a lot of explosions. And there’s one thing explosions in films do well and games don’t.

Most explosions you see in games are not procedural, and do the following. Let’s say a house receives a hit from a RPG and explodes. At the time of the explosion, they replace the “house” mesh by a “wrecked house”, and at the same time they add a particle effect (fire, smoke and debris). The problem is discontinuity. You notice the cut, an abrupt change in the first frame of the explosion, so you don’t feel the house is what exploded. Besides, the “wrecked house” doesn’t have a hole in the exact location of the RPG (because it was modelled by an artist who didn’t know where it would come from).

A solution could be to have a “chopped house” in memory, partitioned in a myriad pieces, and on exploding switch to that mesh and start moving only the pieces near the center of the explosion, but… What if the designer is a nonconformist and wants massive explosions of massive skyscrapers in massive cities 200 square miles in size? That would exhaust memory in one fell swoop.

So here are the two “bright” ideas that make all of this possible procedurally in Megaton Rainfall.

(By the way, I wish I could send this blog to myself back in time — it would have saved me a lot of failed experiments).



First idea: at the time of the explosion, the engine takes a snapshot of the house just as it’s seen from the camera. Yes, a snapshot. A bitmap. Next it generates a particle effect that fills the space of the exploded zone, and apply the snapshot to the particles as a texture, so that from the camera, the first frame of the explosion is seen exactly the same. Continuity achieved! You can follow every detail with your eyes during the explosion until they disperse. Besides the particles are GPU-accelerated 2D billboards. The PS4 can handle bazillions easily. The feeling is phenomenal and no other game handles the explosions this way as far as I know.



Second idea: given a building and the position of an explosion, how do we generate the wrecked version of the building, including thick inner walls? The trick is to keep a “paper” version of the building (with walls with no thickness), that the player doesn’t see, and an “inflated version” with thick walls that’s displayed on screen. The engine has the feature to “inflate walls” of a “paper” mesh very fast. When a new explosion takes place, we discard the inflated version, we remove the triangles of the “paper” mesh near the explosion (updating the paper version), and we regenerate the inflated version based on the paper version.



Then we add fire, smoke, sparks, expansive wave, unfortunate people and furniture, and voilà. Procedural explosion ready to serve. There are plenty of other types of explosions in the game, but this post might have a word limit. But the gifs are not limited, so here’s another one:

