World
From Esenthel
Contents |
Versions
World Data Architecture is split into following versions:
- Edit - This is the version which is used during world editing only (inside World Editor). From this version, Game version will be created.
- Game - This is the version which is used during the actual game. It is created during "building" process inside World Editor.
Each of the versions is stored using separate folders inside of a single World directory.
For example (where "*" stands for the world name) :
- Data\World\*.world\Edit
- Data\World\*.world\Game
For the final release of your game, you do not need to include the Edit version in your game data, only Game version is required.
Area
Each of the versions is split into several Areas.
An Area is a single chunk which you place in the World Editor, by default it is 64x64 meter sized.
In Esenthel Engine SDK (C++), it is known as Game::Area and Edit::Area.
In file hierarchy they are stored in following way (where "x,y" are the coordinates of an area) :
- Data\World\*.world\Edit\Area\x, y
- Data\World\*.world\Game\Area\x, y
Area Data
An area can contain the following data (Game::Area::Data, Edit::Area::Data) :
- terrain (mesh and phys)
- objects
- paths
- grass
- custom data (available for clients with professional license only)
World Management
During the game, once an area is accessed, its memory object (Game::Area) will be created and remain in memory as long as the world is used.
However, because the worlds can be really huge and eat up large amounts of memory, only some of the areas have their data (Game::Area::Data) loaded at a time.
- Center of Action - this is a 3D position where the "action is taking place". This position is manually specified in each game frame by the programmer. According to the position the engine's World Manager can load only selected areas which are located nearest to the center of action position.
- Action Range - this covers the range of how far from the center of action, the area's data should be loaded into memory.
Using Custom Data in Areas
This is the simplified structure of an Area:
struct Game::Area
{
Game::Area::Data *data;
};
Game::Area::Data class is virtual based, which allows to define custom extended structures, like this:
struct CustomGameAreaData : Game::Area::Data
{
CustomData *custom_data;
};
Then using the Game::World methods you can specify that CustomGameAreaData should be used instead of the base Game::Area::Data.
