Skip to content

An exploration of how artificial intelligence plays a role in modern games

Notifications You must be signed in to change notification settings

ethanbaker/game-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stargazers Issues LinkedIn




Logo

Game AI Exploration

An exploration of how artificial intelligence plays a role in modern games

Table of Contents
  1. About
  2. Getting Started
  3. License
  4. Contact

About

Project demonstration image

This project is the culmination of an introduction to game AI class I took at university. Throughout the course, I built up a game engine completely from scratch that was designed to show the effectiveness and performance of different artificial intelligence methods used in modern-day games.

This project is meant to be set up in the most abstract way possible in order to provide a workflow that requires the least amount of coding for each scene. The environment has various folders containing different functionality for this abstract behavior and contains unique folders representing a scene (a scene is a unique render window that is used as a demo).

The abstract parts of the homework include a few key classes that perform the following functions:

  • Engine: this represents the actual game engine. It contains various configurable settings that change the game environment, and it manages rendering entities and breadcrumbs. It extends the sf::RenderWindow class for added functionality that individual entities can access.
  • Entity: this represents any dynamic entity in the game engine. Entities get updated periodically and have associated behaviors that control the entity’s acceleration in the environment. It encapsulates the sf::Sprite class with extra functionality.
  • Environment: this represents pathfinding and pathfollowing functionality. Different representations of an environment can be used, with demos using a grid environment. This class provides methods to localize vertices and quantize positions, as well as generate obstacles that can be rendered on a specific row and column.
  • Mouse: this represents the mouse’s movement on the window. It is a controller class that records the mouse’s position, velocity, and last clicked location. A mouse controller is associated with a given engine.
  • Steering: this class contains multiple steering algorithms and behaviors. There are basic variable matching behaviors that extend a common virtual class, and there are weighted behaviors that take the abstract idea of matching variables and apply them to specific situations (such as aligning a character’s orientation to the direction of motion, or matching a character’s position to the center of a mass).
  • Utils: this class contains helpful methods and classes to facilitate the scenes, such as an extended array class with distance searching functionality, a static math class with helpful vector math and random generating functions, or multiple graph datatypes used for decision/behavior trees.

Then, each scene uses these abstract classes in order to create a unique environment for each scene in each demo. The comprehensive abstract engine and easy setup allows the scene to be constructed with minimal hardcoding.

(back to top)

Built With

(back to top)

Getting Started

This project exists as a demonstration of my skills in C++, SFML, and AI algorithms. This project should not be used for any school assignments, and full copyright is retained on this project.

However, this project does contain demos that anyone can run and view. Steps to run the demos exist below.

Prerequisites

  • C++ is installed
  • SFML is installed
  • Make is installed

Note that C++ compiling can provide different beahvior on different systems. This project was created to work without issue on Ubuntu 20.04. If you ever have issues compiling this project on your system, try this standard environment.

Installation

  1. Clone this project
  2. Navigate to the base directory of this project
  3. Run make
  4. Run the binary generated from make (./main)

This will start up the first of three different scenes. You can progress to the next scene by closing the current one.

  • Scene A: Run a decision tree for a single character
  • Scene B: Run a behavior tree between a character and a "monster"
  • Scene C: Run a learned decision tree of Scene B

(back to top)

License

This project retains all copyright. Nobody else can copy, distribute, or modify this work. You are only allowed to fork or clone this project to view demonstrations.

© 2023 Ethan Baker

(back to top)

Contact

Ethan Baker - contact@ethanbaker.dev - LinkedIn

Project Link: /~https://github.com/ethanbaker/game-ai

(back to top)

About

An exploration of how artificial intelligence plays a role in modern games

Topics

Resources

Stars

Watchers

Forks