root/cafu/trunk/Ca3DE/Init and Shutdown.txt

Revision 36, 3.8 KB (checked in by Carsten, 2 years ago)

Added all Cafu files to cafu/trunk
(with matching svn:ignore properties).

Line 
1This document presents a callgraph about the Initialization and Shutdown of the Ca3D-Engine,
2plus one call to the servers "changeLevel()" console function in mid-game.
3
4Last updated: 2007-11-27
5
6
7
8// Init of global variables:
9Console=...;
10CollModelMan=...;
11
12main()
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
57Server 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
86Client 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
108Client received a SC1_EntityBaseLine message:
109    World->ReadEntityBaseLineMessage(InData);
110        EntityManager.CreateNewEntityFromEntityBaseLineMessage(InData);
111            NewBaseEntity=Game->CreateBaseEntityFromTypeNr(...);
112            EngineEntities.PushBack(new EngineEntityT(NewBaseEntity, ...));
Note: See TracBrowser for help on using the browser.