How can I make a prop explode?

  • If you're asking a question make sure to set the thread type to be a question!

PC's_Frank

L4: Comfortable Member
Aug 29, 2012
178
24
Um, hello. I'm rather new to this site, so I'm not sure if I'm posting this question in the correct area, but, here goes nothing.

For about a year and a half, I've been working on a custom Payload map. It's almost in alpha stage, but since I am now taking graduate level classes, I'm not sure how much time I'll have to complete it.

But, getting back on track, I'm wondering how to make certain props explode depending on which team wins. I want to have a ray gun explode if the BLU team gets its bomb to it (similar to Hightower) and, if the timer runs out and RED wins, a building in the skybox explode (similar to Doomsday). I've been able to teach myself how to do most things in Hammer over the last year and a half, and I attempted to do this again by examining decompiled versions of Hightower and Doomsday to see how Valve did it. But, after downloading these files, Hammer crashes upon trying to open them.

So, I'm asking how I can make a particular prop explode based on which team wins the match, again, I'm sorry if I am posting this question in the wrong area.
 

SSX

aa
Feb 2, 2014
392
411
It mainly has to do with the animations you get with the props that do explode. (Example would be the final part of badwater, or goldrush)

Only thing is, you need to create one in an animation program (3DSMax) if you wish to use a custom one.

Though I'm not 100% sure on this, you can see what others have to say.
 

Zeq

L1: Registered
Dec 30, 2013
14
11
Check out the last part of this tutorial: https://developer.valvesoftware.com/wiki/TF2/Creating_a_Payload_Map. You can pair this with a prop_dynamic that contains an animation of the prop breaking apart, like the barrels flying all over the place in pl_badwater. Creating a custom animation for a prop is a lot of work though, but most of the time you can get away with having a particle effect explosion and simply removing the prop that is supposed to explode and replacing it with a prop that looks like it has exploded. You can trigger two separate events like this depending on which team wins. For example on the OnPass of the final path_track for the payload (blu win), or the OnFinished for the team_round_timer (red win).
 
Last edited:

xzzy

aa
Jan 30, 2010
815
531
Gibs are pretty expensive, cpu wise. Animated props are a heck of a chore to create but they look better and perform better.

(in most cases, there are issues with ragdolls and stickies and engineer buildings when working with dynamic props)
 

yoghurt

L1: Registered
Aug 2, 2013
47
86
You really don't have to make a dynamic model with gibs flying all over the place to make an explosion. You should be able to just use sound effects and particles to achieve and explosion. At least that will take you most of the way.
If i remember correctly there isn't even any gibbing animation in either Hightower or Doomsday.

If you map i still just in alpha stage, just use particles for now.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
We've only ever had one person in our community who was proficient at creating realistic, Payload-style explosions, and he left to go work for a real game company. So the skill is something of a rarity, is what I'm getting at. Don't be disappointed if your map doesn't wind up having one.
 

puxorb

L69: Emoticon
aa
Dec 15, 2013
531
798
The building in doomsday is actually just a func_door_rotating that has its axis set far below it. IT simply "opens" into the ground and is accompanied by a fire/smoke particle.
 

xzzy

aa
Jan 30, 2010
815
531
That's weird, because I made the one for Stoneyridge and I certainly don't have a job in the game industry.

Or are you implying my explosion wasn't the best explosion ever? Because I can't see how that's possible.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Oh right! OK, revising: We've only ever had two people in our community who are proficient at creating explosions. Actually, xzzy, how hard was it to do using Blender? I don't even know how to use Blender (and believe me, I've tried to learn) let alone how to do crazy stuff like that in it.
 

xzzy

aa
Jan 30, 2010
815
531
It was hard only because I'd never done it before, and it wasn't even "hard" in terms of knowledge it was just a lot of trial and error to learn the process and get the workflow going. Now that I've done it once I could probably do again it in a week or two.

The basic idea is simple.. use Crafty to convert your vmf into .obj, import that into blender, build the item you want to explode out of physics objects and position everything in the right spot, press play, tidy up any lose ends, then export into Hammer.

The biggest issue was my CPU.. blender can only do physics simulation in real time and if your computer starts to chug it's going to effect the quality of the animation. I did Stoneyridge on a Core 2 Duo and I had to delete a ton of fragments to get it to work smoothly.

I've used Blender for around 10 years now so I can't comment on how hard it is to learn the tool, as I'm long past that point.
 

PC's_Frank

L4: Comfortable Member
Aug 29, 2012
178
24
Let me just say thank you to everyone for replying, I had not expected so many responses. Also, I am sorry for not replying sooner, I'm still busy with classes. The information provided here seems most useful, so again, thank you very much.
 

Zanarias

