ReMonkey Tutorial #2: Ninja & Pirates!

Link to previous tutorial:

After checking the first tutorial, you may have noticed a type problem: the Leaf Tasks (the building blocks of the Behavior Trees) works only with RedMonkey; which is not what you want because it severely limits its usefulness.

What you want, instead, is the freedom to create new Leaf Tasks which are more suitable to your game and its component. In this tutorial we’ll see not one but two different ways to leverage Behavior Trees with custom game logic (or more properly, create new blackboard classes compatible with RedMonkey). But enough chitty-chatty, let’s have a look at RedMonkeyNinja and RedMonkeyPirate.

The Pirate

Ahrr ahrr matey! I’ve digged my treasure o’ Banana and I’m ready to sail the seven seas! I just need the right Behavior Tree!

The class RedMonkeyPirate extends RedMonkey; so that it is possible to create LeafTask (and therefore Behavior Tree) more game-specific. The LeafTask for RedMonkeyPirate must be declared like this:

Ahrr ahrr! Let’s put the hook on! But if you prefer a katana to a hook, let’s have a look at…

The Ninja

Ninjas are swift, deadly, and go straight to the point. RedMonkeyNinja is no exception:

RedMonkeyNinja sets itself as the container for RedMonkey, meaning that RedMonkey become a property of RedMoneyNinja in a pseudo-entity style. No inheritance involved. Of course, we have a runtime casting in the LeafTask:

Thanks for reading! :sunglasses: