I don’t even know where to start the question, because im not sure what to ask about.
I want to do is fast shooting gun, spawning many bullets.
For simplicity lets assume game runs at 60 fps.
Fire rate 300bpm which is 5 bullets per second.
With timers, spawned actors will be spaced evenly (right?).
But what about performance side?
Are timers event driven or actor tick related? I have on mind solution to use timer and reduce ticks for some actors and return tick rate after.
I know about possible overhang with many timers. But is perfmorance gain even worth doing this?
I am only worried about tick accuracy which may happen during some fps drops. I want to some simulation accurate game
You should never measure with FPS but rather frame time (deltatime) since 1 second of measurement is not accurate enough.
Yes if the frame time stays above the timer interval but it will repeat itself in the same frame to catch up.
Tick on the other hand is lossy and will just slow down the fire rate if the frame time drops below the fire rate.
A fire rate of 5 per second is 200ms interval between bullets. It is not uncommon to see a frame time of much more than 200ms especially when large things are spawned in.
You should at least handle what would happen if more than 1 bullet spawn in the same frame if you use a timer. Should they be staggered or dropped or you don’t care?.
I would not use timers unless the Timer interval is more than 100ms except in some rare cases.