Simple AI with Behavior Trees - Agro?

Hi ****,

To make this as simple as possible! What I suggest is a sequence node immediately after your Root node. This will allow you to control you execution, and prevent another node from being executed before the previous one finishes.

So in our case we create the first node Attack! which has a Decorator Found Enemy? . This node only executes if an enemy is found. Once an enemy is found, the node shouldn’t finish execution until the enemy is lost. I suggest putting this logic on the Pawn itself. So the enemy check is done by the Pawn, so the Decorator gets that information from the Pawn. Once the enemy is found, the Attack! node assigns a Event Dispatcher which is for your Enemy Lost Event on the Pawn itself. Once the enemy is lost, Pawn calls Enemy Lost. The node Attack! with the Enemy Lost Event Dispatcher Assigned is called finishing execution.

The next node is straight forward, this state gets the next route and moves towards it. Main node should be sequence to allow proper flow execution. Current route information should be stored in the Blackboard Asset.

So the idea is, should I be attacking now? No, keep patrolling. Usually this is the approach for FPS. Shoot or Don’t Shoot is the question.

Thanks,

Peter L. Newton