In my case, the player has an attack that 'spawns' about 16 bullets per tick. These are pointed at random angles, and fired off at a constant speed. When they hit an enemy, or the edge of the screen, they are 'destroyed'. So, their 'lifetime' is pretty short, <1 second.
In short: Bullets start offscreen, inactive. They go back offscreen when 'destroyed'. For 'spawning', I move them onscreen and reorient them.
If I hold down on this attack button on a blank screen, I get a maximum onscreen count of ~1500 bullets.
Here's a thread with more discussion of this:
Your game looks awesome BTW.
Develop games in your browser. Powerful, performant & highly capable.
Thanks so much TiAm! I was curious though, does that mean you are creating 1500 bullets in your layout? I feel like my game might be able to use this optimization to help with CPU load but im not sure the practice. I should read the thread you posted haha.
Yes, and storing them offscreen. This is not without some cost as well, because they have to be 'checked' for drawing every tick (or so I understand). So, when I go this route, I have more cpu usage at idle.
However, the most demanding part of the game is when I've got all those bullets onscreen, and in that situation I come out ahead. YMMV.