World Loading

GEWorldRuntime picks a format; GETerrainRenderer turns it into draw calls.

Load Path (GalaxyEggbertCnaGame::LoadContent)

worldRuntime_.LoadFromVwrFile("worlds3d/world001.vwr");   // the only path used today
terrainRenderer_ = GETerrainRenderer(worldRuntime_.GetWorld(), tileAtlas);

LoadFromMobileEggbertFile(path) exists as a secondary/reference method on the same class but is not called from GalaxyEggbertCnaGame today.

LoadFromVwrFile(path)

bool GEWorldRuntime::LoadFromVwrFile(const std::string& path) {
    try {
        world_ = std::make_unique<Worlds::World>(Worlds::World::loadFromFile(path));
    } catch (...) {
        return false;   // prior world (if any) is left untouched
    }
    spawnTileX_ = spawnTileZ_ = 0;
    skyRegion_ = 0;
    bigDecor_.clear();
    return true;
}

Delegates entirely to World::loadFromFile() / Chunk::read() — see VWR Format for the binary layout. Because .vwr carries no spawn/sky-region header, those fields are simply reset to defaults.

LoadFromMobileEggbertFile(path) (secondary path, not wired into CNA's game loop yet)

  1. HeaderblupiPos=, region= key/value pairs.
  2. Decor section — 100×100 tile IDs, one row per line; each converted via BlockTypes::fromMobileIconId(id) and placed at Y=0 (inherently flat).
  3. BigDecor section — a second 100×100 background layer; parsed and stored in bigDecor_ but not rendered anywhere.
  4. MoveObject entries — object placements; not currently parsed by this method for CNA.

GETerrainRenderer Construction

GETerrainRenderer(world, tileAtlas):
  for x, y, z in world.blocksPerAxis()³:
      block = world.getBlock(x, y, z)
      if block.isAir(): continue
      worldX = x - kWorldCenterX;  worldZ = z - kWorldCenterZ
      if BlockTypes::tileAnimBase(block.type()) is animated:
          m_animBlocks.push_back({worldX, y, worldZ, baseIcon})
      else:
          cubeBatch.Add(Cube(worldX, y, worldZ), tileAtlas.GetTileUv(block.type()))
  staticMesh = Easy3D::BuildCubeMesh(cubeBatch)
  staticRenderer = Easy3D::CubeMeshRenderer(device, staticMesh)

See GETerrainRenderer and Rendering for the animated-tile mesh rebuild logic.

What's Not Wired Up