Slime and Seek

Style: 3D Game, school project

Platform: Windows

Software and languages used: Unity, C#, Blender

Slime and Seek is a project that explores the integration of basic AI and steering behaviour. During the game, the guards patrol the labyrinth and try to capture the evader. The evader attempts to collect the three tomatoes placed randomly around the maze without getting caught by the guard.

General behaviour

Behaviour trees are used to control the AI agent's decision system. A high level of separation allows general behaviour like walking and collision handling to be reused in multiple agents.

The agent's movements are handled using simple steering behaviour like pursue and evade. All the behaviours are manually implemented using the appropriate mathematical formula.

Example of a behaviour tree

Broken pathfinding prevention

The AI agents use five short-range ray casts to detect collisions with walls. When a ray collides with a wall, the agent is pushed in the opposite direction to prevent it from passing through a wall. If the agents collide with a wall multiple times in a row, they move toward the closest visible navigation node and recalculate their path tracking using the A* algorithm.

Guard

Field of view

AI agents use a combination of 6 ray casts to simulate a cone of vision. The angle between the rays calculated in every frame allows a dynamic field of view.

The guard's field of view is affected by their movement speed. The faster they go, the narrower their vision gets.

Patrol

The guard's primary behaviour consists of patrolling around the labyrinth. They follow a specific path of navigation nodes and will stop to look around for the evader each time they reach a node.

If a guard ends up away from its patrol area, they will return to their last visited node and restart their patrol.

Pursue

When a guard locates the evader, they will enter into a pursuit state. In this state, the guard uses the pursuit steering behaviour to catch the evader. If the evader gets out of the field of vision, the guard will inspect their last known position.

The first guard who spots the evader will call the closest guard for backup. Both guards will try to ambush the evader by taking different paths through the labyrinth.

le gardien poursuit l'évadé

Evader

Mouvement and pickup

The main objective of the evader is to walk around the labyrinth and collect three golden tomatoes while hiding from the guards. Once selecting a tomato, the evader will use the A* algorithm to find its quickest path. After collecting the tomato, it flees to the area to hide from the guard who was alerted.

Evasion

If the evader spots a guard, it will recalculate its path and move to a point far from the guard. After reaching that point, it will try to collect the tomato again.

If the evader is directly next to a guard, they abandon their usual pathfinding and only try to move away from the guard to evade capture.

A video example

Demo video of the Space Rides project

Previous
Previous

Space Rides

Next
Next

Project Lumberjack