A data-driven incremental game engine built with vanilla JavaScript. The system features a multi-age progression loop, achievement-based multipliers, and a Big Bang prestige mechanic.
Check out this site live at: GitHub Pages or Play on itch.io!
The engine is designed using a State-Logic-View separation. This architecture makes the logic easily portable to professional game engines like Unity (C#) or Godot (GDScript).
- Data Layer: All game balance (Ages, Upgrades, Milestones) is stored in static configuration objects.
-
Logic Layer: Handles income calculations, scaling math (
$1.15^n$ ), and prestige formulas. - View Layer: A decoupled UI system that maps game state to the DOM via an element map.
The game progresses through 5 distinct eras:
- Stone Age (Food)
- Classical Age (Olives)
- Medieval Age (Gold)
- Industrial Age (Coal)
- Future Age (Credits)
Milestones track specific upgrade counts. Unlocking a milestone grants a permanent, multiplicative boost to the global production rate.
Upon reaching the Future Age, players can trigger a Singularity.
- Shards: Granted based on the square root of lifetime earnings.
- Multipliers: Each shard provides a permanent 10% boost to all future production.
The engine uses exponential cost scaling to ensure long-term stability:
- Upgrade Cost:
BaseCost * (1.15 ^ CurrentCount) - Prestige Formula:
floor(sqrt(LifetimeEarnings / 1,000,000))
A robust logarithmic formatter handles values up to Decillions (10^33) and automatically switches to scientific notation beyond that point to prevent UI overflow.
Game state is preserved using localStorage.
- Auto-save: Triggered every 30 seconds.
- Manual-save: Triggered on every significant player action (Buying, Evolving, Prestige).
- Clone the repository.
- Ensure
game.js,style.css, andindex.htmlare in the same directory. - The engine initializes via the
loadGame()bootstrap function at the bottom of the script.
To port this engine:
- Map the 10Hz
setIntervalto the engine'sProcessorUpdateloop. - Replace the
elsobject with UI Canvas references.
This project is licensed under the MIT License.
You are free to use, modify, and distribute this software with proper attribution.
See the LICENSE file for full details.
