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.
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
.
![fireSim1](https://private-user-images.githubusercontent.com/95263942/269447135-6c5ac7fe-00c2-4dde-b139-e3c2ebdb9c92.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMDc4NzgsIm5iZiI6MTcyNDAwNzU3OCwicGF0aCI6Ii85NTI2Mzk0Mi8yNjk0NDcxMzUtNmM1YWM3ZmUtMDBjMi00ZGRlLWIxMzktZTNjMmViZGI5YzkyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE4NTkzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFkNDQ4M2M3ZTM0ZWExZmMyYTBjZmNiODI1ZjE1MzVhMmU2ODcxOTMxMzQyOTg1Y2NlNmM4OTMzOWQ2ZjYwOGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.VcemrOHEENjE53hbjzVDp5anK8VsNM4T1fK8l0cdnGM)
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
.
![fireSim2](https://private-user-images.githubusercontent.com/95263942/269447370-55f4872e-eb82-42c7-af7f-9597697d95a7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMDc4NzgsIm5iZiI6MTcyNDAwNzU3OCwicGF0aCI6Ii85NTI2Mzk0Mi8yNjk0NDczNzAtNTVmNDg3MmUtZWI4Mi00MmM3LWFmN2YtOTU5NzY5N2Q5NWE3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE4NTkzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAyMjg1OTFiNzA3ZTBlZDRkZDdiYjUxOTE0MjIxOGVmODliNzBlMDZlM2YxZjFmZmM2NGZjNTFhMjNmZjIxOGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.LVlS5CnJ5KT9ndXJBCfO6YekL4jZP47z6OZE8dZ8Cnw)
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](https://private-user-images.githubusercontent.com/95263942/269447946-25aabdd4-63f9-4f9a-8aac-9a474c230fd8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoic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DA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE4NTkzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdmYzViYmE5ODE4ZDJhMWRlYzYzZGYxMWE3ODRhNmE0NjBkNmE5YWIxNTE1ZjkxZTc1NzU5MWRlOTYxYTRiZjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RRz_ZWMtOdts_Axt5ySpSnja6JPYxa0yRwKfGKR6Nqk)
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](https://private-user-images.githubusercontent.com/95263942/269761058-e3027172-d85a-485b-96d9-8b90d487f2f6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMDc4NzgsIm5iZiI6MTcyNDAwNzU3OCwicGF0aCI6Ii85NTI2Mzk0Mi8yNjk3NjEwNTgtZTMwMjcxNzItZDg1YS00ODViLTk2ZDktOGI5MGQ0ODdmMmY2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE4NTkzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY4YjE5ZWZjMjkwNDBiMjZmOWI5YjE1NmVmNDE0N2JlMDA5N2VmNjBiM2I0Y2ZkOWFiNTZiNjUzOTUzODgwYTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.NJsUHvxSmZaPUUdXD1UQdBdeDB51aaxooHl0CPcBf3s)
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](https://private-user-images.githubusercontent.com/95263942/269766972-e27a231d-c762-42d1-bb11-dff78a66f194.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMDc4NzgsIm5iZiI6MTcyNDAwNzU3OCwicGF0aCI6Ii85NTI2Mzk0Mi8yNjk3NjY5NzItZTI3YTIzMWQtYzc2Mi00MmQxLWJiMTEtZGZmNzhhNjZmMTk0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE4NTkzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNhZTA3Mjk1YWFiMTUxYTQyYWQ0NzU1YTI5NDE2MmQyMTk3ZDVhMzQ0MWI4ZjNlMGQ0ZmYzY2VmMTkxOWY0YmU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