Guns, Lasers, and Persistance

I would like to know if you guys know how bullets, lasers, and other projectiles aer handled in a 3D scene.

Lets examine a laser beam. The laser beam is constructed from a cylindar (I know you can take a plane and map a texture to it and animate the texture but its about the same thing). So do game engines continue to make new laser “objects” every time a player shoots (from a gun)? Or would an engine create say 100 laser objects and just use a circular que to pick which laser to use (hidding the lasers that aren’t used)?

So I have thought of 2 viabel methods kinda described above

  1. Just create a new Laser object (and behavior controlling the thing) every time a shot is fired.

  2. Create X lasers and just round robin them when needed (however, u are limited the number of lasers allowed on the screen at 1 time).

Are there better methods out there then the two above? Which method do you guys suggest?

Thanks for your input

Depends…

In case of a laserbeam (single object, created/released rarely), taking a new object each time pulling the trigger is feasable.

On the other end of a spectrum - when firing with a particle system that consists of hundreds of particles … better pool them together bc. creation might get expensive and the memory footprint is SO big, that you cannot assign one to all of your weapons.

Somewhere in between are the FlyingGuns cannonshots (12 cylinders) e.g… They are created in a lazy manner an then are assigned to the weapon and kept there. When firing, they are just attached to the scenegraph.

So look for a tradeoff!

Ok, so I decieded to do a Laser Manager that creates all lasers at the start. This should work fine b/c the number of lasers shot at one time is very small
(for my lightsaber game).

I’ll post back and let u guys know how things are working out.

Oh yea, like u said with the hybrid Idea. You could create x number of lasers. If you find out that more is needed, then u could create the extra lasers on the fly and then rotate them into the circular que.