using Godot; namespace IslaApocalypse.Core { public static class Constants { // Chunk Dimensions public const int CHUNK_SIZE_X = 24; public const int CHUNK_SIZE_Z = 24; public const int CHUNK_HEIGHT = 256; // Our agreed-upon depth! // World Generation public const float ISO_LEVEL = 0.0f; // The threshold for Marching Cubes public const float VOXEL_SCALE = 1.0f; // 1 Pixel = 1 Meter // --- APPEARANCE TUNING --------------------------------------------- // How many metres it takes for one surface material to fade into the // next (grass -> dirt -> stone) on the rendered mesh. // // TUNE THIS BY EYE: bigger = softer, more gradual fade. // 0.0 = hard switch, exactly like the old banded look // 2.0 = default, a gentle two-metre blend // 4.0+ = very soft, materials smear into each other // // Colour only. This does NOT affect terrain shape, collision, or what // block is actually stored in a voxel. public const float BLEND_BAND_METERS = 2.0f; // --- ROAD CHARACTER BY TIER (D-022) --------------------------------- // A road is carved to match how BUILT it is. One gradient, four steps: // a highway is engineered, a trail is a footpath worn into the ground. // // Three knobs per tier: // RoadRadius - half-width of the flat carriageway, in metres. // ShoulderRadius - how far out the carve eases back to natural // ground. Must always be LARGER than RoadRadius. // GradeSmoothing - 0.0 hugs the land (follows every bump) // 1.0 holds a grade (straight ramp between path // points, cutting bumps and filling dips). // SurfaceMaterial- what the carriageway is paved with. // // TUNE THESE BY EYE. They are starting values chosen to make the // hierarchy visible, not final ones. A trail being bumpy is CORRECT — // nobody drives a truck down a footpath. // // NOTE: these affect road ELEVATION (terrain shape) and paint, not the // terrain noise. Tune the highway properly once vehicles can drive it. public const float HIGHWAY_ROAD_RADIUS = 4.0f; // 8 m carriageway public const float HIGHWAY_SHOULDER_RADIUS = 12.0f; public const float HIGHWAY_GRADE_SMOOTHING = 1.0f; // fully engineered public const float BRANCH_ROAD_RADIUS = 3.0f; public const float BRANCH_SHOULDER_RADIUS = 9.0f; public const float BRANCH_GRADE_SMOOTHING = 0.7f; public const float RUGGED_ROAD_RADIUS = 2.0f; public const float RUGGED_SHOULDER_RADIUS = 6.0f; public const float RUGGED_GRADE_SMOOTHING = 0.4f; public const float TRAIL_ROAD_RADIUS = 1.5f; public const float TRAIL_SHOULDER_RADIUS = 4.0f; public const float TRAIL_GRADE_SMOOTHING = 0.1f; // barely built at all /// /// The widest reach any road has. The per-chunk road cull pads by this /// (plus a margin) so a road just outside a chunk still carves into it. /// Computed from the values above, so raising a shoulder can never /// silently outgrow the cull and truncate roads at chunk edges. /// public static readonly float MAX_SHOULDER_RADIUS = Mathf.Max( Mathf.Max(HIGHWAY_SHOULDER_RADIUS, BRANCH_SHOULDER_RADIUS), Mathf.Max(RUGGED_SHOULDER_RADIUS, TRAIL_SHOULDER_RADIUS)); /// Safety margin added to the road cull, in metres. public const float ROAD_CULL_MARGIN = 3.0f; // --- WATER AT REST (terrain-water task 13) -------------------------- // The blueprint has carried water since task 03; this is only about // DRAWING it. Water is a flat sheet at the body's own surface level — // no waves, no flow, no animation. Those are C2+. /// /// Sentinel in ChunkData.WaterSurfaceY for "this column has no water". /// Real surface heights are always >= 2 (the terrain clamp's floor), so a /// negative value is unambiguous. /// public const float NO_WATER = -1.0f; /// /// Raw blueprint height -> world metres. One raw unit is this many metres, /// and it is exactly the terrain mapping (CHUNK_HEIGHT - 5), named so the /// water surface and the seabed cannot drift apart if the band is retuned. /// public const float HEIGHT_SCALE = CHUNK_HEIGHT - 5; // Depth shading. Depth is measured from the BLUEPRINT heights, not the // rendered geometry: the terrain render clamps its floor at Y=2, so deep // ocean would otherwise all read as one flat ~36 m and the gradient would // die exactly where the ocean gets interesting. public const float WATER_DEEP_METERS = 60.0f; // depth at which the gradient bottoms out public static readonly Color WATER_SHALLOW = new Color(0.38f, 0.76f, 0.78f); public static readonly Color WATER_DEEP = new Color(0.05f, 0.17f, 0.42f); /// /// Water alpha, shallow -> deep. Shallows are clearer, so the shelved coast /// and the seabed under it stay readable; depth closes the surface up. /// public const float WATER_ALPHA_SHALLOW = 0.62f; public const float WATER_ALPHA_DEEP = 0.97f; /// /// Looks up the carve settings for a road tier. One place to tune. /// public static RoadProfile GetRoadProfile(RoadTier tier) { switch (tier) { case RoadTier.Highway: return new RoadProfile(HIGHWAY_ROAD_RADIUS, HIGHWAY_SHOULDER_RADIUS, HIGHWAY_GRADE_SMOOTHING, BlockRegistry.ASPHALT); case RoadTier.Branch: return new RoadProfile(BRANCH_ROAD_RADIUS, BRANCH_SHOULDER_RADIUS, BRANCH_GRADE_SMOOTHING, BlockRegistry.ASPHALT); case RoadTier.Rugged: return new RoadProfile(RUGGED_ROAD_RADIUS, RUGGED_SHOULDER_RADIUS, RUGGED_GRADE_SMOOTHING, BlockRegistry.DIRT); default: // Trail return new RoadProfile(TRAIL_ROAD_RADIUS, TRAIL_SHOULDER_RADIUS, TRAIL_GRADE_SMOOTHING, BlockRegistry.DIRT); } } } /// /// How one tier of road is carved. Values come from Constants above. /// public struct RoadProfile { public float RoadRadius; public float ShoulderRadius; public float GradeSmoothing; public byte SurfaceMaterial; public RoadProfile(float roadRadius, float shoulderRadius, float gradeSmoothing, byte surfaceMaterial) { RoadRadius = roadRadius; ShoulderRadius = shoulderRadius; GradeSmoothing = gradeSmoothing; SurfaceMaterial = surfaceMaterial; } } }