Request: A tick event that only fires every 20 ticks (3 events per second.), and another that only fires every 60 ticks (One event per second). Events should have the same event.tick available as the normal tick event.
Purpose: Less performance hungry tick options for entities/code that do not require fast update cycles.
Can currently be achieved by using if statements and checking the number of ticks passed since last execution, but can still end up being thousands of unneeded if checks if large lists are involved.
Examples: Simulating tree growth; Weather patterns; Simulating alien strategic decisions;
on_tick_20 & on_tick_60 events
Re: on_tick_20 & on_tick_60 events
Why not just use modulo? Like:
You only ever need one if statement for that.
Code: Select all
if event.tick % 20 == 0 then
whatever code you need to be run every 20 ticks
end
Last edited by Rahjital on Sat Jul 25, 2015 9:57 pm, edited 1 time in total.
Re: on_tick_20 & on_tick_60 events
You are entirely correct.
For some reason I had it in my head that it would get called per entity, not per registered game.on_event(.
Forget I suggested anything.
For some reason I had it in my head that it would get called per entity, not per registered game.on_event(.
Forget I suggested anything.