docs: bring all READMEs current with actual code (post-sweep-10 truth pass)

Every README was read first, checked against the code in its directory, then
rewritten to describe what the code actually does now.

Corrected throughout: map size is config-driven (8192 default) not a fixed
4096; chunks are 24x24x256 not 32x32; road carving is implemented for all four
tiers, not a 'next step'; Data/ and Resources/ are empty, not populated.

Also fixed MATH_MARCHING_CUBES.md, which documented the density sign convention
exactly backwards — it claimed positive was underground, where the code treats
positive as above the surface and counts a corner inside when density < iso.
Getting that backwards inverts every normal, a bug this project has hit before.

The root README now carries accurate run steps: F5 runs the map generator (not
the game), F6 on Scenes/Main.tscn runs the 3D world, and ChunkRadius is a load
radius that should be dropped to 4-8 while iterating.

Docs only. No code changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stewart Howe 2026-08-05 05:23:58 -04:00
parent f9ea2da3f4
commit d72ffc0183
13 changed files with 579 additions and 409 deletions

View file

@ -1,37 +1,46 @@
# 🌍 /Scenes - The Playable Game
## Overview
This directory contains the core runtime scenes for *Isla Apocalypse*. Unlike the `/Tools` directory, the scenes here are exactly what the end-user (or the Dedicated Server) will run.
**Core Philosophy:** These scenes do **not** generate the world from scratch. They strictly load and interpret the immutable `MapData.dat` blueprint provided by the developers. This ensures lightning-fast server boot times and complete parity between the server and the clients.
---
## 🏗️ Core Scenes
### `Main.tscn` (The Entry Point)
**Status:** In Transition (Prepping for 1:1 Scale Ingestion)
This is the master root scene. Currently, it acts as the Dedicated Server environment, responsible for reading the 2D blueprint and translating it into a physical 3D voxel world using the `ServerChunkManager`.
#### ⚔️ The Great 4096 Struggle (The 3D Ramifications)
Our decision to upgrade the master blueprint from 1024x1024 to a massive 4096x4096 (1:1 scale) fundamentally changed how `Main.tscn` must operate.
While the 2D generator struggled with math and UI layouts, the 3D server must now deal with **Memory Management**.
* **The Scale Shift:** In the old 1024 version, 1 data pixel equaled 4 meters of 3D space. Now, 1 pixel = 1 meter. This perfectly accommodates human-scale base building (like *7 Days to Die*), but it means the total data footprint of the world is 16 times larger.
* **The Chunking Mandate:** `Main.tscn` can no longer afford to load the entire map into RAM at startup. The `ServerChunkManager` must operate strictly on a localized, dynamic grid—only loading the 1-meter chunks immediately surrounding active players.
#### 🛡️ The Arsenal is Ready
Despite the massive scale increase, `Main.tscn` is structurally prepared for the 4096 blueprint thanks to heavy engine optimizations built during Phase 1:
1. **The EdgeKey Welder:** Completely eliminates floating-point drift and mesh seams across the new high-density chunk borders.
2. **Analytical Normals:** Bypasses Godot's slow native normal calculation, using mathematical gradients to light the massive 1:1 voxel world instantly.
3. **The +1 Border Fix:** Chunk arrays are padded by exactly 1 unit to flawlessly sample neighbor data without requiring expensive cross-chunk blurring.
---
## 🚀 The Immediate Roadmap
When Phase 2 resumes, `Main.tscn` will undergo the following upgrades to ingest the new 4096 map:
1. **Re-syncing the Parser:** Uncommenting the Logistical Network logic in `MapDataParser.cs` so the server can read the newly fixed roads and towns.
2. **Dynamic Chunk Loading:** Scrapping the hardcoded `10x10` test grid in favor of a proximity-based chunk loader.
3. **Terrain Flattening:** Implementing logic for the voxel engine to read the road and town data and automatically flatten the 3D terrain beneath them.
# /Scenes — the runtime scenes
Unlike `/Tools`, these are what actually runs the game. They **do not generate the world** — they
load and interpret an existing `.dat` blueprint.
## `Main.tscn` — the 3D world
| Node | What it is |
|---|---|
| `World` (`Node3D`) | Root. Carries `ServerChunkManager.cs` — this is what builds the world. |
| `Camera3D` | Child of `World`. The server teleports it above the Capitol at startup. |
| `DirectionalLight3D` | Sunlight. |
| `WorldEnvironment` | Ambient light. |
### Running it
**Open this scene and press F6** (*Run Current Scene*).
⚠ **Do not press F5.** The project's main scene is the 2D map generator, not this — F5 regenerates
the whole world and overwrites your `.dat`.
At boot the manager reads `ServerConfig.json`, loads `MapData_Seed_<WorldSeed>.dat` from `user://`,
finds the Capitol, and builds a `(2 × ChunkRadius)²` grid of chunks around it. **Set `ChunkRadius` to
4–8 first** unless you specifically want the full 4,096-chunk, ~3.6 GB boot.
If the seed in `ServerConfig.json` doesn't match an existing `.dat`, the load fails and you get an
empty scene.
### Two things that will confuse you
- **The camera cannot be moved at runtime.** There is no camera controller and no input handling
anywhere in the codebase. The server overrides whatever transform you save here, placing the camera
above the Capitol looking straight down — which is also a degenerate `LookAt`, so its roll is
arbitrary and Godot logs a warning. To view from elsewhere you have to edit the teleport code.
- **Moving the `World` node moves the entire world.** Chunks are added as its children, so a stray
drag in the editor offsets all rendered terrain. If everything looks displaced, check `World`'s
transform is zeroed.
## `MapCaptureTool.tscn`
A `SubViewportContainer` wrapping `Tools/Scenes/MapPreview.tscn` at 4096×4096. It exists so the map
can be rendered offscreen at full resolution regardless of monitor size. Only needed for the PNG
snapshot path — `MapPreview.tscn` generates the `.dat` on its own.
## Not here yet
No player scene, no UI, no menu. `Main.tscn` is currently a viewer, not a game.