Development Blog (semi)random.thoughts()

Enemy AI

Lets discuss our enemies “AI”. AI between parentheses because you can’t really call them smart. They are not intent to anyway. They are intent to be predictable and easy to overcome. They need to get their strength from their numbers, not by matching your great skill. This is my guiding principle when designing enemy AI. Just like bullets, enemies need to show cool patterns on screen.
Lets discuss our enemies “AI”. AI between parentheses because you can’t really call them smart. They are not intent to anyway. They are intent to be predictable and easy to overcome. They need to get their strength from their numbers, not by matching your great skill. This is my guiding principle when designing enemy AI. Just like bullets, enemies need to show cool patterns on screen.

We have two types of AI:

  • Movement AI
  • Shooting AI

Shooting AI


I’ll start with Shooting AI, because this one really is the simplest. Enemies simply fire a projectile after a fixed delay or fire a salvo of projectiles. The script only fires forward and only when it’s delay expires. This leads to predictable and cool looking bullet patterns.

auto_shoot

bullet_pattern

Movement AI


Movement AI is more complex than Shooting AI, but made up of more or less atomic movement functions:

  • MoveForward
  • AutoRotate or the “smart” version: RotateTowardsPlayer
  • SineLateralMovement
  • SineVerticalMovement

Off course, all these AI scripts have parameters to adjust there behaviour, such as movement speed and rotation speed.

Special functions are:

  • Loop: make a preset amount of rotations after a certain delay;
  • Kamikaze: try to fly into the player.

It’s when combining these functions that interesting behavior emerges:

sine_lat_forward

MoveForward + SineLateralMovement leads to the basic sine enemy SineLateralMovement and SineVerticalMovement gives an interesting “boss” pattern

sine_lat_vert

At this moment, I don’t really want to add any AI scripts, but first see how much value I can sqeeze out of these ones.

We value your privacy. This site collects only information required to provide you this Service. For more information, read our privacy policy.