Making the Enemy AI


When I was making the AI for the enemy in "Watched", I had a couple of options:

  1. Make the enemy follow waypoints, and deviate from them if it sees the player.
  2. Make the enemy go to the player's current position on an interval, and chase the player if it sees them.

Both of these methods had their downsides though. If I just used waypoints, the enemy might feel too predictable, and might be too easy to avoid. Making the enemy travel to the player's position on an interval might make the player encounter the enemy too often, or not often enough if they are moving around the map a lot.

I decided to go with a hybrid of these methods. The enemy picks a random waypoint, and starts going there. If on its way it spots the player, it will chase the player until it loses sight of them. However, the enemy will also get the player's position on an interval. Usually by the time it gets there, the player will have moved somewhere else. But this method makes the enemy's position more unpredictable, and it might run across the player while going to a player's previous position.

Files

Watched (Windows) 45 MB
Sep 17, 2020

Get Watched

Leave a comment

Log in with itch.io to leave a comment.