Working on Critter AI

Implementing critter AI, so far got the prototype working. AI is done using Behavior Trees, only a few lines of code:

        PickWanderPathBehavior.fromJSON({ radius: 5, anchor, distance, axis }),
        StartAnimationBehavior.fromJSON({ name: wanderAnimation, repeatCount: Number.POSITIVE_INFINITY }),
                new CheckPathEndBehavior(),
                WaitForEventBehavior.fromJSON({ event: PathFollowerEventType.EndReached })
        StopAnimationBehavior.fromJSON({ name: wanderAnimation }),
        StartAnimationBehavior.fromJSON({ name: idleAnimation, repeatCount: Number.POSITIVE_INFINITY }),
        RandomDelayBehavior.from(2, 5),
        StopAnimationBehavior.fromJSON({ name: idleAnimation }),

The PickWanderPathBehavior creates a new path to follow around the anchor point within a given radius, in this case 5. Here’s what this loos like in action

Leave a Reply

Your email address will not be published. Required fields are marked *