Summer of Code: Detonator Framework Released!

September 17, 2009 in Community, Events

This blog post is written by Ben Throop who has been working on a Detonator framework to generate great-looking explosions in Unity games. The project was one of the four selected projects that were selected for the Unity Summer of Code and the first to be wrapped up and released.

Detonator Logo

Explosions are a really common element in games, but they can be difficult to create. Starting from scratch can be time consuming and requires expertise with particle systems, lighting, texturing, and animation. Tweaking existing effects to fit a game can also be a challenge because its difficult to change the size or color of a set of particle emitters in unison. Making explosions should be fun, fast, and rewarding instead. That’s why Detonator was created.

 

httpvhd://www.youtube.com/watch?v=wh-vctBPRxc 


Detonator for Unity makes incorporating good explosions easier for all types of developers. At its most basic level, Detonator is a component that can be attached to any GameObject. At runtime it then creates an explosion with configurable color, size, duration, detail, and sub-elements like sparks, smoke, and shockwaves. For those that want to dig in a bit, Detonator is an explosion framework. Customize each sub-component or create new ones if you want to write a bit of code. Tweak detail levels with a single parameter and save your favorites to prefabs… or dynamically link color to damage type and size to damage amount!

Test out the explosions generated with Detonator for yourself below. Click to start the webplayer:

[WP_UnityObject altimage="http://blogs.unity3d.com/wp-content/uploads/2009/09/Detonator_Webplayer_Alt_Image.png" src="http://blogs.unity3d.com/wp-content/uploads/2009/09/Detonator.unity3d" width="640" height="360" css="http://unity3d.com/u3d.css" /]

If you’re doing explosions in your Unity game, Detonator can probably help you create good looking, scalable effects in less time!

Get the Detonator Parametric Explosion Framework from our Resources section and populate your own game with spectacular explosions. If you’d like to follow the continued development, check out Ben’s site at http://variancetheory.com.

Comments (32)

