Making Waves in Rick Henderson
The most important thing, the flesh of the game, are enemy attack waves. In this short log i will show you how they are made.
The process is a bit tedious and probably can be automated to a certain amount (which i will probably be introducing to add some random variety) but it serves me well and gives a decent amount of control over what i do.
First, i choose what enemies will the wave contain (out of 40 enemies, yikes) and put them in the place i want them to be spawned. In this case, this is a simple one, enemies coming in from one direction.
I usually avoid putting them one behind another to avoid overlapping when they are on the screen if they are using a simple movement pattern (from right to left at a fixed speed).
After that, i put them in prefab and use a template i have for spawning and assigning positions. Spawning coordinates are manually copied from instances into a big table containing all the enemy waves, their elements and their positions.
Depending on the placement on the screen, enemies are applied a defined movement speed and direction. When placed right from the center, they will go left, when placed left of the screen, they will go right, when placed up – they go down, when placed down – they go up.
That’s simple, but it’s boring to have enemies always move in the same manner. All the enemies in the picture above i placed will use their own speed which can cause them to overlap and look messy when they appear on screen. So i have a couple of spawners with their tags. I use them to child the enemies to them and get additional info. For example, i can place them in singles squadron for all of them to use their base speed, or under squadron squadron (yeah, i know) for their speed to be overriden with whatever i type in the inspector. That way i can have that big asteroid cannon move slowly as well as the ships around it, like they are escorting it. I can also select the ships from the wave to keep their own speed, and others move like squadron, together. In this example, i’ve put the purple ones to move slowly with the big asteroid cannon, and the small greenish ones to move at their own accord.
That also gets repetitive so i’ve put another spawner type – waypoint enemies spawner! That way i can select any enemy from the wave and assign it a nice set of waypoints to follow (local or global), stop and continue during the movement and so on.
Another spawner type which is use exclusively on it’s own is the warp spawner, which spawns enemies on a (selectively) random place on the screen. Since it’s semi-random, i avoid using another spawner types to avoid overlapping. Nothing will happen to them since they can’t collide, but it looks ugly and unconvincing.
Of course, when combining waves, appropriate positioning and timing is also neccessary to avoid linear moving enemies with waypoint spawned ones.
In the end, it all looks something like this. Two round guys up and down move down and up, respectivelly. Thew won’t collide since they lock onto player and start following him. Small asteroid cannons follow the waypoints and come in front of the big asteroid cannon and two small ships that are escorting him at the same speed. Four small ships behing the big cannon move on their own accord, they are very fast and will overtake the big guy before they enter the screen.
That’s it, multiply that by several hundred and you’ve got yourself a game 🙂