GizStackGizStack
View .mdOpen in ChatGPTOpen in Claude

gizgame/diorama

Genre-agnostic 3D Real-Earth diorama projection and scene layout for grand strategy, 4X, geopolitics, and airline management. Maps StrategyWorld regions, trade/air routes, and armies/aircraft onto real-Earth 3D coordinates over NOAA ETOPO1 relief and Koppen-Geiger biomes with zero engine duplication.

gizlang
import * as Diorama from "gizgame/diorama";

Types

SettlementNode

gizlang
type SettlementNode = { regionId: i64; factionId: i64; x: f64; z: f64; tier: i64; biome: string; isCapital: bool; isAirlineHub: bool; color: Vec<f64>; troops: i64; }

Visual representation of one region settlement, fortress, or aviation hub in 3D diorama space.

  • regionId: i64
  • factionId: i64
  • x: f64
  • z: f64
  • tier: i64
  • biome: string
  • isCapital: bool
  • isAirlineHub: bool
  • color: Vec<f64>
  • troops: i64

ArcKind

gizlang
type ArcKind = "road" | "trade" | "war" | "air"

Closed union of 3D diorama route arc kinds.

UnitVisualKind

gizlang
type UnitVisualKind = "army" | "caravan" | "airliner"

Closed union of 3D diorama animated unit kinds.

RouteArc

gizlang
type RouteArc = { kind: ArcKind; points: Vec<Point3>; color: Vec<f64>; }

One elevated 3D route arc connecting two regions (trade lane, border road, war front, or air corridor).

  • kind: string
  • points: Vec<gizlang_geometry.Point3>
  • color: Vec<f64>

MovingUnit

gizlang
type MovingUnit = { kind: UnitVisualKind; at: Point3; yaw: f64; color: Vec<f64>; scale: f64; }

One animated 3D miniature unit moving along a route (marching army, caravan, or cruising airliner).

  • kind: string
  • at: gizlang_geometry.Point3
  • yaw: f64
  • color: Vec<f64>
  • scale: f64

DioramaFrame

gizlang
type DioramaFrame = { projection: Projection; settlements: Vec<SettlementNode>; arcs: Vec<RouteArc>; units: Vec<MovingUnit>; }

Complete 3D diorama frame computed deterministically from a GrandEngine state at TIME.

  • projection: M243.Projection
  • settlements: Vec<M220.SettlementNode>
  • arcs: Vec<M220.RouteArc>
  • units: Vec<M220.MovingUnit>

Functions

theaterProjection

gizlang
function theaterProjection(sw: StrategyWorld, targetSpanM: f64 = 380.0): Projection

Computes a theater-centered Projection fitting all regions of SW into a navigable 3D world span (meters).

Effects: fail, read.

regionXZ

gizlang
function regionXZ(proj: Projection, lat: f64, lon: f64): Point3

Projects a region's WGS84 coordinates into 3D theater (X, Z) meters.

dioramaFrame

gizlang
function dioramaFrame(engine: GrandEngine, proj: Projection, groundY: (x: f64, z: f64) => f64, time: f64): DioramaFrame

Builds a deterministic 3D DioramaFrame (settlements, elevated route/war/air arcs, and moving 3D units).

Effects: fail, read, write, console, io, alloc.