Basically I'm working on a similar game to achtung die kurve (http://curvefever.com). I'm almost done with the game, however I'm not completely fine with the way power up spawning works. As for now, I have setup a timer loop runs the spawn code block every 1 second. I have setup so each spawning period for each power up (total of 11 powers) is between 19.25 - 1.925 seconds. However this is fine, but it's to random I would say. For example it can be times were no power-ups spawn at all and there can be times were 5 power-ups spawn at the same time. I have made alot of games and this problem comes up every time.
Why not simply spawn a random powerup every
N seconds, where you specify some range to randomly pick in for
N (eg. 3-10).
The power-ups will spawn out of synch. I'm not sure if you mean multiplayer-synch; if that's the case, you need to make sure your clients all use the same seed for the random number generator. That will fix your problem.
You can make the randomness depend on how long time it was since you last spawned a power-up.
For example: Assume you want a power-up roughly every m second, with "spread" s (seconds). Here, s should be less than m.
When (m-s)+j seconds have passed since last spawned power-up, you spawn a new power-up with probability (j-1)/(2s) (or probability 1 if s=0).
This model has the following properties:
- The average time between power-ups is exactly m seconds.
- Larger s gives a higher variance in waiting time between power-ups.