Post Thu Aug 13, 2020 5:15 pm

Server Loop Processing Outline

as i am tic-ing some processes in sub-hz, i am adding here to keep track of what's where and how its called. (incomplete - wip)
i had this posted at one time, but musta lost it somewhere along the line.

  Code:
Alasiya EvEmu Process Call PseudoCode
updated 12Aug20 (incomplete)


Main Server Loop {
    [if exit]
        shutdown;

    [if new connection]
        [create and assign new client object]
        [add new client to map and perform initial proc]

    EntityList::Process();

    [if proc time < xxx]
        thread::sleep();
}
   
EntityList::Process() {
    client->ProcessNet();                       -- do network connection things (connect, ping, d/c)

    [onSubTic]                                  -- this is currently 250ms
        TargetManager->Process();
        ProbeSE->Process();

    [onTic]                                     -- this is 1hz tic
        Client->ProcessClient();
        [forEach system]
            SystemManager->ProcessTic();        -- if this returns false (empty system), system is unloaded and removed

        sCivMgr.Process();
        sBubbleMgr.Process();

    [onMinTic]                                  -- this is 60s tic
        sMissionDataMgr.Process();

    [on5MinTic]
        sWHMgr.Process();

    [on15MinTic]
        sMktBotMgr.Process();
        sConsole.UpdateStatus();
        [forEach system]
            cur.second->UpdateData();           -- update active system timers and dynamic data every 5m

    [onHourTic]
        MapDB::ManipulateTimeData();
        sMktMgr.Process();
}


TargetManager->Process()
    [if isTargeted or hasTarget]
        [check distances, attack, add/remove target, etc as needed]

ProbeSE->Process()
    [check for movement timers and update client as needed]


sWHMgr.Process()
    -- placeholder

sBubbleMgr.Process()
    [if bubble empty]
        delete();                               -- this removes bubble from system, and releases its resources (bubble unloading)
    [forEach bubble]
        SystemBubble->Process();                -- bubbles are proc in order created, independent of system


SystemBubble->Process()
    [if players in bubble]
        [spawn npcs]

Client->ProcessClient();


SystemManager->ProcessTic() {
    [if system empty]
        return false;

    m_anomMgr->Process();
    m_beltMgr->Process();
    m_spawnMgr->Process();

    [forEach entity]
        SE->Process();
}

m_anomMgr->Process()
    [check timer and current counts and spawn anomaly as needed]

m_beltMgr->Process()
    [check for and set active belts]

m_spawnMgr->Process()
    [check for popped npcs and respawn accordingly]


SE->Process()
    SystemEntity::Process();
    -- do whatever else is needed for this entity (in it's specific class code)


SystemEntity::Process()                         -- generic base class call for each SE
    DestinyManager->Process();


DestinyManager->Process()
    -- this processes ALL movement in space (except scan probes, which are governed by separate code)
    -- make calls, checks, and updates as needed to move object


this is mostly for my reference, as i tend to forget where this file is when i need it.