• Create Account

Banner advertising on our site currently available from just \$5!

Gameplay "big enviromental objects" destruction question

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

#1kilah  Members   -  Reputation: 513

Like
0Likes
Like

Posted 14 July 2010 - 01:43 PM

Hi all,

This is a lack of knowledge question about how to handle in-game assets destruction animation for buildings and similar stuff.

I am completely clueless on how do people handle that. I know that you do not calculate them in real time as it is an expensive calculation and results might not be what you had in mind (ignoring Havok Destruction or Physx APEX). Most games have pre-calculated animations for destruction that they activate on events.

The real question is: Is that a bone animation? or Morph animation? or what is it?

Appreciate any hint on that subject.

P.S: Building destruction on current RTS is what I am looking for.

#2TyrianFin  Members   -  Reputation: 122

Like
0Likes
Like

Posted 14 July 2010 - 02:09 PM

its baked rigidbody physics animation.
So each shatter fragments transform matrix is stored in each time step (like 25steps/s)
and in game its just played from memory with out any collision calculations.

You can think it as a sort of particle explosion, where each particle has mesh attached to it.

And lot`s of smoke and mirrors are added to top of destruction :)

/Tyrian

Ps. shattering of mesh is completely different problem, than animating fragments.

#3spek  Prime Members   -  Reputation: 1033

Like
0Likes
Like

Posted 14 July 2010 - 09:39 PM

There are algorithms that will cut your mesh into pieces completely dynamically at runtime (Newton 2 Physics engine has functions for that), but I guess they are difficult, and the results are... not always that good. It works for rocks and such, but the chunks are less convenient for wood, manmade materials, car-parts, metal and so on.

So unless you want a game where you can break through each and every wall, you may prefer the "pre-defined artist solution". This is how Halflife2 did it for example.

- Define a normal mesh, business as usual. This is what you render normally.
- Make 1 or more "broken" variants. Example, you have a table that can break in 5 ways:
1. something hits on top, the table breaks in two
2/3/4/5 One of the four table legs is hit and breaks off
- These variants can be made of multiple meshes. The broken table for example is simply made of two halfs. Since you are the artist, you can nicely add splinters and apply a "damage" texture on the cracked edges. These kind of details are a lot more difficult when you chose a computized solution.
- Eventually you can break the sub-meshes further if you like.

Now when you hit that table, you can pick one of the available variants. Probably that depends on randomness/force and which part of the collision volume got hit. When it breaks:
- Remove the original model
- Spawn the model(s) from the "broken variant".
- Apply physical force on the meshes to let it explode/fly away or collapse
- And of course, you can add debris/dust/sparks/splinter sprites or gibs
The trick is to place those broken meshes initially at the right position. This can be done quite easily if you define offset-matrices for each mesh.

The most difficult about the whole thing is probably the definition of it. You'll need an editor or something where you can define broken variants and place the submehes onto the right initial positions.

The same thing works for buildings as well, although you probably want to divide the buiding into sub-regions with their own damage variants(roof, chimney, walls, windows ). You can chain them to each other; if you destroy the chimney or roof, it won't affect the lower floors. If you destroy the base floor on the other hand, the entire thing may collapse.

But one question, what kind of game is it? If it's a FPS where you can actually walk through the building it can get a lot more difficult though (changes in collision detection, AI pathfinding and lighting after something was destroyed).

Rick

#4kilah  Members   -  Reputation: 513

Like
0Likes
Like

Posted 15 July 2010 - 12:11 AM

Trully appreciate both replies. If I understood them correctly you guys are offering 2 different solutions:
- Real time physics application on a "predefined broken mesh".
- One pre-calculated physics animation streamed into the game (thus no collisions at all for those fragments).

Both approaches seem interesting and logical to me, will do some test and see what fits better in our current pipeline.

p.s: It's an RTS type. camera never goes below 46º on Y axis(y-Up), and never over 85º either. Also pivot point distance is quite far away.

#5spek  Prime Members   -  Reputation: 1033

Like
0Likes
Like

Posted 15 July 2010 - 01:21 AM

If it's a RTS game, that makes things quite alot easier usually. At least for the destroying buildings that is. I'd say make sub-models which you can use to assemble a building. For example, if you have a barack:
- fundament
- terrain stuff (flag pole, lanterns, benches, fuel barrels, ...)
- internals
- roofing
- walls
- doors / windows

That is quite alot work, but it pays off.

Threat each submodel has a seperate entity (so you can eventually reuse them in other buildings as well). Each with its own collision volume, texture, and damage details. You can also mark your parts as "vital" / "non vital", explosive or with other specific properties. This will allow you to make weak spots on a building, giving the player some tactical options (aim for the pillar with a tank to let the whole building collapse).

Once you have your entities, you can assemble them into 1 big structure, which is basically a collection of entities and the relations between them. When you shoot at the building, you can check which of the entities got hit and then trigger the damage effect for the particular part. Make it explode, start a fire, or let the entity blow up in smaller chunks as described earlier. Plenty of options!

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS