Zombie Simulation
Agent-based zombie outbreak simulation with emergent horde behavior on HTML Canvas

Overview
A 2D agent-based zombie outbreak simulation on HTML Canvas. Watch Patient Zero spark a slow infection that tips into full apocalypse as emergent hordes form, survivors flee, and buildings become death traps. 300 humans face off against evolving zombie variants — Shamblers, Runners, and Tanks — across a dynamic day/night cycle.
Creating believable emergent behavior from simple rules is the core challenge. Each agent needs to respond to its local environment — fleeing zombies, seeking shelter, forming groups — while the overall simulation produces dramatic, unpredictable outbreak narratives. Performance matters: hundreds of agents with steering forces, spatial lookups, and collision detection must run smoothly at variable speeds.
Built with vanilla TypeScript and HTML Canvas — no frameworks, no game engines. Agents use weighted steering forces (flee, seek, wander, cohesion, separation) with a spatial grid for fast neighbor lookups. Three zombie variants create varied threat dynamics: slow Shamblers form the backbone of hordes, fast Runners create sudden pressure, and large Tanks block escape routes. A day/night cycle shifts every 30 seconds, boosting zombie speed at night and adding atmospheric tension.
The simulation produces compelling emergent narratives — buildings that seem safe become death traps, survivors cluster then scatter, and the infection curve tips from manageable to apocalyptic in seconds. The sparkline population tracker and heatmap overlay give players real-time insight into the outbreak dynamics.
Key Features
Gallery
