Energetica v0.9.0

Vaclav Smil's "Energy and Civilization" pushed me to explore how energy flows from the sun through Earth's systems and into human society: something I've been dancing around through my time studying physics and working in the power industry. Energy isn't just another resource but a fundamental constraint that shapes everything from earth processes to societal development.

Energetica attempts to make these energy flows visible and interactive. It's a sandbox where you can watch the earth and human society evolve primarily based on energy flux modeling.

An Aside on the Technology

My passion for Energetica came not only from the intellectual questions about the role of energy flux for human civilization; I was also really excited to see how much simulation could be done in the modern browser environment and on edge devices. Energetica runs entirely in the browser: no cloud computing, just the client device's CPU/GPU. And to keep things lean, almost all of the calculations are custom implemented.

The technology stack levers:

  • WebGL 2.0 for GPU-accelerated rendering of both 2D and 3D views (WebGPU not yet universally available)
  • Pure JavaScript (ES6+) with no framework overhead
  • Web Workers running parallel simulation engines

Systems Modeling

Technical Architecture

The simulation is organized as a set of five coupled but independently running systems. Each major system runs in its own Web Worker. These workers process the world in chunks, communicating through structured messages with the main thread. This architecture keeps the UI responsive while handling millions of calculations per second. The simulation can run at multiple time scales, from paused observation to years passing in seconds.

Modeling Layers

Solar Radiation

Everything starts with the sun. The simulation models daily and seasonal variations in solar intensity based on hard-coded latitude and axial tilt. It calculates Global Tilted Irradiance (GTI) accounting for direct beam radiation, atmospheric scattering, and terrain self-shadowing. This is both visually appealing and important for the simulation: vegetation growth directly depends on photosynthetically active radiation.

Terrain and Hydrology

The terrain system uses a simple deformable height field representation. Water flows follow D8 routing algorithms, creating drainage channels and watersheds (although without "watershed solving" and no erosion/deposition, this is not yet realistic).

Vegetation: Primary Production

Plant life is modeled through Net Primary Productivity (NPP) calculations that convert solar energy into biomass. The system tracks photosynthetic efficiency, water constraints, and competition dynamics.

Population Dynamics

Human agents navigate this landscape as autonomous entities with basic needs and cultural traits. They use A* pathfinding to find water and food, forming clusters near resources. Their success or failure depends entirely on their ability to extract energy from their environment.

Biome Rendering Layer

To help visualize these interacting systems, a biome classification layer interprets the underlying data into recognizable environmental zones: deep oceans, mountains, forests, deserts, etc. This provides an intuitive understanding of the complex interactions between water, elevation, and vegetation.

Thoughts on the Current State of Energetica

Energetica is very much a work in progress, but it already demonstrates the potential for browser-based scientific computing.

The simulation reveals how tightly coupled human development is to energy flows. A slight change in solar input or water distribution can cascade through the system, affecting vegetation patterns, which in turn influence where populations can thrive.

Once WebGPU is supported by Firefox, I plan to push the simulation's scale and fidelity further with investment into parallelizing many of the simulation calculations. Future directions include:

  • Technology trees constrained by energy availability
  • Climate feedback loops and long-term cycles

I am hosting Energetica here. It runs entirely in your browser. Try it out and watch civilizations rise and fall through the fundamental lens of energy.