🌳 A forest fire simulator that support console, SDL and raylib. x86 and wasm versions available 🔥
- C 91.5%
- Makefile 8.5%
| images | ||
| raylib@c1ab645ca2 | ||
| SDL@89cab56536 | ||
| tomlc17@41226a6223 | ||
| .gitmodules | ||
| config.c | ||
| config.h | ||
| consoleInterface.c | ||
| firePropagationLogic.c | ||
| firePropagationLogic.h | ||
| fireSimulation.c | ||
| fireSimulation.h | ||
| ignitionStrategy.c | ||
| ignitionStrategy.h | ||
| main.c | ||
| Makefile | ||
| raylibInterface.c | ||
| README.md | ||
| sdl3Interface.c | ||
| simulationInterface.h | ||
Forest Fire Simulator
This is a forest fire simulator. It is designed to simulate the spread of forest fires.
Configuration
The fire simulator is configurable via its configuration file config.toml.
widthdefines the width of the simulation.heightdefines the height of the simulation.igniteProbabilityis the probability that a burning square propagate to a neiboroud square.seedis the inital value of the RNG to make reproductible simulation.stepsPerSecondis the goal speed of the simulation. This field mean, do AT MOST X steps per second.
An example of configuration :
width = 400
height = 400
igniteProbability = 0.65
seed = 11
stepsPerSecond = 60
Compilation
Just use the Makefile.
$ make fire # To compile
$ ./fire # To launch the simulation
Interfaces
There is 2 interfaces that you can choose from, the textual one and a GUI (with raylib).
By default, the configuration is set to CONSOLE_INTERFACE, since the default values of the simulation are adapted to be printed in the console.
To change the interface, you must define the RAYLIB_INTERFACE preprocessor header.
$ make fire CFLAGS="-D RAYLIB_INTERFACE"
With the raylib interface, there is a option to compute the runtime steps per second, by defining the SHOW_FPS preprocessor constant.
To achieve +400fps in full screen, you can switch to the ⚡ branch.

