Event Tick Efficient?

Is event tick an efficient area for sub routines that need to be looped through such as an ai character getting a next way point to move to or to check to see if it detects the player? I am using C++ code for this and would like to know if this is the best method or if there is another place i should place code that needs to be looped?

For logic that need to be executed every tick, overriding Tick() is a good place. For logic that needs to be executed less than every tick, you can consider to use timers (SetTimer).

For AI, you may want to do some parts every tick and some parts less often, for example:

  • Update the movement along a path every tick (required for smooth movement)
  • But check for the player only 5 times per second
  • And check if the path needs to be recalculated only 5 times per second

For each task you can ask yourself if the player would notice the difference if some logic was done less than every tick. For example, unless you want to make perfect AI for a twitch shooter, it won’t matter if your AI detects the player with a worst case delay of 0.2 seconds, so you can limit the player checks to 5 times per second. You can gain a lot of performance this way.