Worms / Scorched Earth like destructible terrain

Hi Guys,

First of all, hello to everyone :slight_smile:

I’m quite new to gamedev and ue4, but I was wondering, what would be the best approach to make Worms or Scorched Earth like game?
I am specifically talking about terrain destruction.
I got physics, animations and other stuff covered, but I can’t get a grasp on terrain part.

Any ideas?

Preferably using build in ue4 functionality and blueprints.

AFAIK trying to get the terrain to deform is not something that is supported right out of the box. This is going to be something that you will need to implement your self via C++.

This thread may help: Terrain editing in runtime - Feedback & Requests - Epic Developer Community Forums

Fricker talks about some of the things that need to be done when editing the code to achieve this and offers some starting points.

Worms collision was done with a 1-bit mask that we would use a really fast blitting negation sprite routine on. So when you destroy a pixel of land, it basically negates the pixel in the 1-bit collision mask. What that meant was that for longer parts of the explosion (center section) you could use large registers to negate whole sets of the 1-bit mask at once. Essentially a fast sprite routine tore out the collision mask :slight_smile:

For Worms 3D, we had a set of voxel chunks (a bit like a minecraft level, but far smaller and at arbitrary rotations and lots more of them), which could then be destroyed, then the remaining voxels would get reskinned with what was a bit like a softened marching cubes algorithm.

So it really depends if you want to do a 2D (the correct way) or 3D (some weird perversion they made us do for money) world :wink:

Hope that helps.

Thank you for so fast responses!

I should mention that I want that to be in 2d.
I’ve been experimenting with sprites and such but got nowhere yet. I was thinking about a collision mask but I’m not sure if that’s available in this way in UE4.
I’m trying to look into that more.

@Tim, @Sam
Thank you for tips, I’ve seen that thread. Although I am planning to make a simple game and modifying editor source code is not in my scope, yet :smiley:

Small update,

What I’ve done here is to expose RenderGeometry and CollisionGeometry from PaperSprite.h along with RebuildCollionData() and RebuildRenderData() to blueprints.
Then on hit event I can alter those values which will unfortunately modify original sprite but I guess it’s possible to copy sprite on the fly so source sprite will remain unaffected.

I also found out that there’s Paper2d landscape plugin, but I believe it’s very experimental and unfortunately I couldn’t get collision to work :frowning:

Cheers!
Oskar

Thanks for asking this question. I am also trying to make a worms type game, But Very simple. Just 2d and walking around in destructible terrain, I may be able to help you with the collision side of things, if you can help with the terrain side of things :stuck_out_tongue:

PS - Holy Smokes is that one of the Devs from Worms! Hi mate, i would love to have a chat with you sometimes. I loved all the worms games up until 3d…so glad to hear it was a money thing, at least that i can understand if you are answering to someone…

unity had destructible terrain in 2008, get with it :stuck_out_tongue:

But honestly i see why you don’t. You guys do so many things that I find unity doesn’t do.

I think i am just cranky as i want to use blueprints with destructable terrain :stuck_out_tongue:

That’s only doing a 2D deformation though… Not very interesting in my view since no overhangs or tunneling… If you cant tunnel whats the point in terrain deformation!!!

Is there any success on this? I have a same problem on my ue4 project. Want to able to destroy parts of the 2d texture.