top of page

GOAP Guard AI

falmouth logo.jpg

This project is a computing AI demonstration designed as both a portfolio piece and a Unity asset for publication on the Unity Store. It’s being developed during my third year at Falmouth University, utilizing the Goal-Oriented Action Planning (GOAP) AI technique.

​

The AI kit is intended for users who want to explore how GOAP can be applied in AI systems, as well as for those less familiar with AI who want a free, ready-to-use asset for their NPCs. It’s primarily aimed at RPG developers looking to implement intelligent guard behavior. My goal is to make the asset easy to integrate, customize, and visually appealing through thoughtful editor scripting and a straightforward user interface.

​

​​

Github link: https://github.falmouth.ac.uk/EJ229959/GOAP-RPG-Guard-AI

​

​

​

​

​

guard AI pic for page.PNG

Editor tools:

I decided to create editor tools mainly for user experience such as ease of use to edit the system to their liking.

Patrolling Editor

Here is a patrolling waypoint manager that can be created for any guard with a click of a button. The patrol points can be built with a button press and all the developer needs to do is move them where the patrol path needs to be.

waypoint builder.PNG
waypointsPNG.PNG
guardwaypointManager.PNG

Guard ai manager Editor

After creating the simple GUI implementation on patrol points I decided to build an AI manager editor window for users to easily create new guards and customise them to their liking. This is mainly using scriptable objects and changing data through an editor window. When the user creates a new guard with the button it creates a new scriptable object asset with all the details filled in.

​

AImanagereditor.PNG
create new guard editor window.PNG

This is the window that gets opened up after clicking the "Create new guard" button, this is where the users can customise their guard and save it's data.

goap guard AI editor manager.png

Goal orientated action planning(GOAP)

Goal-orientated action planning, "refers to a simplified STRIPS-like planning architecture specifically designed for real-time control of autonomous character behaviour in games" (Orkin, n.d.)  that relies on world states, pre-conditions, and effects to reach a goal planned by the AI. The AI will plan a set of actions depending on the state of the game with the information given. This makes the AI a lot more dynamic and realistic.

​

Here is a screenshot of the current world states that are given to the planner:

updated world states.PNG

Here are the current pre-conditions and effects for the patrolling action:

preconditions and effects patrolling.PNG

Here is some code from a patrolling action class that runs a simple patrolling system around points using the way-point manager that can be created from the patrolling action editor button shown above previously:

patrolling.PNG

Current goals that are given to the AI: "guardArea", and "survive":

​

goals.PNG
Approaching issues

 

Throughout the development of this project, I came across issues, one of the main issues I encountered was debugging the AI. It was very hard for me to see what plan was being created and what action was currently running. My approach to overcoming this was two steps, I first edited the agent's base class to include a debug message which sends a message including the queue of actions that the agent has chosen. This helped me a lot when finding what actions weren't being passed into the plan.

​

Here is an example of the message being sent into the console:

​

guard goal.PNG

Another method I took to overcome this issue is the UI to show the AI's current action and current threat level state. I created a debugging script to hold the UI and to have other classes call to it. Here is an example of this:
 

guard UI.PNG
Feature details:

​

Making this asset as a free AI guard kit for developers to use and manipulate I wanted to create generic behaviours that are based around non-player characters(NPCs) in video games such as Skyrim, and The Witcher 3. 

​

This system includes a variety of actions that the AI can choose to use. Here are the implementation details that are in the AI system:

​

milanote guard.PNG


Orkin, J., n.d. Goal-Oriented Action Planning (GOAP). [online] Alumni.media.mit.edu. Available at: <https://alumni.media.mit.edu/~jorkin/goap.html> [Accessed 7 December 2021].

References:
  • Twitter
  • LinkedIn

©2021 by Ethan Jones. Proudly created with Wix.com

bottom of page