How achimala/thelongsilence works
Purpose and Runtime
THE LONG SILENCE is a browser-based procedural space-exploration game. It runs as a Vite-built WebGL2 application, with procedural geometry, hand-written GLSL, and WebAudio rather than authored runtime content. Browser startup flows from index.html to src/main.js; deployment is static-oriented, with Cloudflare configuration in wrangler.jsonc.
Application Composition
src/main.js assembles the runtime. src/core/Engine.js owns the Three/WebGL renderer, frame loop, dynamic render-scale/quality behavior, and scene-level rendering. src/core/Input.js normalizes desktop and touch controls into gameplay actions. src/game/Game.js is the primary world-state coordinator; src/game/Director.js sequences cinematic or scripted moments.
Flight, Progression, and World-State Control
Gameplay state centers on the player ship, scans, landing, fold travel, map navigation, discoveries, and progression toward the seven Resonators. src/game/Game.js coordinates these systems, while src/game/directives.js, src/game/encounters.js, and src/game/lore.js define authored progression/event content. A floating-origin boundary is fundamental: the ship remains near world origin and distant system objects are transformed relative to it each frame.
Seeded Universe and Spatial Modes
Universe generation is deterministic and seed-driven in src/world/generate.js. Orbital content is split into specialized procedural entities: src/world/Planet.js, src/world/Star.js, src/world/Station.js, src/world/Fleet.js, src/world/Asteroids.js, and src/world/Dust.js. Traffic is clock-derived analytic motion rather than persistent physics simulation, allowing stable positions after time skips and fold jumps.
Landing changes the rendering/world representation: src/world/Surface.js provides close-range radial terrain, while src/world/Planet.js represents worlds from orbit. These modes must share terrain and atmospheric assumptions to avoid discontinuities.
Ship and Shared Construction Kit
src/ship/Ship.js and src/ship/Player.js implement the vessel and flight-facing player representation. The interior/cockpit experience is separately composed through src/ship/Interior.js, src/ship/Cockpit.js, src/ship/HoloMap.js, and src/ship/HoloScreen.js. Shared hard-surface construction and surfacing lives in src/gfx/greeble.js; it underpins the player hull, stations, fleets, and derelicts, establishing a common material/draw-call strategy.
Rendering Pipeline and Performance Boundaries
Rendering features are layered around src/core/Engine.js, src/gfx/PostFX.js, and src/gfx/Sky.js. src/gfx/cubeBake.js bakes procedural planet cubemaps so costly terrain evaluation is not performed per visible pixel each frame. Planet shader implementations are concentrated in src/world/planetBakeShader.js and src/world/planetShaders.js; shared GLSL, including manual logarithmic-depth support, is in src/gfx/glsl/noise.js.
The engine dynamically trades render resolution for frame time, retaining feature parity. Logarithmic depth and floating origin are cross-cutting rendering constraints for all custom materials.
Presentation, Audio, and Asset Pipeline
src/ui/HUD.js and src/ui/Codex.js expose flight state, map/archive information, and discoveries; styling is in src/ui/style.css. Procedural sound is managed by src/audio/Audio.js through browser WebAudio. The notable packaged asset is the baked interior kit at public/models/interior_kit.glb, generated via the Blender/Python pipeline under tools/interior_bake/ and consumed with ship interior assets/material definitions in src/ship/interiorAssets.js and src/ship/interiorMaterials.js.
Main entry points: Game.js Game · Engine.js Engine · main.js Runtime assembly · greeble.js Hard-surface kit
Components 20
Browser Runtime
- Browser entry · Starts the static WebGL2 application.
index.html - Runtime assembly
src/main.js - Engine · Owns renderer, scene rendering, and adaptive render scale.
src/core/Engine.js - Input · Unifies desktop and touch actions.
src/core/Input.js
Gameplay & Universe
- Game · Coordinates flight, scans, landing, travel, discoveries, and progression.
src/game/Game.js - Director
src/game/Director.js - Progression content · Defines directives, encounters, and lore toward the Resonators.
- Seeded universe · Deterministically creates systems from seeds.
src/world/generate.js - Orbital entities · Planets, stars, stations, fleets, asteroids, and dust use analytic motion.
- Surface mode · Close-range landing representation sharing planet assumptions.
src/world/Surface.js
Rendering
- Post processing
src/gfx/PostFX.js - Procedural sky
src/gfx/Sky.js - Planet render pipeline · Bakes terrain cubemaps and applies planet shaders.
- Shared GLSL · Includes noise and manual logarithmic-depth support.
src/gfx/glsl/noise.js
Ship Experience
- Ship and player
- Cockpit interior · Builds cockpit, holomap, and holoscreen experience.
- Hard-surface kit · Shared hull, station, fleet, and derelict surfacing strategy.
src/gfx/greeble.js
Presentation & Assets
- HUD and Codex · Exposes flight state, discoveries, maps, and archive information.
- Procedural audio
src/audio/Audio.js - Interior asset pipeline · Blender/Python output is consumed by interior asset and material definitions.
Connections 24
- Browser entry → Runtime assembly: loads
- Runtime assembly → Engine: creates
- Runtime assembly → Game: assembles
- Runtime assembly → Input: installs
- Input → Game: gameplay actions
- Engine → Game: frame updates
- Game → Director: sequences
- Game → Progression content: evaluates
- Game → Seeded universe: generates
- Seeded universe → Orbital entities: populates
- Game → Surface mode: switches on landing
- Game → Ship and player: controls
- Engine → Orbital entities: renders with floating origin
- Engine → Surface mode: renders
- Engine → Post processing: composites
- Engine → Procedural sky: renders
- Orbital entities → Planet render pipeline: planet visuals
- Planet render pipeline → Shared GLSL: uses
- Hard-surface kit → Ship and player: constructs hull
- Hard-surface kit → Orbital entities: constructs structures
- Interior asset pipeline → Cockpit interior: provides kit
- Cockpit interior → Ship and player: embeds in vessel
- Game → HUD and Codex: publishes state
- Game → Procedural audio: drives sound