| 1 | This document presents a callgraph about the Initialization and Shutdown of the Ca3D-Engine, |
|---|
| 2 | plus one call to the servers "changeLevel()" console function in mid-game. |
|---|
| 3 | |
|---|
| 4 | Last updated: 2007-11-27 |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | // Init of global variables: |
|---|
| 9 | Console=...; |
|---|
| 10 | CollModelMan=...; |
|---|
| 11 | |
|---|
| 12 | main() |
|---|
| 13 | ConsoleInterpreter=...; |
|---|
| 14 | ConFuncT::RegisterStaticList(); |
|---|
| 15 | ConVarT ::RegisterStaticList(); |
|---|
| 16 | |
|---|
| 17 | HandleButtonOK() |
|---|
| 18 | Init: |
|---|
| 19 | OldLib |
|---|
| 20 | FileSys |
|---|
| 21 | MaterialMan |
|---|
| 22 | MainWindow (OpenGL) |
|---|
| 23 | Renderer |
|---|
| 24 | TexMapManager |
|---|
| 25 | FMOD |
|---|
| 26 | GuiMan |
|---|
| 27 | Game (GameImpl in e.g. DeathMatch.dll) |
|---|
| 28 | |
|---|
| 29 | Server (if in "run both" mode) |
|---|
| 30 | ConsoleInterpreter->RunCommand("changeLevel($WorldName)"); |
|---|
| 31 | [See below for details.] |
|---|
| 32 | |
|---|
| 33 | Send CS0_Connect message to server. |
|---|
| 34 | Wait for SC0_ACK (server also sends SC1_WorldInfo to newly connected client). |
|---|
| 35 | |
|---|
| 36 | Client |
|---|
| 37 | [No special init done or required here.] |
|---|
| 38 | |
|---|
| 39 | ClientGui with 1 ClientWin |
|---|
| 40 | GuiConsole [...] |
|---|
| 41 | |
|---|
| 42 | Master-Loop: |
|---|
| 43 | "Drive" the GuiMan by forwarding all events (time, mouse, keyboard) from the system (OpenGLWindow) to it. |
|---|
| 44 | Client->MainLoop(); |
|---|
| 45 | Server->MainLoop(); |
|---|
| 46 | |
|---|
| 47 | Shutdown / Cleanup: |
|---|
| 48 | delete Client; |
|---|
| 49 | delete Server; |
|---|
| 50 | |
|---|
| 51 | Game->Release(); |
|---|
| 52 | delete GuiMan; |
|---|
| 53 | [...] |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | Server runs the "changeLevel($WorldName)" console command: |
|---|
| 58 | NewWorld=new Ca3DEWorldT(PathName.c_str(), NULL); |
|---|
| 59 | WorldT wird aus .cw File geladen; |
|---|
| 60 | new ClipWorldT; |
|---|
| 61 | new EntityManagerT; |
|---|
| 62 | delete ServerPtr->World; |
|---|
| 63 | ~CaServerWorldT(); |
|---|
| 64 | delete Ca3DEWorld; |
|---|
| 65 | delete EntityManager; |
|---|
| 66 | delete EngineEntities[Nr]; <-- Called for all numbers. |
|---|
| 67 | delete OldStates; |
|---|
| 68 | Game->FreeBaseEntity(Entity); |
|---|
| 69 | if (ScriptState) ScriptState->RemoveEntityInstance(Entity); |
|---|
| 70 | delete Entity; |
|---|
| 71 | delete ClipWorld; |
|---|
| 72 | Game->Sv_UnloadMap(); |
|---|
| 73 | delete ScriptState; |
|---|
| 74 | Sv->World=new CaServerWorldT(PathName.c_str(), NewWorld); |
|---|
| 75 | Game->Sv_PrepareNewMap(); |
|---|
| 76 | ScriptState=new ScriptStateT; |
|---|
| 77 | EntityManager.CreateNewEntityFromBasicInfo(...); <-- Called for all entities in the map. |
|---|
| 78 | NewBaseEntity=Game->CreateBaseEntityFromMapFile(...); |
|---|
| 79 | ScriptState->AddEntityInstance(); |
|---|
| 80 | new EngineEntity(NewBaseEntity); |
|---|
| 81 | Game->Sv_FinishNewMap(FileName); |
|---|
| 82 | ScriptState->LoadMapScript(...); |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | Client received a SC1_WorldInfo message: |
|---|
| 87 | delete World; |
|---|
| 88 | ~CaClientWorldT(); |
|---|
| 89 | ~Ca3DEWorldT(); |
|---|
| 90 | ~EntityManager(); |
|---|
| 91 | delete EngineEntities[EntityNr]; <-- Called for each entity. |
|---|
| 92 | ~EngineEntityT() |
|---|
| 93 | delete OldStates; |
|---|
| 94 | Game->FreeBaseEntity(Entity); |
|---|
| 95 | if (ScriptState) ScriptState->RemoveEntityInstance(Entity); |
|---|
| 96 | delete Entity; |
|---|
| 97 | |
|---|
| 98 | World=new CaClientWorldT(PathName, WorldLoadingProgressFunction, OurEntityID); |
|---|
| 99 | Ca3DEWorldT(PathName.c_str(), NULL); |
|---|
| 100 | WorldT wird aus .cw File geladen; |
|---|
| 101 | new ClipWorldT; |
|---|
| 102 | new EntityManagerT; |
|---|
| 103 | |
|---|
| 104 | Reply with CS1_WorldInfoACK. |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | Client received a SC1_EntityBaseLine message: |
|---|
| 109 | World->ReadEntityBaseLineMessage(InData); |
|---|
| 110 | EntityManager.CreateNewEntityFromEntityBaseLineMessage(InData); |
|---|
| 111 | NewBaseEntity=Game->CreateBaseEntityFromTypeNr(...); |
|---|
| 112 | EngineEntities.PushBack(new EngineEntityT(NewBaseEntity, ...)); |
|---|