OnTick, OnFastTick and Ticks Delay setting
Problem
OnTick
may be called less often than OnFastTick
depending on Ticks Delay
setting. Because of this some developers prefer to throw all their champion logic in OnFastTick
instead of OnTick
. This may cause performance issues if not done correctly.
Below you may observe an example from the profiler during the moment when I was holding spacebar using Lua champion script which mostly utilizes OnFastTick
instead of OnTick
:
Solution
Use OnFastTick
only when it is necessary for your champion and make sure the code inside OnFastTick
handler is optimized, avoid calling any expensive functions (such as CreatePath
for example). Ideally you should use it only situationally, for example for very precise and time sensitive logic.
Throw your logic in OnTick
and let users decide what Ticks Delay
setting to use.
If user wants better champion performance and sacrifice some FPS - user can go even with 1ms setting. Normally users should use at least 2-5ms. Right now default is 30ms, but it's a possibly subject to change.