How sp5555/simbiosis works
Project type and purpose
• This is a single–page JavaScript application (front-end only) that runs in the browser as a life simulator (“Simbiosis”).
• It contains a simulation core, a rendering engine, user input handling, and GUI/HUD overlays. There is no backend or external service.
File structure
• Top level:
• index.html, main entry point
• package.json / package-lock.json, project metadata
• src/, all application code
• src/app: application bootstrap (app.js)
• src/main.js: the main loop orchestrator
• src/input: gathers user input
• src/simulation: world model, map generator, entity behaviors
• src/renderer: scene construction, mesh managers, animations
• src/gui & src/hud: UI overlays
• src/utils: shared event emitters and helper functions
README for additional insights
• Confirms it’s served as static files, no backend
• Execution order: load index.html → main.js → initialize app → start local HTTP server
a. Main components
1. Browser environment (container)
2. App Bootstrap (src/app/app.js)
3. Input Manager (src/input/input.js)
4. Simulation Engine
– World Model, Map Generator
– Entities & Simulation Loop (src/simulation)
5. Rendering Engine
– Renderer Core, Mesh Managers, Animations, Tile/Vegetation modules
6. GUI Manager (src/gui)
7. HUD Manager (src/hud)
8. Shared Utilities / Event Bus (src/utils)
9. index.html + assets
b. Component relationships & interactions
• Browser loads index.html → app.js
• app.js → initializes main loop in main.js
• main loop cycle:
• Input Manager captures user events → emits events on Event Bus
• Simulation Engine consumes events, updates World Model
• Rendering Engine reads updated World Model → draws scene to WebGL/Canvas
• GUI & HUD Managers subscribe to state/events → update overlays
• Utilities (event-emitters, utils) are used by all modules for decoupled communication
c. Architectural patterns & design principles
• Modular separation: input, simulation, rendering, UI are distinct layers
• Event-driven communication: Event Bus as a pub/sub mechanism
• Main game loop: a central orchestrator (controls simulation and rendering updates)
• Data flow is unidirectional each frame: Input → Simulation → Rendering → GUI/HUD
d. Key technologies & libraries
• Vanilla JavaScript modules (ES6)
• Canvas or WebGL (renderer.js)
• No external frameworks (React, Vue, etc.)
• Simple HTTP server for static file hosting