Stands up the CODE_REPO the rewrite is written into (D-049, D-058). Godot 4.7.2 /
.NET 8 / Godot.NET.Sdk 4.7.2. Nothing is generated, meshed, or ported — this is the
shell and the two data contracts.
Four layers, each with its boundary stated in a directory README:
Core/ math + data only, and engine-free — depends on nothing above it
Server/ authoritative logic (empty this phase)
Client/ rendering (empty this phase)
Tools/ the offline generator — may NOT reference Client (Phase 1 fills it)
Contracts (compiling stubs, no algorithms):
- Column model (D-053): a 2D grid of columns, each a stack of (material, thickness)
runs, any material at any depth. Air is the TOP RUN — there is no air-vs-solid
height branch, and no surface-height accessor exists to reintroduce one. Water is
not a band; it stays an overlay.
- Material schemas (D-054): terrain and building as two append-only registries,
bridged by a recipe seam that is deliberately EMPTY. Identity is a registry key,
never a serialized ordinal. Mesh style is per-ORIGIN and is not a material field.
Rails, so Phase 1 inherits them rather than rediscovering them:
- GenerationScale: MapSize is a parameter, everything derives from it, nothing uses
a raw pixel number. Tightening over the reference — decorrelation offsets are
declared in map widths, not pixels (chat1/00 §4.2).
- ToolingPaths: config/blueprint/output paths all env-overridable, resolved in one
place, so a batch cannot touch the developer's live files.
- FileSafety: the permanent no-deletion rules as throws rather than sentences.
user:// isolation: project name and use_custom_user_dir both pin the runtime dir to
~/.local/share/islaApocalypse-v2/, away from the old prototype's preserved seeds and
batches. Tools/Scenes/UserDirProbe.tscn confirms it rather than assuming it.
54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
using System;
|
|
|
|
namespace IslaApocalypse.Core
|
|
{
|
|
/// <summary>
|
|
/// The world as a 2D GRID OF COLUMNS — one per horizontal cell.
|
|
/// → `Design - Data - Column Model.md`, D-053.
|
|
///
|
|
/// The grid is square and its side is a GENERATION PARAMETER, never a constant. It is carried
|
|
/// as a <see cref="GenerationScale"/> so that every derived distance in the project is forced
|
|
/// through the one scaling rule. → `Design - Tooling - Scaling Discipline.md`.
|
|
///
|
|
/// ⚠ SHAPE ONLY, PHASE 0. Chunking for streaming, region files, serialization and the mesher
|
|
/// interface are all later phases. A flat array is the honest Phase 0 representation: it says
|
|
/// "grid of columns" and commits to nothing about how it will be paged.
|
|
///
|
|
/// ⚠ NOTHING ABOUT WATER LIVES HERE. Water is an overlay over the grid, not a layer in it.
|
|
/// </summary>
|
|
public sealed class ColumnGrid
|
|
{
|
|
private readonly Column[] _columns;
|
|
|
|
/// <summary>The scale this world was generated at. Side length, scale factor, derived distances.</summary>
|
|
public GenerationScale Scale { get; }
|
|
|
|
/// <summary>Grid side in columns. 1 column = 1 metre (D-002, 1:1 scale).</summary>
|
|
public int Side => Scale.MapSize;
|
|
|
|
public ColumnGrid(GenerationScale scale)
|
|
{
|
|
Scale = scale;
|
|
_columns = new Column[(long)scale.MapSize * scale.MapSize <= int.MaxValue
|
|
? scale.MapSize * scale.MapSize
|
|
: throw new ArgumentOutOfRangeException(nameof(scale), scale.MapSize,
|
|
"MapSize squared exceeds a single flat array. Chunked storage is a later phase — see the class comment.")];
|
|
}
|
|
|
|
/// <summary>The column at (x, y). Null until one is placed — Phase 0 allocates no columns.</summary>
|
|
public Column this[int x, int y]
|
|
{
|
|
get => _columns[Index(x, y)];
|
|
set => _columns[Index(x, y)] = value;
|
|
}
|
|
|
|
private int Index(int x, int y)
|
|
{
|
|
if ((uint)x >= (uint)Side) throw new ArgumentOutOfRangeException(nameof(x), x, $"x outside [0,{Side}).");
|
|
if ((uint)y >= (uint)Side) throw new ArgumentOutOfRangeException(nameof(y), y, $"y outside [0,{Side}).");
|
|
return y * Side + x;
|
|
}
|
|
|
|
public override string ToString() => $"ColumnGrid({Side}x{Side})";
|
|
}
|
|
}
|