Skip to content

This is a simulation of fire spread using PyGame. Users can create unique environments by drawing on roads, rivers, housing, and grass. This allows for communities to understand vulnerabilities in their fire safety. This project was created in 24 hours at TriValleyHacks with Emilio Lim, Arhum Khan, and Sunny Jayaram.

Notifications You must be signed in to change notification settings

BryanTurns/fire-sim

Repository files navigation

fire-sim

This is a simulation of fire spread using PyGame. Users can create unique environments by drawing on roads, rivers, housing, and grass. This allows for communities to understand vulnerabilities in their fire safety. This project was created in 24 hours at TriValleyHacks with Emilio Lim, Arhum Khan, and Sunny Jayaram.

How to run fire-sim

Clone the repository and then run the command pip install -r requirements.txt. This will install all the needed dependancies to run the project. Once this is done you can start the program by running main.py.

Main Menu

fireSim1

The help button can be used for a quick reference on how to use the simulation. When you're ready to initialize the simulation click Start Simulation.

Basic Simulation

fireSim2

During the initialization of the simulation a 2D array of fuel and flamability values was generated. Fuel indicates how long an "entity" can burn and flamability relates to the odds that the tile will catch fire when exposed to flame. The lighter the color of a tile the more fuel it has remaining. To start the simulation hit Basic Sim. Once the button is pressed, a random tile will be lit on fire. From here the simulation will continue until every bit of fuel is used up. The simulation may be exited at any time by hitting the x on the tab. This will cause a, currently broken, graph that displays a variety of values over time.

fireSim3 fireSim6

Custom Simulations

To create your own custom enviroment to test fire safety you can use the buttons on the top right of the window to draw onto the simulation and change it's values. The mechanism is pretty slow at processing clicks/drags so for higher definition simulations it can be quite hard to create cusom enviroments. We recomend you use one of our custom simulations, Pleasanton, CA. This simulation is loaded by first pulling data from the Google Maps API. This is then converted into an appropriately pixelated map. The colors in each tile is then evaluated and converted into the apropriate entity type (grass, house, road, and water).

fireSim4

Advanced Custom Simulations

You can change a variety of parameters within the code to change how the simulation will run. Adjusting FLAME_RADIUS will change how many tiles a flame can jump. Increasing this value will significantly impact performance. Adjust ENTITY_WIDTH to change the resolution of the simulation (smaller width = more tiles). Note that decreasing this value will decrease performance. Adjust SCREEN_HEIGHT in order to change the size of the window.

fireSim10 fireSim7png

About

This is a simulation of fire spread using PyGame. Users can create unique environments by drawing on roads, rivers, housing, and grass. This allows for communities to understand vulnerabilities in their fire safety. This project was created in 24 hours at TriValleyHacks with Emilio Lim, Arhum Khan, and Sunny Jayaram.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages