The Great Fleece Development Recap (Part 2)

Recently I completed the 2nd project of my GamedevHQ course, The Great Fleece. I’d like to talk a bit more about its development.

The Guard AI Waypoint-Patrol System:

Read Part 1 and 2 here.

In this project, I needed a way for the guards to walk back and forth along a predefined route which included n-number of mid-points at which the guard would pause. A common solution for this kind of requirement is a waypoint system for the guards to path-find to, which is what I decided to create.

A waypoint path with no alternatives, drawn in green

The system simply uses a list of world positions and a Unity Navigation NavMeshAgent component to allow the guard (or any entity) to path-find to each point. Using variable timers and options, I can choose how the patrol behaviour functions.

For some of the guards, I also needed the ability for them to walk to one-of-two waypoints randomly, to add some diversity to their patrols. For that, I gave each waypoint an optional “Alternative” point.

Waypoints with an active “Alternate” are drawn in blue

For easy development, I made the patrol component draw lines between each point. Green between no-alternative points, blue when one-or-more points has an active alternate. Finally, the red lines with the dot-end are the direction the guard will turn to at that point, and the red lines over the blue are the zone in which the guard will start turning prior to reaching the point (for smoothness).

Player Movement/Navigation:

Read more here.

The Player navigation/movement code is pretty simple. It just uses a raycast from the camera to the point where the mouse clicked (if a valid layer is there) to determine the destination. It then uses NavMesh.SamplePosition to find the closest valid NavMesh point near the mouse click (this ensures that the player avoids walking into walls or display cases. Then it uses the Unity Navigation system, like the guards, to path-find to that point.

Using the NavMeshAgent’s path while walking and a LineRenderer, I create an accurate line showing the path that the player will walk to the destination. I also enable a small 2D plane with a PNG marker and set its position to the destination.

Path and destination marker




Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

“Cumulative Code” smell

.NET 5 has reached End of Life

How to: Create GitHub Action to deploy Azure Web App within Visual Studio

TryHackMe OWASP Juice Shop | Write-up

Building a Simple REST API E-Wallet Using Spring Boot — Part 1 (Starting Project, DB Scheme…


The 5 most important principles when working in a big tech

Back to Genesis: Bloat elimination

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vincent Taylor

Vincent Taylor

Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.

More from Medium

Level Design in Unity 3D Part 6: Colliders

Upgrading A Unity Project To The Universal Render Pipeline (URP)

Creating Rewarded Video Ads in Unity

Scripting our greybox prototype