Advertisement

How to make destructible asteroids?

Started by March 21, 2018 01:45 AM
8 comments, last by Scouting Ninja 6 years, 8 months ago

I'm trying to make a mining mechanic for a 2D space game. I guess the most obvious way would be 2D voxels tiles, but I was aiming for something simpler, that could blow chunks off of the asteroids by shooting at them, or something like that.

I'm looking for suggestions on how this could be achieved.

I created a pointer of type Toilet so I don't have to go to the bathroom as often.

1 hour ago, Master thief said:

2D voxels

You mean pixels? Pixels are pretty damn simple :)

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Advertisement
1 hour ago, swiftcoder said:

You mean pixels? Pixels are pretty damn simple :)

I meant tiles, like Terraria. Not exactly voxels, yea, :) but similar. I meant that kind of approach.

I created a pointer of type Toilet so I don't have to go to the bathroom as often.

Particle system, if you use an engine that supports that it would be the easiest way, spawn it at the point of impact and make it non looping, that is how i would approach this.

You could also simply render an asteroid as a collection of pieces of an asteroid clumped together and simply separate one or more from the pack when appropriate.

Most games with destructible environments do a similar thing. They have predetermined shapes that larger objects are reduced to when destroyed, although usually they are made up of only one mesh beforehand. If you want to get into dynamic mesh fracturing, that gets a little more complicated. You'd need some method for dynamically separating the mesh, and joining vertices of the resulting meshes together to form multiple complete shapes.

At the moment of destruction, replace the single asteroid by 2 or more (smaller) asteroids, each with their own direction.

Advertisement

Thank you all for the suggestions.

I've been thinking about this, and I'm reconsidering using tiles after all, along with particles. I'm thinking I can probably achieve some significant level of "organicness" with tiles, and particles should make it all look richer as well.

 

I created a pointer of type Toilet so I don't have to go to the bathroom as often.

Another solution can be modify the asteroid image pixels with and eliminate them one by one according to a function that uses some random parameters. But if you're looking for something simplier, don't mind me :), i was just looking for you to do something realistic if you need it.

Good luck!

On 3/22/2018 at 10:31 PM, Master thief said:

I've been thinking about this, and I'm reconsidering using tiles after all, along with particles.

If it was me I would use some kind of shader for this.

Because a texture is very similar to an array, you could use the alpha channel to map what is visible and what not. So when it takes a hit you add more alpha to it, take the difference between the last texture and new texture and use that to make a new asteroid.

This topic is closed to new replies.

Advertisement