Last night I was working on the first level of Super Space Trooper™ to get the enemies to be challenging for the player, but not insanely difficult to beat. Especially being the first level. SST isn’t being written in the same order of the levels, so this isn’t the first time I’ve begun working with the game’s enemies. But it is the first time I’ll be adding in all the necessary components to complete an entire level.
The problem is that the player has a fair amount of real estate they can maneuver through, so using pre-animated enemies with pre-animated weapons fire doesn’t fully do the trick. While I like patterns like this in video games, a player could simply hang out in one area of the screen and pass through the entire level un-harmed. So I need to do some AI on the enemies. Developing that isn’t too much of a problem, except then often the enemies are too difficult, with every weapon being shot right at the player, or shot at the location that the player is anticipated to be at once the projectile of the weapon arrives.
An approach I am considering is a combination of the two. In other words, animate the enemies but give their weapons an X and Y range that calls weapons fire functions if the player intersects that range. Then add a slight random variable into the angle the enemy will fire at within that range. It’s likely the changes will only need to be fractions of a degree to make it challenging enough to the player but not impossible. Plus if I set the range variable in a way that I can clamp (make the range smaller or larger) it, I can reduce the randomness in later levels to make it a greater challenge to the player.
Beyond just weapons fire, thought needs to go into the location of the enemies based on the expected action of the player given the previous enemy. In other words if EnemyA flies off to the right of the screen, do I want EnemyB to show up in that general region to pose a threat to the player, or would it be better to have EnemyB make his entrance elsewhere so that the player moves away from the right side of the screen? And in either case does EnemyB enter screen before EnemyA has completely left or wait until after?
I expect to work on this through the long weekend (Canada – Victoria Day aka “May Two-Four”). I’m sure there will be complications along the way because there always is, but that’s the fun of all of this. Overcoming problems, and challenges, and doing some learning.