How procedurally destructable cities work in PS VR superhero sim Megaton Rainfall, out today

14 0
How procedurally destructable cities work in PS VR superhero sim Megaton Rainfall, out today

Find out more about the tech inside Pentadimensional Games' earth-shattering action epic

Holiday 2012. I was seating on my couch 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 (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 an 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 only moving 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 squared miles in size? That would exhaust memory in one fell swoop.

So here are the two ‘bright’ ideas that make all of this procedural destruction possible in Megaton Rainfall (and at 60 fps and with stereo rendering/VR).

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

Idea 1: A snapshot of the building pre-explosion

First idea: at the time of the explosion, the engine takes a snapshot of the house 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 area, and applies the snapshot to the particles as a texture. That means from the camera’s perspective, the first frame of the explosion seems exactly the same. Continuity achieved! You can follow every detail with your eyes during the explosion until it finishes. Besides, the particles are GPU-accelerated 2D billboards. The PS4 can handle bazillions easily. The feeling is phenomenal and no other game handles explosions this way AFAIK.

Idea 2: Have two versions of each building and switch between them quickly

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, an expanding wave, unfortunate people caught in the explosion and furniture, and voila: a serving of procedural explosion. (However, you only see fire at night. That was an artistic decision. As for people caught in the explosion? You can only see them from a distance: I wanted to avoid a PEGI 18+.)

There are plenty of other types of explosions in the game, but this post has a word limit. But the gifs are not limited so here’s one more to sign off!

Join the Conversation

Add a Comment

But don't be a jerk!

Please be kind, considerate, and constructive. For other topics, head to our Forums. Report inappropriate comments to


  • This is really cool, I love reading about clever implementation tricks like this! Thanks!

  • Already bought, even though I’m without PSVR at the moment, because this looks amazing and Pentadimensional Games deserves some great support, for making such an awesome game.

    Hey Sony how about that updated PSVR headset for Europe, are we going to get some info or are you waiting for Paris Games Week to announce more? :)

  • This looks neat. Shame I can’t justify the expense of PSVR due to how ill VR makes me anyways (not just from the visuals but from really having an adversion to wearing concealing headgear) cos this looks like the something I’d quite enjoy. Have fun, folks. :)

  • I hope Sony starts setting higher standards for the games they license. In the long run this cheap quantity over quality approach will hurt vr more than it does good. This game is bad, even for 13 euro.

  • Super cool tech and nicely detailed explanation of it. The bitmap replacement is something I never would have thought of!

  • Amazing! I can’t wrap my head around it that a single guy made a PSVR game this technically impressive and equally fun to play! And as a bonus it is available for a verry low launch price!!! Best VR experience so far. Big company’s can learn from your gameplay/technical design for VR. Can’t wait for your next project

  • Incredible game and interesting to know more about how it all works.

    Been waiting for this and tried to not get my hopes up because of the low price and lack of footage, but it really is good with and without VR.

  • Sell this tech to the Sandlot guys for their EDF games :), it’d make them even better.

Leave a Reply

Please enter your date of birth.