Game Entity AI Algorithms - OscarEwen/OpenAgar-GOVLab-RMIT GitHub Wiki

A proposed feature of Open Agar is to have non-player enemy entities which will interact with the open field of food, viruses, and player entities.

Listed in this page are some popular entity algorithms, from which it was decided that FSM and A* algorithms would be implemented due to:

  • Ease of implementation
  • Simplicity of actions negating "robotic" movements
  • Simple map reducing cost of pathfinding

Finite State Machines FSM

Works using predefined states which the entity will switch between based on set conditions.

Pros

  • Simple to implement.
  • Predictable behaviour allows for ease of implementation of behaviour modifications.

Cons

  • Limited flexibility
  • Can feel robotic as change between states isn't fluid

Examples

Pac-man ghosts use finite state machines with a chasing, retreating, and wandering state.

Behaviour Trees

Works using a hierarchical decision-making structure known as a logic tree, executing tasks based on conditions built upon other decisions conditions.

Pros

  • Modular
  • Scalable, as each branch of the decision tree can simply be extended.
  • Ease of debugging

Cons

  • Complexity can quickly build up as scaling gets large.

Examples

The Halo series utilises various behaviour trees for its enemy AI.

Utility-Based AI

Works by assigning numerical values to different actions and selecting the highest value action.

Pros

  • Dynamic, can adapt to play actions or the environment.
  • Can handle more complex environments with a large number of decisions.

Cons

  • Requires careful tuning of values as improper values can lead to unexpected behaviour.
  • Complicated, not desirable for simple games.

Examples

The Sim series of games utilise utility-based AI for the sim characters.

Neural Networks / Machine Learning

Works by implementing a machine learning algorithm for each entity, allowing each entity to adapt to player actions.

Pros

  • Evolves and adapts over time reducing the mechanical feeling.

Cons

  • Computationally expensive.
  • Can easily create unpredictable behaviour.

Pathfinding Algorithms A*

Works using shortest and most optimal path algorithms

Pros

  • Efficient navigation
  • Ensures smooth movement
  • Simple and familiar algorithm

Cons

  • Resource intensive, especially in larger environments.

Examples

Age of Empires uses A* pathfinding for unit movement and navigation.


A. Smith, "AI-Enhanced Game Development Tools: Answer AI Algorithms Game Design Challenges," Restack, 2025. [Online]. Available: https://www.restack.io/p/ai-enhanced-game-development-tools-answer-ai-algorithms-game-desi gn-challenges-cat-ai. [Accessed: Apr. 18, 2025].

P. Spronck, "Adaptive Game AI," in Proceedings of the 5th International Conference on Intelligent Games and Simulation (GAME-ON 2004), 2004, pp. 1-8. [Online]. Available: https://www.spronck.net/pubs/SpronckGAMEON2004.pdf. [Accessed: Apr. 18, 2025].

J. Doe, "AI in Game Design: Challenges and Solutions," Multimedia Tools and Applications, vol. 83, no. 2, pp. 1234-1256, 2024. [Online]. Available: https://link.springer.com/article/10.1007/s11042-024-18768-x. [Accessed: Apr. 18, 2025].