Subscribe to comments
  1. Barak

    March 2, 2011 at 5:50 am / 

    Disregard the last comment, for some reason it wasn’t posted correctly, I’ll try again:
    There’s a bug when one calls Explode() instead of using explode on start. If you play for a long time (more than 1000 seconds), there is a code in Update which deletes the detonator after that time. The code:

    private float _lastExplosionTime = 1000f;
    void Update ()
    {
    if (destroyTime > 0f)
    {
    if (_lastExplosionTime + destroyTime 0)
    {
    Invoke(“KillDetonator”, destroyTime);
    }
    }

    void KillDetonator()
    {
    Destroy(gameObject);
    }

  2. Barak

    March 2, 2011 at 5:44 am / 

    There’s a bug when one calls Explode() instead of using explode on start. If you play for a long time (more than 1000 seconds), there is a code in Update which deletes the detonator after that time. The code:

    private float _lastExplosionTime = 1000f;
    void Update ()
    {
    if (destroyTime > 0f)
    {
    if (_lastExplosionTime + destroyTime 0)
    {
    Invoke(“KillDetonator”, destroyTime);
    }
    }

    void KillDetonator()
    {
    Destroy(gameObject);
    }

  3. cpt.ahab

    November 14, 2010 at 9:27 am / 

    same failure here!
    Assets/Detonator/System/Detonator.cs(48,29): error CS0106: The modifier `virtual’ is not valid for this item

  4. Willy

    October 24, 2010 at 10:14 pm / 

    ITS not work on my unity I got this message: Assets/Detonator/System/Detonator.cs(48,29): error CS0106: The modifier `virtual’ is not valid for this item. Wats wrong????

  5. Jarod

    April 30, 2010 at 10:23 pm / 

    I would like to know how to make the explosions look like that. My detonator explsions all look really fake and are seperated in squares and stufF. if you could send my the instructions for each detonator explosion that would be great!

  6. Justin

    April 14, 2010 at 6:27 pm / 

    where is the documentation as to how to use this? I have seen the Unity3d file on your website but no clue as to how to use this.

  7. Raymond L.

    October 17, 2009 at 1:47 pm / 

    I think they are doing it but they are going to but all the others in the new Unity, instead of a package. So that may take some time. They are also probably slacking off a little now because the deadline is out there and they just have to stick it in the new Unity, which won’t becoming for a couple of months. *-)

  8. Brendang

    October 15, 2009 at 8:20 pm / 

    What happened to the projects selected for Summer of Code? Actually I thought I asked this 2 weeks ago here. Somehow my post seemed to vanish… Curious.

  9. Raymond L.

    October 3, 2009 at 4:58 pm / 

    Whoa. It works! Now if i can just get a good explosion…

  10. Ashkan

    September 27, 2009 at 8:12 pm / 

    hi ben
    you did a really nice job

  11. Ben Throop

    September 24, 2009 at 3:38 pm / 

    http://unity3d.com/support/resources/unity-extensions/explosion-framework

    Now has v1.02 with all Indie issues resolved. Feel free to post here if you find any others.

  12. Ben Throop

    September 21, 2009 at 3:27 pm / 

    It was not designed for iPhone and I haven’t tried it myself. Way too many draw calls to be usable most of the time, but it’s possible that the Detonator-Simple prefab might work alright since it’s only one texture for all pieces.

    To make it iPhone friendly in the future, I want to add a feature to Detonator where it will render its explosion to an animated texture in some kind of wizard or editor. If anyone wants to help with that, drop me a line.

  13. Kev

    September 20, 2009 at 9:16 pm / 

    Doesnt work….

  14. Doug Smith

    September 19, 2009 at 7:29 pm / 

    Phenomenal work!
    I especially enjoy the MushroomCloud.
    Thanks for all your hard work.
    We won’t even need to change out our character placeholders, with explosions like that, who cares.

  15. Benoit FOULETIER

    September 18, 2009 at 6:25 pm / 

    +1: does it work on iPhone? (no generics)
    If yes, how fast is it? If not, do you think it’s realistic to port it? (in terms of performance)
    Kudos btw, looks awesome!

  16. Raymond L.

    September 18, 2009 at 1:03 pm / 

    Please tell us when you’ll repost that package! I’m anxious to us your explosions in my game! :-)

  17. Daniel Hughes

    September 18, 2009 at 12:04 pm / 

    I would live to play with this if only it worked on linux…..

  18. Chuck B

    September 18, 2009 at 7:58 am / 

    Looks cool. Will it work in Unity IPhone?

  19. Ben Throop

    September 18, 2009 at 4:02 am / 

    OK thanks to all for the bug reports and apologies for difficulties with Unity Indie… I’ll get it worked out and we’ll repost a package with fixes.

  20. Raymond L.

    September 17, 2009 at 9:44 pm / 

    DetonatorSound.Update () (at Assets/Detonator/System/DetonatorSound.cs:27)
    That is what’s stopping my console.

  21. Raymond L.

    September 17, 2009 at 9:41 pm / 

    My first test worked, but with all the other projects I added the package to, it wouldn’t work! Even in the test scene! I click, and there isn’t an explosion. And when I create my own, the same thing happens!!!

  22. mongol

    September 17, 2009 at 9:39 pm / 

    Really nice stuff, at least in your video :(
    I am sure it will get fixed, and then it will bring endless and mindless joy to all the explosion fanatics out there.

    It crashes on my Unity 2.5 Indie on Windows.
    The scene loads and there are few errors, 2 related to the shader you mentioned, and the rest to some deprecated function calls.
    Everything then crashes after I click in the scene.

    — at lines 47, 48, 57, 65 ———————————————–
    Assets/Textures/Standard Assets/Camera Scripts/MouseLook.cs(47,61): warning CS0618: `UnityEngine.Quaternion.AxisAngle(UnityEngine.Vector3, float)’ is obsolete: `Use Quaternion.AngleAxis instead. This function was deprecated because it uses radians instad of degrees’

    — at line 33 ———————————————–
    Assets/Textures/Standard Assets/Camera Scripts/MouseOrbit.js(33,35): BCW0012: WARNING: ‘UnityEngine.Quaternion.EulerAngles(float, float, float)’ is obsolete. Use Quaternion.Euler instead. This function was deprecated because it uses radians instad of degrees

    — at line 47 ———————————————–
    Assets/Textures/Standard Assets/Camera Scripts/SmoothFollow.js(47,38): BCW0012: WARNING: ‘UnityEngine.Quaternion.EulerAngles(float, float, float)’ is obsolete. Use Quaternion.Euler instead. This function was deprecated because it uses radians instad of degrees

  23. Vasco C,

    September 17, 2009 at 8:56 pm / 

    Fantastic work!

    I really appreciate that this works great with Indie too – as long as you remember to get rid of the heatwave in import :)

    Thanks!

  24. Ben Throop

    September 17, 2009 at 5:03 pm / 

    Yeah if anyone has issues and needs immediate attention, hit me up on Twitter… @benimaru

  25. Phil Thorn

    September 17, 2009 at 4:44 pm / 

    Works on Unity Pro Mac here. Nice job Ben!

  26. Ben Throop

    September 17, 2009 at 4:43 pm / 

    @MikeS – Yep, does work on Mac (I also tested on a Macbook). However, the default explosion in the test scene Detonator-Insanity creates a Heatwave which uses a shader that I believe is Unity Pro only. That might be what’s doing that. The Heatwave is the only thing that is Pro only… everything else should work with Indie.

    If you create a Detonator from scratch it won’t use the heatwave, and I’d guess that the NullRef asserts won’t show up.

  27. Mike S.

    September 17, 2009 at 3:56 pm / 

    Should this work on the Mac? When I try to play the test scene, I get a series of NullReferenceExceptions for any explosions I try to make? I’m on the latest rev of Unity Indie.

  28. Ben Throop

    September 17, 2009 at 3:36 pm / 

    @Chaos – Detonator was actually developed on Windows so it works on at least 1 machine. :)

    What are your system specs and Unity version?

  29. Raymond L.

    September 17, 2009 at 3:24 pm / 

    Oops! Fixed the problem.

  30. Raymond L.

    September 17, 2009 at 3:23 pm / 

    Drat! There is some sort of error with the package, it won’t download into my project!!!! :-(
    Please fix this!!!!

  31. Chaos

    September 17, 2009 at 3:19 pm / 

    The sample scene does not work when built, and crashes unity when i try to run it. I’m on Windows

  32. Martin Schultz

    September 17, 2009 at 2:29 pm / 

    Congrats, awesome stuff Ben!!!

Comments are closed.