L1: Registered
Jun 25, 2012
5
1
It was hard only because I'd never done it before, and it wasn't even "hard" in terms of knowledge it was just a lot of trial and error to learn the process and get the workflow going. Now that I've done it once I could probably do again it in a week or two.

The basic idea is simple.. use Crafty to convert your vmf into .obj, import that into blender, build the item you want to explode out of physics objects and position everything in the right spot, press play, tidy up any lose ends, then export into Hammer.

The biggest issue was my CPU.. blender can only do physics simulation in real time and if your computer starts to chug it's going to effect the quality of the animation. I did Stoneyridge on a Core 2 Duo and I had to delete a ton of fragments to get it to work smoothly.

I've used Blender for around 10 years now so I can't comment on how hard it is to learn the tool, as I'm long past that point.

I'm assuming that at some point you had to tie all of the object's animations in your explosion to bones somehow, unless you have some dark voodoo magic on your hands. How did you accomplish that? It sounds completely tedious, and if you figured out a way to expedite that process I'd be really grateful to know it. That's more or less the point I'm stuck on when trying to recreate "cinematic physics" type stuff, and I really haven't been able to find an answer anywhere.
 

Freyja

aa
Jul 31, 2009
2,994
5,813
Source works fine with pure vertex animation.. I can't comment on the performance of that vertex animation though.

Having said that, I'm pretty sure most physics simulation plugins will probably bake the animation in bones for you automatically, which is probably how source's are done.

Half an hour of messing around with rayfire trial in 3dsmax:

explode2.gif


I couldn't figure out how to export it with bones, not sure if rayfire can even do it, but it's clear that just vertex animation works fine!

If anyone has an actual payload map they want a custom explosion done for send it my way, I want to try it with an actual map and textures but I don't have one of my own.
 
Last edited:

xzzy

aa
Jan 30, 2010
815
531
Yeah, I hacked up the blender SMD exporter to not need a skeleton.. I totally forgot about that until you mentioned it. :O It took me around a month to get the script working properly. The script is here if you ever want to mess with it:

http://xzzy.org/files/games/tf2/vertex_animation_exporter.py

(paste that in a blender text window, edit the "path" variable to point to where you want the file to be saved, select the model you want to export, then run the script. model_name.smd should appear in the path you specified)

I brought up the limitation with the guy who wrote the exporter but I don't think he ever addressed it. He said he'd look at it but that was like 2 years ago.. I got the feeling vertex animation was pretty low on the list of priorities and all the effort was going into character animating.


I guess I could just do up a proper tutorial sometime, I never bothered because I assumed everyone around here was using 3dsmax.
 

Zanarias

L1: Registered
Jun 25, 2012
5
1
I'm really surprised this works in game, I was under the impression that full on vertex animation (excluding flexes) was only functional in DOTA 2 and SFM. Stuff I found suggested that using it on other engine branches would either crash you or just not work. The few tutorials that do exist for cinematic physics suggest that the exporters for other modelling programs end up automatically creating a skeleton for you.

Regardless, thanks a lot for posting your script, Xzzy. It's the first actual solution that I've ever seen for Blender cinematic physics that was actually made public, so I'm happy if it works!
 

xzzy

aa
Jan 30, 2010
815
531
Looking into it more, "vertex animation" isn't the right word for what I'm did. I thought it meant one thing and looking at the developer wiki totally means something else.

Since you made me curious I went and dug out the old smds, and I am in fact using a skeleton, it's just not rigged to one in blender. The exporter makes a single bone at the origin of the prop to establish the reference point, and each fragment in the explosion is its own bone which moves and flies around. They all have the origin bone set as parent so they move properly.

All these files are timestamped from November 2012 so I guess I forgot a lot in the intervening year and a half.

Here's a tgz of one of the animations for Stoneyridge if you want to peruse the results:

http://xzzy.org/files/games/tf2/stoneyridge_anim.tgz

Includes the qc so you should be able to compile it.
 

Zanarias

L1: Registered
Jun 25, 2012
5
1
Thank you for all of your help and information so far.

Is your script only built to generate the armature for the selected group of objects? I was assuming that whatever active actions were baked into the object would be passed onto the bone created on the object. Or are you taking other steps after the armature's been created?

I apologize if these are silly questions. I know enough about Blender to accomplish some things, but my knowledge is very very very far from complete. Ultimately if this is all too unwieldy I have another method that works that I'll have to create a script for.
 

xzzy

aa
Jan 30, 2010
815
531
It exports a single Blender object. I only tried creating a single action per object, I'm not sure what'll happen if you have more than that. Since the exporter just advances the frame counter to get the next step I assume only the current action gets exported.

And yeah it only exports the object you have selected in Blender but if you want to export multiples it's easy to select something else and re-export (the smd files are named based on the name of the object). The "official" SMD exporter handles entire scenes with a single click, and maybe it works better now than it did last time I tried it so perhaps you can look there.