top of page
Black Background
Screenshot1.png

Colony Sim FMP

Colony Simulation

Gather resources to create a base and keep your colonists alive.

Build a colony from nothing and do whatever it takes to ensure your colonists' survival.

Platform

Windows

Language

C#

Software

Unity

Visual Studio 2022

Photoshop

Contributions

Solo Project

About the Project

A project started as part of my Major Project at University.

The aim of the project is to explore various AI techniques and to implement them into a colony simulation game, inspired by big titles such as Rimworld, and to look at ways to further optimise my implementations. 

As I go ahead with the project, I would like to focus more on gameplay elements to bring together a full game loop. I would also like to develop a fleshed-out behaviour system for the characters that would be impacted by their moods and time of day, among many other factors. 

AIUpdate
02:13
WorldGenExample
00:16
FMP Showcase
03:13

Images

Videos

Relevant Documents

My literature review discussing my research into various search algorithms. 

Black Background
What I learned

- How to implement A* pathfinding. My first goal after creating the basic grid-map functionality was to implement A* pathfinding for the colonists to use.

- How to create a basic task system for agents. As I wanted the colonists to function on their own with minimal player input, I had to develop a task system that would allow the colonists to request a task and fulfil it. 

- How to implement Breadth First Search. As the task system expanded, I had to optimise the way in which colonists would search for tasks and items. To do this, I implemented the Breadth First Search algorithm that would allow the colonists to search concentrically until an acceptable target was found.

- How to implement GOAP (Goal Oriented Action Planning). In this project, I use GOAP for the higher level decisions my AI makes, such as "Work", "Rest", "Pass out" (when exhausted), and eventually to eat, sleep, socialise, and other actions. I will also use GOAP for the combat AI when I eventually implement enemies. I didn't choose to use GOAP to plan out individual steps in multi-step tasks (such as construction), as the already existing task system was able to be utilised by GOAP without any modifications. I may reconsider this decision once development has progressed further.
With the GOAP system added, I was able to strip down the CharacterController class to just contain basic functionality (such as movement), and now the GOAP_Agent class handles the logic to work on tasks, and a GOAP_Sensor is now used to find valid tasks.

Various methods to optimise my pathfinding and search algorithms:
- Threaded request system. Instead of the colonists calling the A* and BFS functions directly, I created two classes; "PathRequestHandler" and "TaskRequestHandler" that would take requests from the character class, and process them individually on separate threads (using .NET's ThreadPool).

- I created a Region System that utilises two data structures. The first is a 'Cluster' that represents a portion of the world grid (10x10 areas for example) and contains the second structure, 'Region's. Regions are aware of neighbouring regions (regions that are pathable to one another), by creating hash values that represent their edges, and then checking if that hash is shared by another region (which would mean that they're neighbours). This is to avoid the regions directly accessing one another, the only exception to this is a Door Region (a 1 tile region where a door exists). 

The Region System means that the algorithms can utilise the regions as nodes instead of individual tiles, significantly reducing the amount of nodes searched. 

Current Goal

Now that I have a basic implementation of GOAP, I plan on adding additional behaviours and the relevant gameplay functionality. Such as food for a hunger system, beds for sleeping, a day/night cycle, as examples. 
 

bottom of page