Game Development Community

Lightcycle Trails

by Michael Smith · in Torque 2D Beginner · 09/05/2014 (3:45 am) · 1 replies

I am toying with the idea of a lightcycle game and want opinions about how to implement the trails.

I figure to place a trail of either rectangular or line segment collision objects behind the cycle. I would use sprites that are a few meters long in engine terms so the trail would conceptually be like a series of dashes, ---------. My question is whether to generate the trail pieces on the fly or to create a huge pile of them ahead of time.

I know that for a turret it is recommended to create the ammo ahead and deactivate it when not in play. I can do the same for the walls but it could take thousands of sprites to do trails for several players zooming around.

If I had, say, ten thousand wall sprites piled in a corner somewhere would that be a problem for the engine? Or a worse problem than creating sprites on the fly?

About the author

Bible translator by day-- game programmer by night


#1
09/05/2014 (5:48 am)
I'd say just stretch a single sprite until you turn. Add in-line edge shapes to that sprite as you move, or update the collision shape each tick (if you will have many players this may be a performance hit). That way you're not creating dozens of sprites each tick - there should be no need to make a cache of them.

Some experimentation should show where the bottlenecks are, then optimize to taste.