Beta tomorrow!

Hello there!

This week I have sealed alot of memory leaks and fixed a whole lot of small bugs. Apart from that I have also made a enemy wave spawner that is time-optimized for level designers. It is not very precise and there are currently no functions for telling exactly what enemy is going to spawn where. But making a wave is so simple! Just tell it how many enemies of what kind you want, and for how long the wave will last, and it’s completed (you can also add a health multiplier to the enemies).

The directions I got from our lead designer when I was to make this wave spawner was that one wave will last for 60 seconds then a new one will begin. However I thought I’d twist it up alittle bit. Instead of making an enemy spawn every second or something like that (which is pretty straight forward) I made the speed at which the enemies spawn increase the further into the level you got, so that when the wave is about to end there are really many enemies spawning. I think this is a good way to build up stress and excitement.

To calculate how the spawning speed of the enemies would increase, and how to still spawn the exact number of enemies you decided during the time you decided I drew a simple quadratic equasion (k(x^2)=y) on a paper where y represented how many enemies there were spawned during x seconds. k would be a number that would vary depending on how long the wave was and how many enemies you decided to have.

Namnlös

First I made it simple for me and calculated it with numbers. I stated that a wave should last for 60 seconds. Therefore x=60. Then I stated that I wanted 100 enemies during a wave. y=100. the equation k*(x^2)=y then became k*(60^2)=100.

k=100/(60^2)
k=about 0.0278

The equation for enemy spawnging then became 0.0278*x^2=y. I put deltatime as x and then to make enemies create every time the equation had increased by 1 I calculated delta y between each frame and added that to a float value. If that float value became more than 1 I gave an integer it’s value, subtracted the floats value by the integer, and then returned the integer to a for-loop that spawned that number of enemies.

Works wonders!!! Thanks for your time 🙂 byebye.