Long running taks
nicogranelli opened this issue · comments
I think there is a bug in how the tree handles tasks calling "running" multiples times. I will try to explain with this example:
The tree:
- Build a wood wall (Sequence)
- do I have wood? (task, return fail)
- go find wood (task, return running)
Step 1:
the bot doesn't have wood, so it go find it. First node call fail, second node call running
Step 2:
the tree go directly to "go find wood", and the node call running
Step 3:
I expected the tree returning to the same task, as it will call running several times. But instead it started over the first task
Is this the expected behaviour?
In short: That's true.
It should go on with the "go find wood" task if trying to run the sequence.
At least it should. It is odd because it is tested, look here: https://github.com/Calamari/BehaviorTree.js/blob/master/spec/javascripts/behavior_tree_spec.js#L176
I will try to look into this more deeply in the evening.
I can't get jasmine to work in my current machine, but I read tests. Maybe you could try to add a new "it" to test what happen when you call step one more time.
You were right. There was a problem with long running nodes, which isn't happening with asynchronous calls. I added some test cases for that, and it should be fixed in the new version. (See 60cbf66 for the fix.)
On a side note, why couldn't you run the tests? Some problem on your machine, or is there something I can help with?
Thanks!!
About the tests, I guess the problem is that I don't use ruby. So I tried with jasmine for nade I have installed, but I didn't get it to work.