[UE4]AI中使用Tick()函数的性能问题

 

Tick()函数一般是debug时用的,正规的逻辑中,如果要用Tick函数,可以考虑用UE4提供的代理事件。

 

参考:
Using Tick() within AI?

https://answers.unrealengine.com/questions/62519/using-tick-within-ai.html

 

Using Tick for controlling AI has a (very) long tradition, so it's a good start. Nowadays we don't do that since every tick counts (as if it was not the case more years back! ;)). The main problem with tick is that most of the time your AI won't have anything new to do every tick, so most of that Tick function calls will be wasted performance.

The right way to do AI is to have it event driven, where AI responds to events in the world (like being shot) and case of no events it's just performing some kind of scripted behavior (scripted in a sense there's a piece of code producing a sequence of action that AI follows).

UE4's way of controlling AI is by Behavior Trees. And don't be scared by the "Experimental" label - all that's experimental in our BTs are tools, and only because they just need the Epic polish to reach the right quality bar. I strongly encourage everyone to use it! :D

Cheers,

--mieszko

 

 

你可能感兴趣的:(UE4)