BioSim Next-Gen Architecture

This document describes the technical architecture and subsystems of the BioSim Next-Gen interactive biological life support simulator.


🏗️ System Architecture

The simulation is designed entirely as a client-side web application, utilizing standard web technologies to achieve high-fidelity rendering, telemetry visualization, and interaction.

+--------------------------------------------------------------+
|                         Web Browser                          |
+--------------------------------------------------------------+
                               |
        +----------------------+----------------------+
        |                      |                      |
        v                      v                      v
+---------------+      +---------------+      +---------------+
|   Three.js    |      | Crew AI Engine|      |  ECLSS Engine |
| 3D Render Loop|      | (Possession)  |      |   Telemetry   |
+---------------+      +---------------+      +---------------+

🛰️ ECLSS Subsystems

The Environmental Control and Life Support System (ECLSS) models several interconnected loops:

1. Atmosphere Loop

2. Water & Nutrition Loop

3. Crew Physiology


👾 Crew Archetypes & Possession

The simulation features an interactive crew selection overlay at launch. Users can set the crew size and select an archetype configuration:

Possession Mode

By entering first-person mode, the user possesses a crew member’s viewpoint inside the 3D grid layout, allowing direct interaction with specific room consoles.


⚠️ Malfunction Injector

To test system resilience, the malfunction injector inserts simulated hazards:


🛠️ Technical Stack & Modules

The client-side simulation is composed of several modular scripts that coordinate rendering, audio, and physical modeling:

Module / Script File Path Subsystem Role Key APIs & Libraries
3D Rendering js/three_habitat.js Draws the pressure vessel, ribs, solar panels, and astronaut meshes. Three.js (WebGL), OrbitControls, ACESFilmicToneMapping
Simulation Engine js/blss_engine.js Models atmospheric loops, algae PBR, and metabolic decay math. Custom state-machine, Delta-time loop
Audio Synthesizer js/audio_engine.js Generates keyboard clicks, background engine hums, and malfunction sirens. Web Audio API (Oscillators, GainNodes, BiquadFilters)
Possession / FPS js/fps_controller.js Locks camera into astronaut perspective and handles WASD keys. Pointer Lock API, KeyboardEvents
Crew Mind Engine js/agent_mind.js Simulates crew conversations and latency CAPCOM responses. Fictional prompt simulator, queue system
Application Coordinator js/app.js Binds user click handlers, time speed dials, overlay states, and themes. EventListeners, DOM API