Blockland Forums > Modification Help

Global Tick Schedule for Zones?

Pages: << < (2/4) > >>

Tom:

Well doing a container search multiple times a second on many bricks will get laggy.
The onVehicleTouch events did something similar and got failbinned.

Iban:


--- Quote from: Tom on February 27, 2011, 12:53:46 AM ---Well doing a container search multiple times a second on many bricks will get laggy.
The onVehicleTouch events did something similar and got failbinned.

--- End quote ---
I think this just supports the local routine even more. If you have 100 trigger zones, would it not be better to have each zone firing off independently as opposed to them all going off at once?

In ZAPT, the Zombies think at different paces. The typical thinking time is 500ms, so the Director schedules out their thoughts over that span. If there are 50 zombies out and about, there will be a 10ms lapse between each zombie thought schedule. This was added to reduce workload and I think there was a noticeable increase in speed.

Space Guy:

Having lots of schedules running at the same time can be laggy. What I've found to be the most effective way is a global 33ms (shortest amount of time a schedule can actually happen on) schedule that runs a counter doing e.g. one in ten bots each time. That has the same effect as doing a 330ms schedule for every bot, but is easier on the server.

new SimSet(ZoneSet);

(... ZoneSet.add(%trigger); when created)

function blahtick()
{
   schedule(33,0,blahtick);
   $counter = ($counter+1) % 5;
  
   for(%i=$counter;%i<ZoneSet.getCount();%i+=5)
   {
      %trigger = ZoneSet.getObject(%i);
      doContainerChecks(%trigger);
   }
}

Iban:

How do you know that this is the best method?

Space Guy:

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.

Pages: << < (2/4) > >>

Go to full version