Not a Go veteran, but I implememted a behavior tree in a little simulation game prototype. Looked very similar structurally but your version is nicer.
As an aside:
I don’t particularly like behavior trees. Not sure why, but they feel brute-force-y to me, and I find them much harder to reason about than state machines. Once you express state machines as data, they can become just as powerful and feel less fiddly.
A different thought I have that I couldn’t get around exploring is to implement behavior trees with channels (no go routines). But that’s just a vague notion.
There was a article from Russ Cox „Storing Data in Control Flow“. Maybe there‘s something there?
The clock injection for testing temporal nodes is a really nice touch. Most BT libraries force you to actually wait or mock everything yourself. This would work well for orchestrating retries and fallback logic in microservices, not just game AI. Any plans for parallel composite nodes?
As an aside:
I don’t particularly like behavior trees. Not sure why, but they feel brute-force-y to me, and I find them much harder to reason about than state machines. Once you express state machines as data, they can become just as powerful and feel less fiddly.
A different thought I have that I couldn’t get around exploring is to implement behavior trees with channels (no go routines). But that’s just a vague notion.
There was a article from Russ Cox „Storing Data in Control Flow“. Maybe there‘s something there?