You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lets say you have a pretty simple "Move to target" task
pseudocode-y
func _tick(delta: float) -> Status:
var unit = agent as UnitNode
unit.NavAgent.target_position = blackboard.get_var(_move_target)
await unit.NavAgent.navigation_finished
return SUCCESS
This doesn't work. The BT Task is expecting _tick to return a Status.Running to continue execution, and _tick doesn't return that at all (it's a coroutine now).
Proposed solution
This example probably should work somehow. If you can get the function state object, you can probably just check if _tick returned that, and if you do have that just store it off in the BTTask and check it every frame if it's finished. If the coro hasn't finished, return RUNNING.
I'm a bit of a godot extension noob, so I don't actually know if checking if _tick has become a coro is possible in gdext. If it's not, this issue can be used to show there is real world support for things like that.
Alternatives
The workaround here is easy if you are awaiting a signal, as you can just bind a lambda to it's signal and mutate some bool and emulate the coroutine that way. However, if you aren't awaiting a signal (but instead a generic coroutine), you cannot do this, and there is no workaround in gdscript, as you cannot acquire the function state object.
The text was updated successfully, but these errors were encountered:
Not sure if it's possible. GDExtension has almost the same limits as GDScript, just a little bit more access in some areas. Some classes, if they are not exported in the public API, are most likely not available in GDExtension. But I'd check that before making any definitive conclusions.
As of functionality, it seems occasionally useful. The question is how much this additional state tracking would reflect on a typical tree performance. Need checking if it's worth it. I estimate it's a few additional if-checks in each tick() (even if coroutines are not used), and a state variable in each task. Probably, not too much of a cost.
Problem statement
Lets say you have a pretty simple "Move to target" task
pseudocode-y
This doesn't work. The BT Task is expecting _tick to return a Status.Running to continue execution, and _tick doesn't return that at all (it's a coroutine now).
Proposed solution
This example probably should work somehow. If you can get the function state object, you can probably just check if _tick returned that, and if you do have that just store it off in the BTTask and check it every frame if it's finished. If the coro hasn't finished, return RUNNING.
I'm a bit of a godot extension noob, so I don't actually know if checking if _tick has become a coro is possible in gdext. If it's not, this issue can be used to show there is real world support for things like that.
Alternatives
The workaround here is easy if you are awaiting a signal, as you can just bind a lambda to it's signal and mutate some bool and emulate the coroutine that way. However, if you aren't awaiting a signal (but instead a generic coroutine), you cannot do this, and there is no workaround in gdscript, as you cannot acquire the function state object.
The text was updated successfully, but these errors were encountered: