Artificial intelligence techniques, oriented to video games, made with C++ and SDL2 for PC at the university. AI is a discipline that tries to make computers capable of performing cognitive tasks that humans and animals are capable of doing.
These are a set of algorithms that allow autonomous agents to navigate their environment in a realistic way. And the basic idea is to use local information to calculate and apply forces (acceleration) on characters to modify their motion. An agent is anything that senses its environment through a set of actuators.
SteeringBehaviors_SamuelBalcells_ArnauMacia_SergiSanchez.mp4
In the simulations shown you find the implementation of some Steering Behavior in the following order:
- Basics:
Seek/Flee
,Arrive
,Pursue/Evade
andWander
. - Advanced:
Flocking
. - Combination of the above mentioned among others, such as:
Path Following
,Perimeter Avoidance
,Collision Avoidance
,Obstacle Avoidance
, etc.
The goal of pathfinding algorithms is to find a realistic (intelligent) path between two locations in the game world. These techniques are needed for long-term planning instead of waiting until the last moment to discover a path problem, such as a wall (obstacle), when it is too late.
Pathfinding_SamuelBalcells_ArnauMacia_SergiSanchez.mp4
Simulations implemented:
Breadth First Search
(BFS),Dijkstra
,Greedy Best-First-Search
(GBFS) andA*
pathfinding algorithms for an agent (soldier) to find the optimal path to a random location in the maze.- Application of the
A*
algorithm for an agent to find the optimal path that passes through a set of N random locations within the maze. - A strategy, using a
kind of D*
(dynamic version of A*), that takes into account that there are adversarial agents (enemies) in the game. The agent has to reach a set of N random locations with enemies to avoid.
Decision making is the ability of an agent to decide what to do in any given moment. The agent processes a set of input information that it uses to decide the action it wants to take. And the input to the decision making process is the knowledge that the agent has and the output is a request for action.
Decisions_SamuelBalcells_ArnauMacia_SergiSanchez.mp4
Simulations implemented:
-
Finite State Machine
(FSM) with Function Pointer Style following the next behavior: -
Goal Oriented Action Planning
with A* as the research algorithm:Note Not shown in the previous video
- A soldier has to scout (search for enemies), approach an enemy, aim, shoot, reload, explode bombs, escape, etc.
- World status with the following information (all are
true/false
):Agent_Alive
,Agent_with_Weapon
,Weapon_Reloaded
,Agent_with_Bomb
,Enemy_Visible
,Enemy_Aligned
,Enemy_Nearby
andEnemy_Alive
.
This project has been made with Windows. But you should be able to use it on Linux and Mac.
Before you start, make sure you have an IDE/Compiler such as Visual Studio, Code::Blocks or XCode.
Note If you are on Windows, you can skip the first step
- Hello SDL.
- Download the last version of SDL2, SDL2_image and SDL2_ttf corresponding to your operating system (if you are on Windows, see the next).
- Download the
VC.zip
for Visual Studio or themingw.tar.gz
for Code::Blocks and MinGW. - Put the corresponding libraries in the next folder path (you have to create folders): "Libraries/SDL2-version", "../SDL2_image-version" and "/../SDL2_ttf-version".
- Remove "-version" in the folders. Then you wil have the following names: "SDL2", "SDL2_image", "SDL2_ttf".
- Paste in "[ProjectName]/x64/Debug" the next
.dll
:SDL2.dll
(Libraries/SDL2/lib/x64)SDL2_image.dll
(../SDL2_image/lib/x64)SDL2_ttf.dll
(../SDL2_ttf/lib/x64)
- Compile and run the solution in
Debug-x64
.
- Paste in "[ProjectName]/x64/Debug" the next files: "res" folder ([ProjectName])
- Run the executable in "[ProjectName]/x64/Debug".
Samuel Balcells |
Arnau Macià |
Sergi Sánchez |
---|