Tutorial: Authoring a New .vwr World
Use GenerateSampleWorld3D as a template to build your own hand-authored 3D world.
.txt level into
a .vwr world — this was explicitly rejected as a direction. .vwr
worlds with real Y variation must be hand-authored in code, as shown below.
Step 1 — Study the Existing Generator
tools/GenerateSampleWorld3D.cpp is the only example today. It builds
worlds3d/world001.vwr: a ground floor, a 10-step ascending staircase, a raised
platform, a walled room with a doorway, and two pillars — using only
GalaxyEggbert::Worlds::World::setBlock() calls, then
world.saveToFile(...).
Step 2 — Copy It as a Starting Point
#include "GalaxyEggbert/Worlds/World.hpp"
#include "GalaxyEggbert/BlockTypes.hpp"
using namespace GalaxyEggbert::Worlds;
int main() {
World world;
// Ground floor
for (int x = 30; x < 70; ++x)
for (int z = 30; z < 70; ++z)
world.setBlock(x, 0, z, Block::make(BlockTypes::Ground));
// Add your own shapes here — staircases, platforms, rooms.
world.saveToFile("worlds3d/myworld.vwr");
return 0;
}
Step 3 — Add a CMake Tool Target
Follow the existing GenerateSampleWorld3D target pattern in CMakeLists.txt — it is engine-agnostic and needs no CNA link.
Step 4 — Generate and Point GalaxyEggbertCNA at It
cmake --build build-cna --target GenerateSampleWorld3D
./build-cna/GenerateSampleWorld3D
Then change the path in GalaxyEggbertCnaGame::LoadContent()
(worldRuntime_.LoadFromVwrFile("worlds3d/world001.vwr")) to your new file, or
replace world001.vwr directly.
Step 5 — Verify Block Counts
Use World::loadFromFile() in a small test to round-trip your world and check its
non-air block count and Y range, the same way world001.vwr's stats (2729 blocks,
Y range [0, 13]) were verified.