Game Development Community

Fire

by Alex Illsley · in Torque Game Engine · 05/01/2006 (9:54 am) · 11 replies

How can i make a fire or smoke?? is there any tutorials or anything?
Thanks,
Alex

About the author

Recent Threads

  • Gamepads
  • Commads

  • #1
    05/01/2006 (10:51 am)
    You mean like this...?
    Fire Video 4.38mb

    Sorry, couldn't resist... feeling a little cheeky tonight!

    In all seriousness, the most common way to simulate fire or smoke is with the use of particles. If you own TLK you can even attach lights to enable a flickering effect. Look at the fire which comes with the demo in the stronghold map to get you started.
    #2
    05/01/2006 (11:20 pm)
    Nice video
    #3
    05/02/2006 (11:52 am)
    Lovely fire.
    #4
    05/02/2006 (11:58 am)
    Aint it just, cloth simulation is pretty damn good as well!
    #5
    05/02/2006 (12:29 pm)
    Yes... that flag can move!
    :)
    #6
    05/02/2006 (12:41 pm)
    Lol!

    (Minimum 5 character length has now been met, missed it by 1)

    :)
    #7
    05/03/2006 (8:31 am)
    Any more help?
    #8
    05/03/2006 (9:27 am)
    There's no tutorials on the subject that I know of Alex, it's a pretty easy task. As I mention earlier, look at the fire in the stronghold map, there you will find a basic fire particle as well as a smoke particle. Use these as a base example to get started and build from there, change textures around experiment with values etc until you reach an effect you like. You'll find it in server/scripts/chimneyfire.cs

    Hit F5 to bring up the particle editor, this will allow you to drop particles in and adjust them in real time.

    N.B. For whatever reason it was broken in 1.4. If you haven't already done so implement the fix which is to open creator/editor/particleEditor.cs and change:

    exec("common/editor/ParticleEditor.gui");
    to
    exec("creator/editor/ParticleEditor.gui");

    Here's something to get you going.

    Create a new file, name it fire.cs and place this inside it
    datablock ParticleData(RealFireParticle)
    {
       textureName         = "~/data/shapes/particles/smoke";
       dragCoefficient     = 0.0;
       gravityCoefficient  = -0.075; // rises slowly
       inheritedVelFactor  = 0.00;
       lifetimeMS          = 2000;
       lifetimeVarianceMS  = 0;
       useInvAlpha         = false;
       spinRandomMin       = -90.0;
       spinRandomMax       = 90.0;
    
       colors[0]           = "0.6 0.2 0.0 1.0";
       colors[1]           = "0.6 0.2 0.0 1.0";
       colors[2]           = "0.2 0.0 0.0 0.0";
    
       sizes[0]            = 0.9;
       sizes[1]            = 0.75;
       sizes[2]            = 0.3;
    
       times[0]            = 0.0;
       times[1]            = 0.5;
       times[2]            = 1.0;
    };
    
    datablock ParticleEmitterData(RealFireEmitter)
    {
       ejectionPeriodMS    = 200;
       periodVarianceMS    = 0;
    
       ejectionVelocity    = 0.07;
       velocityVariance    = 0.00;
    
       thetaMin            = 1.0;
       thetaMax            = 100.0;
    
       particles           = "RealFireParticle";
    };

    Execute the file from game.cs in the usual manner ie 'exec("./fire.cs");'

    Now open up your game, hit F11 to bring up editor, hit F4 and select 'Misison Objects', 'Environment' and drop a 'particleEmitter' in your map where you want the fire to be. Make sure you choose 'RealFireNode' for the datablock & 'RealFireEmitter' for the 'particle Data'.
    #9
    05/04/2006 (3:17 am)
    Alex: is the info Tim gave you sufficient?
    #10
    06/03/2006 (6:49 am)
    Sorry i didnt reply sooner, thank you very much the information you gave me was extreamly usefull. I have yet to try out that fire code you gave me but i got the particle editor working. Thanks
    #11
    06/03/2006 (6:50 am)
    Sorry i didnt reply sooner, thank you very much the information you gave me was extreamly usefull. I have yet to try out that fire code you gave me but i got the particle editor working. Thanks