Game Development Community

Many big explosions and the lack of performance

by Alexander Bierbrauer · in Torque Game Engine · 08/19/2004 (9:27 pm) · 30 replies

Hi there,

I'm on coding a small bomberman clone for learning the torque engine. While working on this, I've run into a performance problem:

When a player drops a bomb, it will explode after X seconds. While exploding the bomb creates X additional explosions in x+,x-,y+,y- (bomberman explosions are exploding like a cross) direction... so... there could be up to 20 explosions for just one bomb.

These kind of explosions are reaching the boundaries of torque ! I should also notice that I'm using the "god view" camera of the advanced camera resource. So, the whole gaming area is always shown.

I'm thinking now about other solutions for creating such explosions. Should I use billboarded sprites or should I switch from Torque 1.2.2 to HEAD (any performance increases??). Anyone has some nice ideas ??


regards, alex
Page «Previous 1 2
#1
08/20/2004 (9:24 am)
I also have quite a few particle emitters in my game and did notice some perfomance issues. One thing that I did notice that helps is lowing down the amount of particles that are emitted from each emitter. Maybe make the particles themselves bigger and more opaque to compensate for it.
#2
08/20/2004 (2:23 pm)
I agree with Chris, we needed to do this for Lore since we introduced our Air Strike weapon because the number of particles that we were previously firing off with our artillery explosion was too much.

Try using between 10 and 25 particles at most for your explosions and make them larger like Chris suggested.
#3
08/20/2004 (3:36 pm)
What would be nice is for someone to post a DTS explosion resource. I've set off well over a hundred DTS explosions at once with just a small lag in performance.

IMO they are much smoother than the particle emitters and look much better. The emmitters should be used for effects that are best suited for them.
#4
08/20/2004 (3:41 pm)
I kinda agree with Gonzo. In Tribes II they used some kind of sprites explosion, if that's what you mean. That's a DTS (probably) that's just flat with a animated texture and transparancy.

Namely the Spinfustor (dunno if that's the correct name) used this, and it looked very cool!

Gonzo, why can't you post your DTS solution?
#5
08/20/2004 (3:46 pm)
Yeah we have several nice dts explosions made by Matt Mitman at Game Beavers...
Feel free to join up and use them in your game.

You can download beaver patrol Alpha 1.3 and find them in there.
#6
08/20/2004 (3:50 pm)
www.gamebeavers.org/modules/gallery/albums/album22/screenshot_003_00037.sized.jpgwww.gamebeavers.org/modules/gallery/albums/album22/screenshot_003_00039.sized.jpg
The above two images are pure DTS and have little or no effect on frame rate. The dts is covered by a skin of png files that have a realistic looking explosions on them. It grows and collapses nicely.
#7
08/20/2004 (3:52 pm)
We have since changed the explosion abit to add in a new DTS file... but the one shown above is the disc.dts in the explosions dir
#8
08/20/2004 (3:53 pm)
By the way the DTS file is an animated max file exported to TGE. Because TGE has good support for 3d mesh animations it works nicely.
#9
08/21/2004 (4:49 am)
Another trick on explosion density and still maintain visual quality is to dynamicly change the particle count as a function of the quantity of live emitters. 20 bombs overlapped would take much less particles to show virtually the same effect as many of the particles are in front or behind the others. You force lots of calculation for particles that are behind others and if the view is close to the explosions you might suffer from overscan limitations on the vid card. Or the engine might me in a depth sorting panic. Just my $.02
#10
08/21/2004 (5:39 am)
Quote:Gonzo, why can't you post your DTS solution?


Because I was using the Tribes2 spinfusor explosion for testing, lol. I would give anything to know the how they did those explosions. I figured somebody smarter than me with more experience is 3DS Max might be able to post a resource. Believe me, if I knew how to make them, you would already know as well.
#11
08/21/2004 (6:14 am)
@Howard: There is a resource that does just that, limiting close-up explosions and cut them down, maybe one could modify it to suit their needs.

@Gonzo T. Clown: Yeah! I've been digging in Tribes II as well and there are some really nice effects that would be really cool to have in TGE, namely the muzzle flashes, explosions, damage skins and some of the vehicle creation effects ;) at least those are what I like but I guess it's not allowed to use the scripts from there. That would make sense though as it's a shipped game.
#12
08/21/2004 (8:05 am)
Can anyone tell me how the dts explosions are made? I assume its just an animation, do I have to give the animation a specific name? I'm willing to make one and make a resource out of it, if someone can tell me how its done (animation name etc)
#13
08/21/2004 (9:28 am)
Yep its just an animation name that gets called automatically. All you have to specify is the dts file name and play speed. I believe it will use the first animation it finds, if you dont use the default... "animate" I beleive.

//GRENADE  -------------------------------------
datablock ExplosionData(grenadeExplosion)
{

   [b]explosionShape = "~/data/shapes/weapons/explosions/disc_exp.dts";[/b]
   [b]playSpeed = 1.0;[/b]
   Scale = "1 1 1";

   lifeTimeMS = 1500;

   faceViewer     = true;

   shakeCamera = true;
   camShakeFreq = "10.0 11.0 10.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 0.5;
   camShakeRadius = 20.0;

   // Dynamic light
   lightStartRadius = 6;
   lightEndRadius = 3;
   lightStartColor = "0.5 0.5 0";
  lightEndColor = "0 0 0";
};

//grenade! -----------------------------------------
datablock ProjectileData(grenadeProjectile)
{
   projectileShapeName = "~/data/shapes/weapons/explosions/debris.dts";

   directDamage        = 60;
   radiusDamage        = 20;
   damageRadius        = 10;
   areaImpulse         = 1880;
   explosion           = grenadeExplosion;
   muzzleVelocity      = 2;
   velInheritFactor    = 0.3;
   particleEmitter     = streamerEmitter;
   armingDelay         = 0;
   lifetime            = 1500;
   fadeDelay           = 1500;
   bounceElasticity    = 0;
   bounceFriction      = 0;
   isBallistic         = true;
   gravityMod = 1;
};

function grenadeProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
   alxPlay("BigExplosionSound",%pos); //play rifle fire sound

   // Apply damage to the object all shape base objects
   if (%col.getType() & $TypeMasks::ShapeBaseObjectType)
      %col.damage(%obj,%pos,%this.directDamage,"Grenade");

   // Radius damage is a support scripts defined in radiusDamage.cs
   // Push the contact point away from the contact surface slightly
   // along the contact normal to derive the explosion center. -dbs
   radiusDamage
     (%obj, VectorAdd(%pos, VectorScale(%normal, 0.01)),
      %this.damageRadius,%this.radiusDamage,"Radius", %this.areaImpulse);
}


