How can I make a prop explode?

Discussion in 'Mapping Questions & Discussion' started by PC's_Frank, May 19, 2014.

  1. PC's_Frank

    PC's_Frank L4: Comfortable Member

    Messages:
    179
    Positive Ratings:
    26
    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.
     
  2. shadowslasher11

    aa shadowslasher11

    Messages:
    392
    Positive Ratings:
    325
    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.
     
    • Thanks Thanks x 1
  3. Zeq

    Zeq L1: Registered

    Messages:
    14
    Positive Ratings:
    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).
     
    • Thanks Thanks x 1
    Last edited: May 19, 2014
  4. sevin

    aa sevin

    Messages:
    959
    Positive Ratings:
    662
    You can also create gibbed pieces of whatever prop you want exploded instead of taking much more time to essentially remodel the prop to make it look exploded.
     
    • Thanks Thanks x 1
  5. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    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)
     
    • Thanks Thanks x 1
  6. yoghurt

    yoghurt L1: Registered

    Messages:
    47
    Positive Ratings:
    39
    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.
     
    • Thanks Thanks x 1
  7. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,219
    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.
     
    • Thanks Thanks x 1
  8. puxorb

    aa puxorb L69: Emoticon

    Messages:
    454
    Positive Ratings:
    638
    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.
     
    • Thanks Thanks x 1
  9. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    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.
     
    • Thanks Thanks x 3
  10. Crash

    aa Crash func_nerd

    Messages:
    3,161
    Positive Ratings:
    4,801
    xzzy's explosion was the shit.

    Yet another reason to get a good video of it!
     
    • Thanks Thanks x 1
  11. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,219
    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.
     
    • Thanks Thanks x 1
  12. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    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.
     
    • Thanks Thanks x 1
  13. PC's_Frank

    PC's_Frank L4: Comfortable Member

    Messages:
    179
    Positive Ratings:
    26
    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.
     
  14. Zanarias

    Zanarias L1: Registered

    Messages:
    5
    Positive Ratings:
    1
    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.
     
  15. Freyja

    aa Freyja ¯\_(ツ)_/¯

    Messages:
    2,851
    Positive Ratings:
    4,851
    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:

    [​IMG]

    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: May 22, 2014
  16. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    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.
     
    • Thanks Thanks x 1
  17. Zanarias

    Zanarias L1: Registered

    Messages:
    5
    Positive Ratings:
    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!
     
  18. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    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.
     
  19. Zanarias

    Zanarias L1: Registered

    Messages:
    5
    Positive Ratings:
    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.
     
  20. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    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.