Files
TheriapolisV3/Theriapolis.Core/World/WorldTile.cs
T
Christopher Wiebe b451f83174 Initial commit: Theriapolis baseline at port/godot branch point
Captures the pre-Godot-port state of the codebase. This is the rollback
anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md).
All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 20:40:51 -07:00

87 lines
2.4 KiB
C#

namespace Theriapolis.Core.World;
/// <summary>
/// Per-tile data for a single world tile (1/1024 of the continent's width).
/// All float fields are normalized to [0, 1] unless noted.
/// </summary>
public struct WorldTile
{
public float Elevation; // 0 = sea floor, 1 = mountain peak
public float Moisture; // 0 = arid, 1 = saturated
public float Temperature; // 0 = polar, 1 = equatorial
public BiomeId Biome;
public FeatureFlags Features;
/// <summary>Macro-grid cell index (x + y*32) for this tile.</summary>
public byte MacroX;
public byte MacroY;
// ── Phase 2+3 additions ──────────────────────────────────────────────────
/// <summary>
/// Direction (Dir.N..Dir.NW, or Dir.None) that a river polyline flows through this tile.
/// Set by HydrologyGenStage when rasterizing river polylines.
/// </summary>
public byte RiverFlowDir;
/// <summary>
/// Direction (Dir.N..Dir.NW, or Dir.None) that a rail polyline passes through this tile.
/// Set by RailNetworkGenStage when rasterizing rail polylines.
/// </summary>
public byte RailDir;
/// <summary>
/// Settlement ID (1-based) of the settlement whose footprint covers this tile.
/// 0 = no settlement.
/// </summary>
public ushort SettlementId;
}
/// <summary>
/// Biome identifiers. Enums, not magic ints.
/// </summary>
public enum BiomeId : byte
{
None = 0,
Ocean,
Tundra,
Boreal,
TemperateDeciduous,
TemperateGrassland,
MountainAlpine,
MountainForested,
SubtropicalForest,
Wetland,
Coastal,
RiverValley,
Scrubland,
DesertCold,
// Transition biomes (assigned by BorderDistortionGen)
ForestEdge,
Foothills,
MarshEdge,
Beach,
Cliff,
TidalFlat,
Mangrove,
}
/// <summary>
/// Bitmask of linear and special features on a tile.
/// Per-tile flags are derived caches — polylines are the source of truth for rivers/roads/rail.
/// </summary>
[Flags]
public enum FeatureFlags : ushort
{
None = 0,
HasRiver = 1 << 0,
HasRoad = 1 << 1,
HasRail = 1 << 2,
IsSettlement = 1 << 3,
IsPoi = 1 << 4,
IsCoast = 1 << 5,
IsBorder = 1 << 6, // biome or land/ocean border (set during distortion pass)
RiverAdjacent = 1 << 7,
RailroadAdjacent = 1 << 8,
}