The basic idea is this: if tick % 20 == 0 will always tick on 0th tick, every 20 ticks. If all conditions are written like == 0 then they will always tick on respective 0th tick, thus creating one very heavy tick computation-wise.
Recommendation: replace 0 with different values to spread out the ticks better. This would prevent potential stutter when ticks align.
Considerations: positive actions should tick before negative actions. Changes in behavior are unlikely but should be thought about.
This is just a quick listing from the MTN code folder:
locomotive/market.lua
1560: if ticker % 30 == 0 then
locomotive.lua
805: if ticker % 30 == 0 then
812: if ticker % 120 == 0 then
818: if ticker % 1200 == 0 then
823: if ticker % 2500 == 0 then
main.lua
340: if this.game_reset_tick % 1800 == 0 then
489: if tick % 40 == 0 then
501: if tick % 250 == 0 then
506: if tick % 1000 == 0 then
icw/main.lua
108: if tick % 5 == 0 then
112: if tick % 20 == 0 then
115: if tick % 240 == 0 then
ic/main.lua
-- line 103 is a good example :)
103: if tick % 30 == 1 then
111: if tick % 240 == 0 then
115: if tick % 400 == 0 then
The basic idea is this:
if tick % 20 == 0
will always tick on 0th tick, every 20 ticks. If all conditions are written like== 0
then they will always tick on respective 0th tick, thus creating one very heavy tick computation-wise.Recommendation: replace 0 with different values to spread out the ticks better. This would prevent potential stutter when ticks align.
Considerations: positive actions should tick before negative actions. Changes in behavior are unlikely but should be thought about.
This is just a quick listing from the MTN code folder: