Implementation

This shows the Distribution of enemies to be spawned by percentages for each Wave Type. The first 10 waves spawn in order 1-10 afterwards the Waves are chosen at Random.

How the distribution of enemies is calculated.

How the distribution of enemies is calculated.

Design goal

This Allows for a smoother Difficulty curve so the rounds are random but not random enough that the game becomes impossible or boring. This can also add to some interesting gameplay for instance the single enemy type waves each 5 rounds.

Difficulty

The speed of the waves increase in enemies and the level limit of the enemies is dependent on the difficulty. Gloomy always begins at a slow increase of enemies with a level cap of 30 for all enemies. Obscure slowly increases for the first 5 rounds then steadily increases more afterwards with a level cap of 55 which is equal to the player level. The most difficult is Abyss which begins increasing at a rapid rate from the beginning capping at level 70. This mode is for veteran gamers who can tackle the most difficult sceneario’s.

Spawn loop

Once the wave begins it will calculate how many enemies are to be spawned and decides their type via percentages for the first 10 waves the order is from 1-10 afterwards a random wave is selected from the graph above. Once the loop has begun as many enemies are spanwed until they runs out or the enemy cap is reached. If it can no longer spawn an enemy it will periodically check if another enemy can be spawned.

Enemies Target

The Enemies Target is decided on certain conditions in the beginning the Target is the Player however once the teleporter is activated the Teleporter becomes the new Target.

Check the timer

At the start of a round a Timer is set based on the type of enemies and increases by a value in seconds multiplied by the amount. The Followers value starts at 8 Seconds if the first Wave includes 4 Enemies then the Wave lasts 24 Seconds. Each second of the wave a check is made if the enemy count is less than the max amount if it is it allows the respawning of enemies.

Check Spawn Limit

If there are already 24 or more enemies on the level, the spawn will fail. The Final Level bypasses this restriction to 72 enemies.

Spawn Enemy

If the previous spawn was a success, the process is repeated using a new enemy. If it fails every second the enemies will be checked against the limit. If there are less than the amount the process continues.

Spawnpoints

Spawnpoints are placed in the game scene and every wave are added to an array. This array is used before an enemy is spawned by getting the distance from the player to each spawnpoint and reordering the array. The enemies are then spawned at the point furthest from the player (This can be changed to be the closest or the middle ground of the two). Alternatively, enemies can spawn within a radius around the spawnpoint, though this is set to 0 by default.

Set Enemy Level