Destructible terrain (like Worms)

Hi everybody,

Is it possible to create a destructible terrain with Defold? (such as in games like Worms, Gunbound, etc)…

I saw @sicher reply in this topic that it would be possible in a future version (that is probably already out), but I didn’t see anything else about it.

Is there any code example?

1 Like

You could maybe do that now with buffer api to remove areas of textures and then keeping track of the terrain in your script. You would want to not use built in physics or collision detection but do it yourself probably too.

Something like tank wars would be possible to do with this for sure.

For worms style terrain you would probably want to have chunked buffer textures, have the terrain damage mask the looping texture, use the terrain mask for collision detection, and then apply a shader to the terrain to make it look nicer.

Another option is for you to have your destructible terrain style more like Terraria which is tile based.

Check out the buffer example first and see what you can make based on it, then move to other steps. In my mind it’s completely possible but will require some work and experimentation to make.

6 Likes

Thank you @Pkeod. I’ll check it. :grinning: