1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Any help with bettering my understanding of the main Method

Discussion in 'ServUO Discussion' started by strieder, Nov 6, 2018.

  1. strieder

    strieder New Member

    Oct 29, 2018
    Likes Received:
    I've been playing around with ServeUO a bit for the first time trying to understand more about how it works. Please correct me if i'm wrong but my understanding so far is I can see there is the main method that contains a while loop responsible for calling a few important methods that essentially "progress" the world:
    • Mobile/ItemProcessDeltaQueue(); processing changes in the worlds objects like movement, hp updates, death, spawn etc.
    • Pushing packets to clients via NetState.FlushAll()
    • Timer.Slice() seems to be incrementing the servers internal method of keeping time; its "clock"; for when events will happen in the future e.g. curse expires from target.

    Perhaps my biggest area of not understanding is around the kind of helper thread for time keeping and the Timer.Slice() method. One key thing I can see is that sometimes the main thread is taking a very long time to execute the Timer.Slice() method. I can see some synchronisation via locking between this helper thread and the main thread and this is one place they seem to clash. What exactly is Timer.Slice() doing? Does it particularly need to be a part of the main method or could there be any room to offload the processing that the main thread is doing in Timer.Slice() to the helper thread?


    while (!Closing)




    if (Slice != null)

    if (sample++ % sampleInterval != 0)

    now = TickCount;
    _CyclesPerSecond[_CycleIndex++ % _CyclesPerSecond.Length] = ticksPerSecond / (now - last);
    last = now;
  2. Grimoric

    Grimoric Member

    Mar 21, 2015
    Likes Received:
    #2 Grimoric, Nov 8, 2018
    Last edited: Nov 8, 2018
Similar Threads: help bettering
Forum Title Date
Script Support Help with limiting fighting while mounted and running while armed Yesterday at 5:28 PM
Script Support ServUO - Death changes help request. Jan 6, 2019
Script Support Help making universal dye tub work on ethereal mounts Dec 29, 2018
General Discussion Monsters/NPC'S/Freshly spawned things stuck under map. Please help! Dec 26, 2018
ServUO Discussion Publish 54 Help Restoring Gargoyle City Dec 18, 2018
ServUO Discussion Need help getting started Dec 9, 2018
Mono Support Need help with email registration Dec 6, 2018