PathFindingAI is an AI developed to follows a target in a game.
For more detail about our work consult the doc folder.
We developed this goals in mind:
- Performance: we want that this AI can be used to implement a long-distance optimal path research in a game that runs at least at 60 fps.
- Plausibility: We want the actions taken by the AI to appear natural and to follow a logic that can be understood by humans. This is particulary important to increase the immersion.
Showcase of the ai in action: https://www.youtube.com/watch?v=OsOChnBTgcI
The following AI has these features:
- Line of sight: implemented Line Of Sight(in an adapted version for tilegame with grid-based movement) to not track player that are hidden from a wall. This is useful to increase the plausibility of the AI.
- A*: An optimized implementation of the A* algorithm to find an optimal path efficiently.
- Registering and using the last pos: when the "eye contact" is interrupted, no worries, the AI register the last location of the target and move to that location to explore the area.
- Idle: a simple routine to explore the area when there isn't information about the target position.
To compile the repository, you must use premake5.
I developed this demo in vs2017:
$premake5 vs2017
To zoom in camera: press 1 To zoom out camera: press 2 To move the player: WASD
The AI is developed in the following files:
- PathFindingSystem.h, PathFindingSystem.cpp: for the implementation of the algorithm used to compute the best path.
- LineOfSightSystem.h, LineOfSightSystem.cpp: for the implementation of the line of sight system adapted to a tilegame with a grid-based movement.
- RenderDebugFieldOfView.h, RenderDebugFieldOfView.cpp, RenderDebugLineOfSight.h, RenderDebugLineOfSight.cpp : systems created to render and debug visually the line of sight and field of view.