Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+15 votes

I am starting a countdown to spawn enemies for my personal S.I. after 80% of the previous wave's enemies have been defeated. I will have 4 different types of enemies. I need an algorithm to procedural generate which enemies get spawned in which rounds. I am thinking of creating a formula to spawn the enemies (all four types) in this format...

numRounds = batsSpawned (the easiest enemy that only follows the player)

(numRounds - 5)/2= cannonsSpawned (projectile enmies

(numRounds - 5)/3 = plugs (shoot electricity between eachother thus they will be spawned in 2s)

(numRounds - 5)/5 = enemy balls (moves in fast circles)

Any thoughts?

asked in CSC490_Spring2019 by (1 point)

2 Answers

+3 votes

Is there any reason that it is numRounds - 5? You could make final / constant variables within your project that structure different levels of difficulty and when it activates each type of enemy?

Another thing I thought of is using the % operator on the numRounds variable and make it such that every enemy spawns on rounds that have a remainder of 0 when doing numRounds % 7, or have the bats and cannons spawn when numRounds % 5 is 0.

Are you planning on implementing more enemies?

answered by (1 point)
+2 votes

I think that this could be a good start but until it's tested you might have troubles figuring out if its good or not.
With proper play-testing you can figure out if there are too many or too few enemies spawning.

I'd also recommend trying to look at other games as examples for how to generate enemies. I know that tower-defense games usually do a great job of having a good balance here so you might want to look into how those work.

answered by (1 point)
...