Implementation of flocking behavior AI developed in Unreal Engine 4.
Author: Pablo Rodriguez (parmandorc)
- Watch the video preview!
- Download FlockAI.app (Mac OS X)
- Download FlockAI.exe (Windows)
- My LinkedIn profile
Unreal Engine 4.7.6
- Basic movement using WASD or arrows. (Note: You don't control the agents, you can just move the camera around)
- Mouse wheel to zoom in and out.
- Mouse left clic to spawn new Agents to the scene. (Hold left clic and move the mouse to orient the starting direction of the agent, or right clic to cancel spawning).
- Press 2 in order to spawn Positive Stimuli (or food) instead when left clicking.
- Press 3 in order to spawn Negative Stimuli (or enemies) instead when left clicking.
- Press 1 again to spawn new Agents.
This project implements a traditional flocking AI algorithm, with its 3 traditional components:
- Alignment: agents will face the same direction as their neighbors.
- Cohesion: agents will try to stay together as a group.
- Separation: agents will try to steer away from very close neighbors so the group doesn't collapse.
Nevertheless, while the traditional algorithm uses normalized vectors, this project takes a different approach by taking into account the distance between agents. This means for instance that an agent will try to separate from its neighbors more intensely if they are about to collide than if they are rather far away, which provides a much more realistic behavior.
Another new aspect is the introduction of external stimuli to the agents. This means they will react to points of interest in their field of view, simulating behaviors like going towards food or avoiding an enemy.
The purpose of this project is purely academic, and so its focus was to implement an Artificial Intelligence algorithm in a real time environment, but also to gain experience with Unreal Engine as a game development environment, and that is why the majority of the funcionalities of the game are developed using C++ programming, except for the main algorithm which is developed using Blueprint programming so as to gain experience with this technology.