Jump to content
• ### What is your GameDev Story?

• Advertisement

# "Fragmenting" a polygon

This topic is 4975 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Looking for some theory here, not nessicarily a hard equation or anything. I've recently switched gears in my programming and have started working on a simple "Scorched Earth"-like game with some friends. (I must say that working in 2D definately has it's advantages! It's been moving very quickly thus far!) In any case, one of the things we want to be able to do is "Fragment" or "Shatter" a chunk of land into several smaller peices. I've puzzled this one over for several days, and I have to admit that I have no idea how to do it convincingly! I guess some technical infromation would be helpful: All of the landscape and/or destructable objects in our engine thus far are defined as "surfaces". A surface is simply an array of points that define the boundries of the polygon (connect the dots! Whee!) Surfaces can be any shape and size, concave or convex. I've got a very nice rendering method in place that can handle any shape you throw at it, so no problems there. ^_^ Visuals Aids! I've also already got a function that can do a boolean intersection between two surfaces, which allows me to "cut" a chunk out of one peice of land and turn it into a new piece. The idea is that when the landscape is shot we create a temporary surface that is a jittered circle, subtract it from the surface that was just hit, and then shatter the smaller chunk that we've just subtracted, so the peices can go flying every which way! Destruction is fun! So... How might one go about shattering a surface in a "realistic" manner? Several thoughts I've had thus far: -Randomly overlay several lines on the surface and divide it up based on that. Simple, and relativly fast, but if you ask me it would look too synthetic. -Scatter a few random points inside the surface and connect them to boundry points, breaking it up into new surfaces from there. I'm not sure how I would determine the connectivity, though (closest points, maybe?) I it seems like this would still look a little fake. -Create several other randomly generated surfaces (again jittered circles) and recursively subtract them from the surface to be shattered. Sounds good, but seems fairly processor intensive, and I need something realtime. Any thoughts?

#### Share this post

##### Share on other sites
Advertisement
A project my friend worked on (Saturn Storm at www.gamecreation.org) had buildings that shattered in what seems like a similar way. I don't remember exactly how it worked, but iirc basically you have the artist define the landscape, and then manually break it apart into a bunch of fragments (just split the polygon up to whatever granularity you want). Give each fragment a health, and when you do damage calculations vs the ground you'd deal damage from each fragment in a certain radius or something. When the health goes below zero, add them to a particle system, give them a velocity (random or based on bullet velocity), and simulate them with gravity, deleting them when they go offscreen or when they fade out.

#### Share this post

##### Share on other sites
I've thought of that, but the problem is I need a fully dynamic solution. All of the fragments are going to be treated as their own surfaces, complete with physics simulations and the ability to be shot and fragment themselves. Not to mention we're trying to work in a "random landscape" generator, so artist created fragments are out of the question. :(

Thanks for the suggestion, though!

#### Share this post

##### Share on other sites
This might give yous ome inspiration. Very impressive results, and they split their algorithm into many parts, so you can just choose the bits you need. Their seciton on creating the cracks in the surace looks very close to what you need.

http://www.burri.to/~jeff/research/pdfs/GI2000_shatter.pdf

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement
• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• ### Popular Now

• 15
• 9
• 11
• 9
• 9
• Advertisement
• ### Forum Statistics

• Total Topics
634134
• Total Posts
3015751
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!