Blockland Forums > Modification Help
Global Tick Schedule for Zones?
Iban:
--- Quote from: Space Guy on February 27, 2011, 08:59:21 AM ---It's not doing all the work in one single step (global schedule by itself as you said) and the engine is not trying to check the times of a hundred schedules simultaneously. I don't remember where, but I remember hearing that schedules are low-level and really laggy like this.
--- End quote ---
So the happy medium. Makes sense.
Truce:
--- Quote from: Space Guy on February 27, 2011, 08:52:07 AM ---33ms (shortest amount of time a schedule can actually happen on)
--- End quote ---
Just did a test, seems like 15 is the lowest.
--- Quote ---==>function endtest() { cancel($testloop); echo("Ran " @ $testtimes @ " times."); }
==>function testtick() { $testtimes++; cancel($testloop); $testloop = schedule($testdel,0,testtick); }
==>$testtimes = 0; $testdel = 33; testtick(); schedule(1000,0,endtest);
Ran 29 times.
==>$testtimes = 0; $testdel = 16; testtick(); schedule(1000,0,endtest);
Ran 58 times.
==>$testtimes = 0; $testdel = 15; testtick(); schedule(1000,0,endtest);
Ran 61 times.
==>$testtimes = 0; $testdel = 14; testtick(); schedule(1000,0,endtest);
Ran 61 times.
==>$testtimes = 0; $testdel = 13; testtick(); schedule(1000,0,endtest);
Ran 61 times.
==>$testtimes = 0; $testdel = 1; testtick(); schedule(1000,0,endtest);
Ran 61 times.
==>$testtimes = 0; $testdel = 0; testtick(); schedule(1000,0,endtest);
Ran 341073 times.
--- End quote ---
Space Guy:
--- Quote from: Truce on February 27, 2011, 10:58:58 AM ---Just did a test, seems like 15 is the lowest.
--- End quote ---
Oh. I was basing it off this message I got - this is several updates ago so maybe it's changed since then.
--- Quote from: Badspot on November 01, 2009, 08:23:45 AM ---Your Weapon_PortalGun add-on sets up a script loop called "SpaceTick" that fires every 10 milliseconds. The game simulation only advances every 32ms so you are doing more than 3 times as much work as necessary even at the greatest possible fidelity. I would recommend updating this as soon as possible.
--- End quote ---
Iban:
--- Quote from: Space Guy on February 27, 2011, 11:17:42 AM ---Oh. I was basing it off this message I got - this is several updates ago so maybe it's changed since then.
--- End quote ---
Correct me if I'm wrong, but there's a difference between the game simulation and the scripts. Meaning, scripts are limited by processor and the game simulation is graphical rendering.
Space Guy:
--- Code: ---==>function testTick(){if($sim::time > $starttime+1){endtick();}else{$testcount++;schedule($testamt,0,testTick);}}
==>function test(){$testcount=0;$starttime = $Sim::Time;testTick();}
==>function endtick(){echo("Ran " @ $testcount @ " times.");}
==>$testamt = 100;test();
Ran 10 times.
==>$testamt = 32;test();
Ran 30 times.
==>$testamt = 15;test();
Ran 59 times.
==>$testamt = 10;test();
Ran 61 times.
==>$testamt = 5;test();
Ran 119 times.
==>$testamt = 1;test();
Ran 119 times.
==>$testamt = 3;test();
Ran 118 times.
==>$testamt = 0;test();
Ran 845819 times.
--- End code ---
Without two schedules at once I get a limit at 5ms, also many more runs at 0ms.
In any case the time should be set as high as you can for the same functionality rather than lower - 100-200ms preferred to 5ms as other mods and wrench events will be running schedules at the same time.