Don't Walk By - 7

Don't Walk By - 7

Mar 4, 2020. | By: Evan Diamond
1 min

The seventh CGD blog post about Don’t Walk By

Overview

This week I added a ContinueDefaultBehavior function to the Ai script as well as a points of interest system. I also added a few minor changes.

ContinueDefaultBehavior

Previously the function to set the ai to go into the default state behavior was StartDefaultBehavior which would make the ai to find a new point to path to. This was called from the RevertState meaning that for the puddle for instance once the ai left it and reverted their state there was a high chance they would go back through the puddle. ContinueDefaultBehavior stops this by storing what destination they were going to in default state are then pathing to that value again when the function is called.

Points Of Interest (POI)

Up till now the ai in default state has just pathed to random points which is not ideal because it produces unpredictable movement. To deal with this I implemented a POI system. Any gameobject that has the PoiPoint script on it becomes a poi and ai will path to it. What poi the ai paths to is decided by PointsOfInterest script which gives ai a random poi except the one they’re currently at.

Poi demo

Minor changes

  1. SpawnServicePawn now returns the service pawn gameobject
  2. Adding a shouldFlock bool to the ai script to stop the servicePawn from potentially flocking
  3. Made the default state in the Ai script public and in the StateInfo struct. This is so the animation script knows that default state its in.

About

Gamers developing new games.

Social Links

Our Bunker

University of the West of England,
Frenchay Campus, Bristol, BS16 1QY,
United Kingdom.