Building Logic for AI in Games – Part 2: Vision

Past entries

I just published the second part of my series of articles about AI on Infiltration. This second part deals with the enemies' vision, which was a critical aspect of the game, I hope you will enjoy reading it. You can read the full article here.

In my previous article, Building Logic for AI in Games – Part 1: Simple Movement, I discussed how I made enemies follow certain paths in my HTML5 game, Infiltration. I then had to figure out how to make enemies see the player.

In order to check if an enemy sees the player, I first perform a simple distance check. Indeed, if an enemy is too far from the player, I consider that he shouldn’t be able to see him.

Then, I perform the angle check. I have two angles: the direction towards which the enemy looks, and the angle from the enemy directly to the player. Considering that the enemy has a 90° field of view, I have to check if the difference between these two angles is below or above 45°.


Read more

< Introducing the new GameMix
Building Logic for AI in Games – Part 1: Simple Movement >