function grenadeLauncherImage::onFire(%this, %obj, %slot)
{
   %projectile = %this.projectile;

   // Decrement inventory ammo. The image's ammo state is update
   // automatically by the ammo inventory hooks.
   %obj.decInventory(%this.ammo,1);

   //%currentAmmo = %obj.getInventory(%this.ammo);
   //%obj.client.setAmmoAmountHud(%currentAmmo);

   // Determin initial projectile velocity based on the 
   // gun's muzzle point and the object's current velocity
   %muzzleVector = %obj.getMuzzleVector(%slot);
   %objectVelocity = %obj.getVelocity();
   %muzzleVelocity = VectorAdd(
      VectorScale(%muzzleVector, %projectile.muzzleVelocity),
      VectorScale(%objectVelocity, %projectile.velInheritFactor));

   // Create the projectile object
   %p = new (%this.projectileType)() {
      dataBlock        = %projectile;
      initialVelocity  = %muzzleVelocity;
      initialPosition  = %obj.getMuzzlePoint(%slot);
      sourceObject     = %obj;
      sourceSlot       = %slot;
      client           = %obj.client;
   };
   MissionCleanup.add(%p);
   return %p;
}

I believe the name is "animate" Matt Mitman made it. He could tell you easily.
#14
08/22/2004 (5:05 am)
I'm giving up... billboard works fine, but somehow only the first frame of my IFL animation plays... Why can't you just show us the source file?
#15
08/22/2004 (5:17 am)
I noticed this in the engine
// Resolve animations
explosionAnimation = explosionShape->findSequence("ambient");
Sounds like maybe that the animation has to be called ambient? Not sure, just seein wot i can do here.. ;)
#16
08/22/2004 (5:19 am)
Yeah, I tought it would be ambient, so I called it ambient. That is not the problem.
#17
08/22/2004 (6:27 am)
Ward, if your interested, mail me your .max file and I'll see if I can help you iron this out.
#18
08/22/2004 (6:37 am)
Hey !

I've tried the explosions from GameBeaver and run into a stupid problem:

www.polyfrag.com/tmp/example.jpg
Like you can see... either the explosion looks up to the sky or doesn't show at all. I'm using the AdvancedCamera in the "God-View" mode.. so I think torque tries to render the billboarded stuff of the explosions with the old standard camera ?? Does anyone know where the billboard-code of torque resides in the source ??
#19
08/22/2004 (7:01 am)
A billboard always faces towards the camera.... so it is doing exactly what it is supposed to do. You'd have to make a different one with the billboard above the ground instead of on the ground (or just under the ground, i assume that's what making it dissapear) and have an explosion animation on it seen from the top rather then seen from the side (like this one).

@Gonzo: I'll mail it to you in an hour or so (have to do some other things first)... a max 5 file is ok, right?
#20
08/22/2004 (2:06 pm)
Actually, the screenshot on the left looks pretty cool....

Rich
Page «Previous 1 2