Has anyone had a chance to look into Apoc's implementation of a Behaviour Tree known as
TreeSharp? I've been using FSM's too long now and it was indeed turning into the Flying Spaghetti Monster Apoc pointed it out to be.
I didn't have any luck finding a documented interface for the library, so I'm a little unsure if I am using the library as intended. I'm afraid maybe I am thinking along the lines of FSM's still. For example lets say I created some arbitrary Sequence.
Code:
Sequence _navigate = new Sequence(
//Set next Hotpot to path to and create a path.
new Decorator(ret => Waypoints.CycleHotSpots(),
new Action(delegate { })),
//Verify that a path is set.
new Decorator(ret => Waypoints.IsPathSet,
new Action(delegate { })),
//Cycle through the path points.
new Decorator(ret => Waypoints.CyclePath())
new Action(delegate { }))
);
Now if I wanted to Pulse the tree I would invoke method _navigate.Execute, but I am unsure as to what the context parameter is.
Also just out of curiosity in Apoc's old implementation of an FSM we had Start and Exit method's which fired during the entry and exiting of a transition. To emulate this same approach, is it a safe bet to use a Decorator to check if it's child returned a Success status and perform our once only code there (and also the same deal for once only exit method, but with the condition of a return status of Failure instead).
Thanks if anyone can give me some tips and pointers to using this library correctly. Oh an also sexy implementation as always Apoc, very elegant.
Cheers,
Harland.