🌳 A forest fire simulator that support console, SDL and raylib. x86 and wasm versions available 🔥
  • C 91.5%
  • Makefile 8.5%
Find a file
2026-03-05 09:40:24 +01:00
images docs: Improve README with examples and images 2026-02-22 21:58:50 +01:00
raylib@c1ab645ca2 feat: Add raylib to submodules 2026-03-05 09:31:51 +01:00
SDL@89cab56536 feat: Install SDL3 2026-03-04 19:26:37 +01:00
tomlc17@41226a6223 feat: Add tomlc17 as a dependancie 2026-02-22 16:08:18 +01:00
.gitmodules feat: Add raylib to submodules 2026-03-05 09:31:51 +01:00
config.c fix: uncouple read config and initialize it 2026-02-28 01:21:40 +01:00
config.h fix: uncouple read config and initialize it 2026-02-28 01:21:40 +01:00
consoleInterface.c feat: Add the new interfaces 2026-03-04 19:30:21 +01:00
firePropagationLogic.c feat: Blazing fast simulation 2026-02-22 21:23:48 +01:00
firePropagationLogic.h feat: Blazing fast simulation 2026-02-22 21:23:48 +01:00
fireSimulation.c feat: Blazing fast simulation 2026-02-22 21:23:48 +01:00
fireSimulation.h feat: Blazing fast simulation 2026-02-22 21:23:48 +01:00
ignitionStrategy.c feat: Blazing fast simulation 2026-02-22 21:23:48 +01:00
ignitionStrategy.h feat: Add various ignition strategies 2026-02-22 18:09:56 +01:00
main.c feat: Add the new interfaces 2026-03-04 19:30:21 +01:00
Makefile fix: Include the correct directory for fire_sdl.html 2026-03-05 09:40:24 +01:00
raylibInterface.c feat: Add the new interfaces 2026-03-04 19:30:21 +01:00
README.md docs: Improve README with examples and images 2026-02-22 21:58:50 +01:00
sdl3Interface.c fix: Remove reference to sdl3interface.h 2026-03-05 09:33:14 +01:00
simulationInterface.h feat: Add the new interfaces 2026-03-04 19:30:21 +01:00

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.

  • width defines the width of the simulation.
  • height defines the height of the simulation.
  • igniteProbability is the probability that a burning square propagate to a neiboroud square.
  • seed is the inital value of the RNG to make reproductible simulation.
  • stepsPerSecond is 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.

Example of simulation from the console interface

To change the interface, you must define the RAYLIB_INTERFACE preprocessor header.

$ make fire CFLAGS="-D RAYLIB_INTERFACE"

Example of simulation from the 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.