top of page



Solo Developer


This is a little showcase showing some of the AI I have worked on lately while trying to replicate interesting player behaviour in games. 

In here the main system is GOAP (Goal Orientated Action Planner) combined with the US (Utility System). In this project I also made an A* pathfinding system and a simple boids system. 

The GOAP also uses A* in order to find the most efficient route to action







For this assignment we had to create 2 AI's. A guard an an ally. The guard should attack the player and have some sort of behavior when it is not attacking. The ally should throw smoke grenades to create some cover for the player while hiding from the guard. 

I choose to create a very versatile GOAP system for both AI’s: the guard and the ally. This was because there are already a ton of fantastic behavior trees out there and I don’t think I will ever be creating one in the future that is better than the currently available ones. The GOAP however is something that I can utilize in the future and something I can use for many other projects. I couldn’t find a lot information about it either which made it a challenging choice, but a great one.

The core of this system is the ActionPlanner. This has a list of all available actions in the current environment. Said actions can be: cook food, collect charcoal, collect raw food, collect branches.

Each action in the scene is a node. A node has some data, for example: the item it gives on completion, the amount you receive on completion and the requirements, if it has any at all.

These nodes also have a world position and an action cost indicating how tiresome the action is. Chopping a tree is for example a lot more intensive than simply picking up some branches, however a tree would give you a lot more branches, meaning that it can be more efficient in the long run. You do however need an axe in order to chop a tree.

All these components are ingredients necessary for the functionality of my GOAP. By making use of A-star it calculates a path towards the goal. In the future I am planning to add a functionality to it that makes sure that it calculates the most efficient path towards the goal. This would however give a lot of challenges I would need to tackle, such as how many paths does it need to calculate before it picks the most efficient path? How practical will this be in large environments?


Starting with GOAP was actually quite a big challenge. I didn't really understand what it was that I was making. There was not a lot of information available about this being used for games and what not. 

First I had to understand what GOAP is. This is where I did most research. Eventually I was able to explain it in a very simple way that made it easy to understand for anyone. In a nutshell it calculates a path in the form of actions that the NPC has to do in order to achieve its goal.

I also wanted to make use of A* in order to find a route to the goal. Later on I hope to improve it so that it finds the best route to the goal. 

The actions are generic. This means that anything is able to use an action as long as it meets the requirements. If an action has a requirement (another action) then the GOAP will make a set of actions that have to be completed. An action can also be something such as throwing smoke bombs, instead of cutting some trees for wood. 

The beauty of GOAP is how extremely generic it can be. An action can be as simple as sleeping yet as complex as crafting a high level backpack with different types of leather. 

In my GOAP a complex action can be when the guard decided to create an iron sword. In order to do this the guard has to first mine some iron ores. After that he has to smelt them in the furnace for iron bars. At the anvil he can then proceed to make a sword once he has the right amount of bars and a hammer (which can be picked up nearby). 

The planner is also affected by the Utility System. This system tells the AI when it is too tired to continue or hungry. There are actions that decrease fatigue, hunger, or thirst. These actions will get a high priority depending on how needy the agent is.

Each action that the agent can do costs energy. The guard will eventually grow tired and will want to rest to recover some energy. The US will tell the GOAP to get some rest. 


illustration 1.png
Action planner logic
Creating an iron sword
Time to sleep



Each system has their own PMI, so let’s start with the GOAP.

- it is extremely easy to expand upon.

- it is very dynamic.

- it can be extremely fast and accurate when calculating a plan.

- it allows the AI to “think” about what approach is the most efficient.

- it makes use of a-star in order to plan something, which is thankfully not complex.


- the initial setup is extremely complex. You need to do a lot of things at once in order to get a test working. If it has a bug… good luck.

- not very beginner friendly studies/information etc.


- “action” is a very abstract word. An action can be something such as collecting, smithing, smelting, crafting… basically anything that you can do. Is there anything that you… can’t do?

- if I were to generate actions. That would mean that eventually my AI would be living in an environment where I have no clue what the possibilities are. What the AI is doing and what it is planning in the long run.

- I could potentially make nested plans. For example a long term goal containing short term goals with in between some room to breathe.

The second system I used was the Utility System.

- very easy to implement.

- very easy to understand.

- a ton of examples, research, documentations etc.


- can get really complex very fast. An agent can have a ton of utilities and how would they interact/impact each other?

- hard to expand upon (as far as my knowledge goes).


- an utility can be a goal. Hence why I chose to combine this with GOAP. The desire to consume food driven by hunger is a goal.

- my guard agent performed odd behavior at the early stages. For example during a hunt on the player it decided that it was time to rest or time to eat. This resulted in very “normal” behavior to my surprise. I can understand that after mining iron ores and smelting them that you want to grab a snack of have a nap. Where after it continues the grind for the resources. This was not intended but extremely interesting. If I want to make an AI that acts like a player controlled character then I will need to give it an utility system to have desires that are similar to what players have.

bottom of page