Ive recently been reading about behavior trees for AI and how they work. There's lots of great stuff on here.
However Im stuck with a question.
Imagine I have an AI truck, that needs to drive to point A, load up some goods, then drive to point B and unload them. These are laid out appropriately as leaf nodes in a behavior tree.
What happens when an action takes a large amount of time? For instance, in each game loop, no other nodes will be tested whilst the drive from point A to point B node continues to execute. But what happens if the truck is attacked by bandits halfway through?
There may well be a whole new set of rules for handling this situation, but Im always executing this "transport" node until its complete.
My only thought is rather than have a node that says "drive from point A to point B", it would become "move 5 feet in the direction of point B as long as there's no bandits around...and there's still fuel.....and the driver is not tired". My concern is thats alot of questions to ask, each game loop, for each AI entity.
Is this the right way to handle these long actions, by chopping them up and avoiding them altogether? Or is there a better way for this scenario?