This shows you the differences between two versions of the page.
cppdev:loadinggameworlds [2017-05-08 12:08] Carsten created, draft |
cppdev:loadinggameworlds [2017-05-09 10:53] (current) Carsten |
||
---|---|---|---|
Line 12: | Line 12: | ||
Also use the class diagram in ''Ca3DE/ClassDiagram.dia'' besides this text for reference. | Also use the class diagram in ''Ca3DE/ClassDiagram.dia'' besides this text for reference. | ||
+ | The server loads a game world by creating a ''CaServerWorldT'' instance which derives from ''Ca3DEWorldT''. | ||
+ | |||
+ | The ''Ca3DEWorldT'''s ''const WorldT* m_World'' member contains the data from the BSP, PVS and Radiosity compile process: for each static entity, it has the BSP tree, a collision model, lightmaps, etc. ( FIXME not only static, but in fact for //all// entities in the cmap? ) | ||
+ | This data is later correlated to (and becomes a component of) the main entity instances ''cf::GameSys::EntityT''. | ||
+ | |||
+ | The ''Ca3DEWorldT'' keeps an instance of a ''cf::UniScriptStateT''. This script state is a Lua instance to which later our objects are bound so that we then can write code such as: | ||
+ | <code lua> | ||
+ | local new_ent = world:new("EntityT", "left_wing") | ||
+ | Door:AddChild(new_ent) | ||
+ | new_ent:GetTransform():set("Origin", 480, -352, 104) | ||
+ | </code> | ||
+ | Note that //both// game entities //and// GUI windows, our two sibling component systems, can be instantiated in the script state of a ''Ca3DEWorldT''. | ||