terrain-shapes.ts

Purpose

Defines the master TERRAIN_SHAPES table — geometric/visual parameters for every terrain entity kind (asteroids, city buildings, obsidian pillars). Consumed by terrain generation/spawn code to build polygon, circle, rect, or sprite-based obstacles. Header comment notes this is an exact match of archive 01-config.js TERRAIN_SHAPES.

Exports

interface TerrainShapeDef

FieldTypeNotes
type'polygon' | 'circle' | 'rect' | 'sprite'Rendering/collision primitive
vertsnumberVertex count for polygon edge irregularity
baseRadiusnumberBase size in screen px before scaling
scaleMinnumberLower bound of scale multiplier applied to baseRadius
scaleMaxnumberUpper bound of scale multiplier applied to baseRadius
jitternumberEdge irregularity factor (0 = clean, higher = jagged)
w?numberWidth — rect type only
h?numberHeight — rect type only
spriteId?stringSprite identifier (sprite type)
spriteAspect?numberSprite aspect ratio (sprite type)

const TERRAIN_SHAPES: Record<string, TerrainShapeDef>

Keyed master table of shape definitions.

Entries

Asteroids (polygon)

Collision is circle with radius = baseRadius × scale. Visual polygon matches collision radius. v1.50 balance pass: 50% smaller than original.

KeyvertsbaseRadiusscale rangejitterFinal px range
asteroid_sm5751.0–1.50.2075–112
asteroid_md6851.0–1.60.1885–136
asteroid_lg7981.0–1.60.1598–156
asteroid_xl81001.0–1.80.12100–180
rock_shard5601.0–1.30.2560–78

City buildings (sprite)

4 standard footprints, no scale variance (scaleMin = scaleMax = 1.0), jitter = 0, verts = 4.

KeybaseRadius
building_1x1277
building_2x1322
building_1x2284
building_2x3385
building_sm (legacy alias)277
building_md (legacy alias)322

Obsidian pillars (sprite)

Square-topped columns with gradient fade. 4.8× original size. No scale variance, jitter = 0, verts = 4.

KeybaseRadius
pillar_sm576
pillar_md768
pillar_lg960

Behavioral notes

  • scaleMin/scaleMax multiply baseRadius at generation time to produce per-instance size.
  • jitter only meaningful for polygon type — applied to vertex offsets to randomize edges.
  • All sprite type entries (buildings, pillars) lock scale to 1.0 and jitter to 0 to keep sizes exact/consistent.
  • Building legacy aliases (building_sm, building_md) duplicate building_1x1 and building_2x1 values respectively.

Dependencies

  • Consumed by: terrain generation/spawn modules (callers index TERRAIN_SHAPES[key]).
  • No imports.