Inspiration
There are around 470,500 building fires per year in the United States alone, leading to around 2600 deaths. Every building has an evacuation plan on the wall, but facility managers usually only find out where it fails during a real emergency or an expensive drill. We wanted a way to stress-test a building’s evacuation before anyone’s life depends on it.
What it does
Egress simulates a fire anywhere in a building, with realistic human behavior. Most people act predictably: they follow the crowd and head for the exit they came in through. Some panic and move erratically, and some freeze and block hallways. As the fire spreads, Egress tracks where crowds jam, who gets trapped, and how long the evacuation takes. An AI overseer then reads the results, diagnoses the bottlenecks, and proposes building changes like adding an exit or widening a door. Egress also applies the changes and re-runs the exact same fire to prove whether the fix works. Egress also works on any mobile device.
How we built it
The app runs on React, TypeScript, and Vite, with the building, fire and crowd drawn on an HTML Canvas. The simulation is all in TypeScript that runs entirely in the browser. -Egress also works on any mobile device. -Fire spreads cell by cell across a grid. -People move along a flow field, built with a multi-source Dijkstra search from every exit, that recalculates as the fire blocks paths. -Each cell holds one person, so jams form naturally at doors.
An AI overseer built on Gemini with structured outputs reads the results and proposes edits as JSON, which our code validates and snaps onto real walls and doors. A pseudo random number generator lets us re-run the exact same fire after the fix.
Challenges we ran into
Gemini sometimes proposed exits in impossible places. Giving it exact coordinates and validating every edit in code fixed this. We also had to tune the congestion rules until crowds jammed at doors the way real crowds do.
Accomplishments that we're proud of
We are proud of being able to create a fully closed loop: simulating, diagnosing, redesigning, and proving the fix can all happen on the same fire. Additionally, everything runs in the browser with no backend.
What we learned
AI output is only trustworthy when it’s grounded in real numbers and checked by code.
What's next for Egress
Turning a photo of a building's evacuation map into a live simulation, and simulating other disasters such as earthquakes or tornadoes. We also would like to incorporate wheelchair and other assisted evacuations.
Built With
- api
- gemini
- html
- react
- typescript
- vite
