Skip to content

🤖 Artificial intelligence techniques for video games, built with C++ and SDL2 for PC at the university.

License

Notifications You must be signed in to change notification settings

sFaith3/ai-techniques

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Steering Behavior combination

AI Techniques

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.

Table of Contents

Projects

Steering Behaviors

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:

  1. Basics: Seek/Flee, Arrive, Pursue/Evade and Wander.
  2. Advanced: Flocking.
  3. Combination of the above mentioned among others, such as: Path Following, Perimeter Avoidance, Collision Avoidance, Obstacle Avoidance, etc.

Pathfinding

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:

  1. Breadth First Search (BFS), Dijkstra, Greedy Best-First-Search (GBFS) and A* pathfinding algorithms for an agent (soldier) to find the optimal path to a random location in the maze.
  2. 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.
  3. 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.

Decisions

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:

  1. Finite State Machine (FSM) with Function Pointer Style following the next behavior:

    Decisions FSM

  2. Goal Oriented Action Planning with A* as the research algorithm:

    Note Not shown in the previous video

    Some simulations:

    DecisionsGOAP

    • 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_Nearbyand Enemy_Alive.

Getting Started

This project has been made with Windows. But you should be able to use it on Linux and Mac.

Pre-requisites

Before you start, make sure you have an IDE/Compiler such as Visual Studio, Code::Blocks or XCode.

Installation

Note If you are on Windows, you can skip the first step

  1. Hello SDL.
  2. Download the last version of SDL2, SDL2_image and SDL2_ttf corresponding to your operating system (if you are on Windows, see the next).

Windows

  1. Download the VC.zip for Visual Studio or the mingw.tar.gz for Code::Blocks and MinGW.
  2. Put the corresponding libraries in the next folder path (you have to create folders): "Libraries/SDL2-version", "../SDL2_image-version" and "/../SDL2_ttf-version".
  3. Remove "-version" in the folders. Then you wil have the following names: "SDL2", "SDL2_image", "SDL2_ttf".
  4. 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)
  5. Compile and run the solution in Debug-x64.

Run the executables

  1. Paste in "[ProjectName]/x64/Debug" the next files: "res" folder ([ProjectName])
  2. Run the executable in "[ProjectName]/x64/Debug".

Authors


Samuel Balcells

Arnau Macià

Sergi Sánchez

License

MIT License

About

🤖 Artificial intelligence techniques for video games, built with C++ and SDL2 for PC at the university.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages