Snappy Safari

A "Where's Wally?"-style game with GOAP A.I. agents

Snappy Safari Title Screen

Key Features

  • Completed for university Gaming Technologies and Simulations module
  • Features GOAP A.I. agents providing unique and purposeful behaviours to each animal
  • Players must quickly capture photos of random animals within a set timeframe
  • Multiple levels with increasing difficulty

Technology & Development

Technology Used

  • C#
  • Unity
  • GOAP agents

Development & Features

After a critical review of Jeff Orkin's 'Three States and a Plan: The A.I. of F.E.A.R. (2006)' for a university assignment, I was deeply intrigued by Goal Oriented Action Planning. This project allowed me to explore that interest further while also meeting the university's assignment criteria for the module.

How GOAP was incorporated

Action-Centric Mechanism

At the heart of the GOAP implementation is the GAction class. Each action, like wandering, fleeing, or seeking water, has an associated cost, duration, target location, and set of preconditions and effects. For instance, an animal might require its thirst to be below a certain threshold before seeking water.

Agent States and Beliefs

The Animal class, an extension of the foundational GAgent, houses the animal's states and beliefs, effectively its internal representation of the world. The beliefs, such as being threatened or sleepy, influence which actions the animal chooses to perform.

Dynamic Decision Making

Rather than a fixed sequence of actions, animals weigh their options based on their current states and beliefs. This dynamic behavior means that an animal might choose to drink when thirsty, but flee if it senses a nearby threat, adding unpredictability and realism to its actions.

Goal Management

Animals have a set of sub-goals, like exploring, fleeing from predators, or seeking rest. Each sub-goal is assigned a priority, ensuring that pressing needs, like avoiding danger, are addressed first. The agent then evaluates which actions satisfy these goals based on its current world state.

Periodic "Needs" Check

Using Unity's Invoke method, the game periodically checks and updates the animals' needs such as hunger, thirst, and energy. If any of these needs surpass their threshold, the animal's beliefs are updated, which in turn influences its choice of action.

Environmental Awareness

The game includes a proximity check, ensuring animals are aware of the player's location. If a player gets too close, an animal may perceive it as a threat, triggering the "flee" action, adding another layer of interaction and challenge for the player.

Animation Integration

Based on the chosen action, the game plays appropriate animations, making the animal's behavior visually coherent to players. Whether it's the searching for water or the frantic dash of one fleeing, the animations, although somewhat primitive, serve to reinforce the decisions made by the GOAP system.

Gallery

Video

Demonstration of Snappy Safari gameplay.