Game Development Community

dev|Pro Game Development Curriculum

Kaboom! Images of destruction.

by Michael Hall · 11/28/2008 (2:39 am) · 2 comments

Kaboom! Destroyable Objects Pack is now available at GarageGames, see the Product Page.

i167.photobucket.com/albums/u143/heretek/torque/kaboompack.png
Several months ago I had a conversation with Apparatus about how to destroy or break and blow things up in Torque. Now this was something that I was extremely interested in doing. I felt that having damageable props and other destroyable objects in a game would contribute to better immersion and interaction with a game environment. I've been asked a few times about how this pack works and what went into making it. I've never offered a blog here either. So to celebrate that the awesome folks at GarageGames now offer something in their store that I helped create why not blog about it.

Our first idea was a simple wall. What was unique about this wall was that it had 3 animation states that could be triggered in script. It was a simple matter to control these animation states by setting them when the wall reached a certain level of damage: healthy, damaged, wrecked. Once it was destroyed or reached the maximum damage level then it was time for an explosion effect with debris, and possibly rubble, and the removal of the wall.
i167.photobucket.com/albums/u143/heretek/torque/expWall.gif

So we had a damageable object that had debris effects and was removed once it was destroyed. But that was only the beginning, it was time to refine and improve the damage control scripts, Apparatus wanted the code to be simpler to understand and more of a template on how to do things. And of course we wanted to add even more features. One such feature was unique onDamage impact/hit effects with visuals and sounds. We wanted some objects to be completely destroyed and others to leave behind wreckage. You hit a metal barrel and you will see sparks and hear the appropriate sound. Shoot a tree, a wooden crate or a piece of furniture and little splinters of wood will fly off. To test the new hit effects I ended up disabling the crossbow explosion - I thought that was silly anyway. Being able to see wood chips, stone fragments, sparks, or even blood when you shoot something adds to the overall experience in my opinion. To make up for taking away the big bang for the crossbow we added some nice new crossbow bolt projectile decals and the bolt itself now bounces back once it hits something - a neat effect - but in the future I would like to have the bolt actually stick into something.

All objects also hurl the appropriate chunk(s) of debris.
i167.photobucket.com/albums/u143/heretek/torque/kaboom4.jpg

This was three whole intact pieces of pottery, I've damaged them in order to show how using differing shapes indicates the "breakable-ness" of some objects. The screenshot missed missed capturing the debris.
i167.photobucket.com/albums/u143/heretek/torque/screenshot_001-00006.png

Apparatus can spit out a large volume of work real quickly once he gets going - I had a hard time keeping up with just creating datablocks for the new objects that he would send me.
i167.photobucket.com/albums/u143/heretek/torque/ItemBrKaboom2.png
It was about this time that my old development computer went kaboom - literally! Now I had a rather robust collection of damage control methods that could handle animated shapes, mesh-hiding, or simply swapping out models at the appropriate time. But it was extremely convoluted and had too much replication of code and even some extras that didn't actually do anything. There was a two week hiatus before I was able to get back to work on it and in my opinion my old computer going bust was a good thing for this pack. Once I was able to get back into production Apparatus kept pushing for simplicity and ease of use and he wanted it all done in script. So I dug a little more into the existing damage handling methods already available in Torque and starting hooking my damage control code into it. Thankfully Torque already has a nice damage tracking/handling system that is largely left unused, so with a little bit of creative thinking destroyable objects are more than possible using nothing but scripts. In fact it only takes one master script to control them all, well...maybe two. Everything is all handled by a new staticshape script file and by adjusting fields in an object's datablock. It was fun to do the same for the rigidshape class but we opted to leave that as an unsupported and experimental feature until certain improvements and fixes could be made.

I tossed in an idea to create a few wall props that could be used to build a simple structure and we soon had a wood and plaster shack, a metal walled warehouse, and a glass greenhouse - all of which could be broken, smashed, and destroyed. But wait we wanted even more. If you destroy or blow up a fuel tank/fuel barrel shouldn't it leave fire and smoke billowing up into the sky? I really wanted to be able to have a spreading fire and proximity damage to a fire - wouldn't it be fun to see a flaming orc running around - but time constraints put a stop to that. We had already exceeded our design plan but I did get the wreckage fire and smoke in there.

Did I mention the trees? Well, the trees don't explode, but limbs will break off and leaves will scatter on the wind if you shoot one enough times.
i167.photobucket.com/albums/u143/heretek/torque/kaboomtree.jpg

The initial release a couple months back was for TGE only, but it took just about 10 minutes to port it over to a TGEa Stronghold codebase. There are no definite plans as of yet but there may (will probably) be a more advanced followup sometime down the road - I'm already compiling ideas and if anyone has any suggestions or possible means of improvement feel free to let me know.

Goodbye train depot ;)
i167.photobucket.com/albums/u143/heretek/torque/screenshot_001-00076.png

About the author

Been dabbling with game-programming since the age of 10 when I got my first computer, a Commodore. Got serious about game-development after modding Tribes for several years. Doesn't sleep much. Drinks rum. Teaches guitar. Plays cello.


#1
11/28/2008 (6:19 am)
This is an awesome pack. Well worth the small investment.
Thanks guys.

Edit to add:
I love the way you commented everything you did. Lots of great comments in there, especially server/scripts/game.cs
Awesome job. I'm learning a lot. :-)
#2
11/29/2008 (8:43 am)
Thanks Mike. I might have gotten a little carried away with the comments ;) I'm glad to hear you are getting a lot out of it. That was one of our main goals that people could use the pack and be able to learn from it.