Latest version:
Tramway SDK 0.0.9
Github
Quick links
Home
Get Started

WorldCells


Worldcells are the basic streaming unit of the virtual world. Essentially they are a list of entities.

The worldcells also have a volume. All of the entities, whose positions are inside the worldcell's volume are considered to inside the worldcell.

An entity is added to a worldcell if its definition is located in the worldcell's disk file, or if it is created and its position is inside the worldcell's volume or it enters a transition volume leading from one worldcell to another.

All worldcell data files are located in the /data/worldcells/ directory. The file extension is .cell.

Key concepts


Interior

Worldcell volumes are not supposed to overlap. The only exception are interior and exterior worldcells. If an entity's position is both inside an exterior and an interior worldcell, preference will be given to the interior worldcell.

Interior lighting

If a worldcell has its lighting set to be interior, it means that for every entity in that cell the directional lighting will be disabled. This is more of a convention for entity implementation, than something that is forced on entities

Transition

A worldcell transition has a volume, defined by a convex hull wrapped around a set of points, and an originating and a destination worldcell. If an entity is in the originating worldcell and it enters the volume of the tranistion, it will be switched to being in the destination worldcell.

Volume

If a transition has its originating and its destination worldcells set to the same worldcell, then it is considered that the volume of the transition contributes to the volume of the worldcell.

Programming in C++


#include <framework/worldcell.h>
API documentation page.

Loading a worldcell is very simple.

WorldCell* frog_house = WorldCell::Make("pond");

frog_house->LoadFromDisk();
frog_house->Load();

We can also probe entitial contents of the worldcell.

WorldCell* frog_house = WorldCell::Find("pond");

auto entities = frog_house->GetEntities();

for (auto entity : enitities) {
    printf("Entity: %s\n", entity->GetName());
}