In 5.6.1 State Trees, Tick Transitions are not properly triggering their transitions. I do see that there was [another [Content removed] on this issue a while back and that this has been fixed in 5.7. However, the CL for that appears to be Private, so I can’t see what the fix was (if there was a specific issue causing it; I know 5.7 overhauled the State Tree architecture a good bit).
Is there a way we can see the CL change? Or is there a recommended alternative (besides “don’t use Tick Transitions”) if the fix requires getting all of the State Tree changes from 5.7?
My apologies for the CL issue. It is indeed fixed (yay!), but that was a CL from our main branch for FN. In more good news, here is the UE5 Main CL: 43425513! As for if there is a different method for this, it would be to use a StateTree event that you send from the other location that is being tracked by the tick. So if you are checking for a hostile to be perceived, have your AI controller send a StateTree event with a tag to denote hostile was perceived. Limiting the tick frequency of StateTree is paramount to its performance. You can also use the StateTreeDelegates feature to transition on a delegate. Both are valid and how we have been structuring trees internally. If you need Tick still, do investigate setting the tick rate for the state to a reasonable value for how often it should update to limit the tick rather than having the StateTree evaluate each frame.
-James
Would it be possible to create an AI task which is launched by your ST either as a global task or state task that tracks position data and could use events or a callback using weak execution context to cause a transition? It could be done similar to the MoveTo task in the engine, and if you don’t need to update the associated actors or distance, you could skip the Tick setup where the task is updated for a moving goal. There is also an example of async execution using the weak execution context and lambdas.
-James
Hey James,
Thanks for the swift response! We do try to limit how often we use Tick in State Trees, but there are some rare cases that are difficult to replace, such as checking if a bot is in range with its target (which is just a simple distance squared check), where adding any delay can make the bots feel sluggish (depending on the context, of course).
Unfortunately for our case, that CL is a good bit more intense than we’d feel comfortable implementing right now. As a temporary work-around (until we upgrade to 5.7), I suppose we could try replacing our OnTick Transitions with a State Tree Task with Tick that sends an event/delegate when it meets the desired criteria.
Thank you for the help!
We’ve not yet created custom AITasks, but what you suggested sounds like a good alternative for us to look into. Thanks for the tip!