islaApocalypse/Server
beezm f9ea2da3f4 roads: enable Rugged+Trail carving + per-tier character (D-022)
All four road tiers now carve into the 3D world. Rugged and Trail were
generated, exported and parsed all along, but nothing ever consumed them —
which is why county roads visible on the 2D map did not exist in 3D.

Tier identity is now carried into the carve via a RoadSegment struct, so each
tier gets its own width, shoulder and grade-smoothing from one tunable block in
Constants: highways widest and holding a grade, trails narrow and hugging the
land. Rugged and Trail surface as dirt rather than asphalt.

Because tiers now have different reach, nearest-by-distance was no longer a
sound way to pick the governing road — a nearby footpath could shadow a highway
whose shoulder still covered the column. The carve now considers only roads
whose shoulder actually reaches, and takes the closest of those.

The per-chunk cull pad is derived from the widest shoulder plus a margin, so
widening a road cannot silently truncate it at chunk edges.

Untouched: density field, Marching Cubes interpolation/welding, chunk dims,
the .dat contract, the 2D A* generation, and mesher normals.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 03:53:32 -04:00
..
Scripts roads: enable Rugged+Trail carving + per-tier character (D-022) 2026-08-05 03:53:32 -04:00
README.md baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00

Server Module - IslaApocalypse

Phase 2 Status: Active (Authoritative Chunk Management Online)

Overview

The Server directory contains the authoritative logic for the 3D Voxel Engine. It acts as the bridge between the static 2D WorldBlueprint residing in RAM and the physical 3D environment generated around the player. This architecture ensures that in a future multiplayer environment, the server dictates the terrain and sends chunk data to the clients.

Key Architecture & Components

1. The Authoritative Node (ServerChunkManager.cs)

Attached to the root of the Main.tscn world scene, this script manages the lifecycle of the entire 3D environment.

  • Initialization: Upon boot, it reads the WorldBlueprint and dynamically locates the exact X/Y pixel coordinates of the Capitol city to use as the initial world spawn point.
  • Coordinate Translation: Converts 2D pixel coordinates into 3D chunk grid coordinates (e.g., Map Pixel [2048, 2048] becomes Chunk [64, 64]).
  • Memory Management: Maintains an _activeChunks dictionary to track which chunks are currently loaded in RAM, preventing duplicate generation and allowing for future chunk culling/unloading when the player moves away.

2. Terrain Math & Generation

  • True Vertical Scaling: Height calculation directly multiplies the raw FastNoiseLite float (0.0 to 1.0) against Constants.CHUNK_HEIGHT (256 meters). This avoids heightmap compression and allows for towering, AAA-scale mountain cliffs.
  • Density Calculation: Uses exact surface interpolation to calculate the signed 3D distance of every voxel relative to the surface. This prevents terrain collapsing on horizontal edges and creates mathematically perfect slopes for the Marching Cubes algorithm.
  • Biome Injection: Samples the BiomeMap at the exact X/Z world coordinate to assign a specific BlockID (via BiomePalette) to every voxel in the chunk.

Next Immediate Steps (Phase 2, Step 4)

  • A Road Carving:* The Server Chunk Manager needs to be updated to cross-reference the Highways and BranchRoads vectors from the blueprint. If a chunk contains a road, the server must mathematically flatten the exactSurfaceY and override the BlockID to ASPHALT.