Dyson Energy Incremental — Modular Space Sim & PWA Game (v1.8.0)
Full-scale idle strategy game from biomass to a Kardashev Type II Dyson Sphere: zero-framework reactive ES6 architecture, Web Worker engine, procedural 2D Canvas, and Web Audio synthesizer.
- Role
- Game Designer, Systems Architect & Frontend Software Engineer
- Material / Stack
- Vanilla ES6+ · Pub/Sub EventBus · Web Worker · HTML5 2D Canvas · Web Audio API · PWA
- Process / Engineering
- Exponential economy balancing, modular ESM refactor, anti-exploit audit & offline PWA
Tools
Deliverables
Installable multi-profile PWA, decoupled game engine, automation suite & live browser build
34 / 8,011
Source Files & LOC
Vanilla HTML5, CSS3 (100dvh), and ES6 with zero external runtime deps
11 · 36 · 5
Generators · R&D · Dyson Phases
Plus 108 sub-calibrations, 9 talents, 4 probe missions & 4 star systems
10 + 60 FPS
Web Worker + High-DPI Canvas
Off-thread simulation immune to tab throttling + Retina 2D rendering
0 Bytes
External Media Assets
Celestial visuals and polyphonic space drone synthesized in real time
LIVE INTERACTIVE RUNTIME (EMBEDDED SANDBOX)
Visual Documentation & Diagrams
01 / Brief & Challenge
Engineer a deep multi-layer idle strategy game with exponential progression, smooth celestial visuals, and atmospheric audio without heavy engines (Unity/Phaser) or UI frameworks—while preventing mobile tab throttling from freezing resource ticks and supporting both offline PWA mode and local file:// execution.
02 / Engineering & Process
Architected a modular ES6 codebase driven by a Pub/Sub EventBus decoupling 8 balance data modules, the core simulation state (gameState.js, 1,395 LOC), and 11 reactive UI views. A dedicated Web Worker runs off-thread logic ticks (10 FPS), CanvasEngine renders High-DPI multi-star Dyson visuals at 60 FPS, and SoundEngine synthesizes live polyphonic ambient music via Web Audio API.
03 / Outcome & Impact
Production-ready digital product (v1.8.0) running at $0/mo client-side hosting cost with full offline PWA support, 4 visual themes, 4 scientific notations, JSON save portability, and verified late-game balance & anti-exploit guards. Playable directly on this page or inside the Sandbox Lab.
04 / TECHNICAL ARCHITECTURE & SUBSYSTEMS
Reactive State Engine & Pub/Sub EventBus
Strict separation between simulation state (gameState.js) and DOM views. Purchases, R&D unlocks, prestiges, and star jumps emit scoped events (generator:bought, research:unlocked, dyson:phase_built) so only impacted views update.
Off-Thread Web Worker Tick Engine
tickWorker.js executes precise 100ms logic ticks (10 FPS) off the main UI thread, preventing mobile browsers from throttling energy/RP production in background tabs, with automatic fallback to a requestAnimationFrame accumulator.
High-DPI Procedural Multi-Star 2D Canvas
CanvasEngine handles Retina devicePixelRatio scaling and automatic ResizeObserver layout. dysonCanvas.js procedurally renders 4 distinct stellar bodies (Sol flares, Proxima Red Dwarf, Pulsar relativistic jets, Black Hole accretion disk) evolving across all 5 Dyson Sphere phases.
Zero-Asset Web Audio Synth & AI Voice
Zero MP3 or WAV files: audio.js synthesizes a real-time polyphonic ambient space drone using harmonic oscillators swept by an LFO lowpass filter (0.08 Hz), alongside critical-hit SFX, purchase chimes, SpeechSynthesis alerts, and mobile haptics.
Dynamic Space Events, Thermal Overclock & Minigame
events.js orchestrates Solar Storms, Meteor Showers, Alien Signals, and clickable floating anomalies. Features an Overclock heat-management loop with thermal lockout paired with the Harmonic Resonance oscillating-needle minigame (5x burst + rapid cooling).
Automation Suite, Balance Audit & Offline PWA
Includes autobuyer (with talent cost discount), heuristic auto-researcher, auto-shield, and threshold auto-prestige. Supports 4 color themes, 4 number notations, JSON save export/import, self-purging PWA Service Worker, and standalone build_bundle.py compilation.
05 / SYSTEMS DESIGN & PROGRESSION ECONOMY
| Layer / System | Scope / Scale | Resource / Mechanic | Gameplay Impact |
|---|---|---|---|
| Base Generation | 11 Tiers (1.15x cost) | Biomass (0.5 J/s) → Dyson Sphere (1B J/s) | Tiered automation constrained by Battery cap plus manual IMPULSO click (10x crits + Kinetic Resonance). |
| R&D Tech Tree | 36 Nodes + 108 Sub-levels | 6 R&D Labs (0.5 → 25,000 RP/s) + Overclock I–XX | Unlocks generators, +100% Overclock, and 3 fractional micro-calibrations per node (+RP, +J/s, +Click). |
| Dyson Megaproject | 5 Orbital Phases | 5B J / 500K RP → 10T J / 200M RP | Cumulative global multipliers from 2x up to 25x with live structural evolution on the 2D Canvas. |
| Space Probes | 4 Expeditions | Asteroid Belt (45s) → Oort Cloud (600s) | Timed deep-space missions yielding Energy, up to 40M RP, Quantum Plasma, Dark Matter & Stardust. |
| Quantum & Dark Matter | 4 Quantum · 4 Persistent Upgrades | 15 Achievements + 3 Challenges + 5 Titles | Strategic Quantum reset loops plus permanent Dark Matter unlocks (Auto-Buyer AI & 100% Offline). |
| Star Travel & Talents | 4 Star Systems · 9 Talents (3 Branches) | Sol (1x) → Proxima (2.5x) → Pulsar (10x) → Black Hole (50x) | Industrial, Scientific, and Quantum branches powered by Stardust with anti-exploit discovery tracking. |
06 / MODULAR SOURCE CODE MAP
| Module / Path | Architectural Role | Implementation & Detail |
|---|---|---|
| js/gameState.js | Simulation Core & Persistence | 1,395 LOC: multiplier pipeline, offline simulator (with battery-independent RP), multi-profile saves, JSON import/export & event emission. |
| js/data/*.js (8 módulos) | Domain-Separated Balance Config | generators.js, research.js, dysonPhases.js, prestige.js, starSystems.js, talents.js, probes.js, and achievements.js aggregated by config.js. |
| js/ui/components/*.js (11 vistas) | Framework-Free Reactive UI Views | ResourceBar, GeneratorsView, ResearchView, DysonMegaView, TalentsView, ProbesView, QuantumView, DarkMatterView, StarTravelView, OverclockView & ModalManager. |
| js/workers/tickWorker.js | Background Timing Worker | Dedicated 100ms (10 FPS) off-thread loop preventing progress stalls in inactive desktop or mobile tabs. |
| js/canvas/ + dysonCanvas.js + researchCanvas.js | 60 FPS Procedural 2D Rendering | CanvasEngine base class with High-DPI devicePixelRatio scaling, ResizeObserver, and 4 animated stellar environments. |
| js/audio.js & js/events.js | Web Audio Synth & Dynamic Events | Procedural polyphonic space drone, zero-asset SFX, AI speech alerts, solar storms, meteors, and Harmonic Resonance minigame. |
| sw.js + manifest.json + build_bundle.py | PWA Packaging & Standalone Bundler | Network-First Service Worker precaching 34 assets, automated version cache busting, and Python bundler emitting file://-safe bundle.js. |
07 / RELEASE EVOLUTION & ENGINEERING AUDIT
Full Progression Audit, Evolutionary R&D Labs & Anti-Exploit Patch
- Added 5 evolutionary R&D Lab tiers (Photonic, Cryogenic, Collider, Orbital, Matrioshka Brain) scaling base research generation up to 25,000 RP/s.
- Implemented anti-exploit interstellar discovery tracking (discoveredStarSystems) granting Stardust strictly on first visit per star system.
- Decoupled offline RP accumulation from battery storage cap and wired autobuyer_boost talent for per-level batch purchase discounts.
- Rebalanced Space Probes with up to 40M RP late-game rewards and calibrated Kinetic Resonance (+0.1% per tap).
5-Phase Dyson Megaproject, Talent Tree, Probes & Multi-Star Canvas
- 5-phase Dyson Sphere megaproject construction reflected dynamically in the 2D Canvas renderer.
- 3-branch Commander Talent Tree and automated Space Probes & Asteroid Mining expeditions.
- Overclock Harmonic Resonance minigame (5x burst), 10x critical clicks, 4 UI themes, 4 number notations, and Web Audio space drone synth.
Initialization Resilience, JSON Save Portability & PWA Stability
- Added JSON save backup/restore and resolved onboarding modal reload freeze.
- Eliminated Service Worker controllerchange reload loops and added standalone bundle.js for zero-CORS local execution.
ES6 Modular Refactor, Reactive EventBus & Web Worker Engine
- Migrated legacy global script into modular ESM architecture (js/data/, js/ui/components/, js/utils/EventBus.js).
- Introduced tickWorker.js (10 FPS) and High-DPI CanvasEngine abstraction.