News Liste Going Medieval

Medieval Monday Talk #53 | Fire, Ignited
Going Medieval
18.11.24 18:37 Community Announcements
Greetings, medievalists!

Things are heating up because fire is coming in the next update! Let’s dive into fire logic and how we developed it. We did a similar breakdown when working on water behavior, and you all seemed to enjoy that. Hopefully, you’ll find this just as interesting—and maybe even learn something new!

We needed a fire mechanic that works similar to real life situations but can be adapted to work well inside our game world. For inspiration, we looked at forest fire models which are used to simulate actual forest fires in order to determine where a fire will likely start, how quickly and in what direction will it spread, how much heat will it generate, etc. Forest fire models are usually developed as code, often documented and studied in research papers, and sometimes accompanied by guides, data, or software tools for practical use in wildfire management. These simulations save lives, prevent fire occurrences and additional financial damage.

Fire propagation is typically simulated using two main approaches: Cellular Automata and Wave Propagation. Here’s a simplified breakdown of both:

Take the Going Medieval grid system, where each square represents a voxel and something like grass, tree or a wall.

With Cellular Automata, think of each square (or cell) on the grid as a little computer that follows simple rules. For example, a square might say, "If one of my neighbors is on fire, I’ll catch on fire too!" Then, the fire spreads from square to square across the grid. Each cell just looks at its neighbors and updates itself, and by doing this over and over, you can see how the fire grows and moves across the whole grid.

With Wave Propagation , think about when you drop a stone into a pond and see ripples spreading out. That’s a bit like wave propagation! In a fire model, instead of water waves, we’re imagining “fire waves.” When one part of the forest catches fire, this wave of fire moves outward. It spreads from the burning area in all directions, like the ripples from the stone, but faster or slower depending on conditions like wind or fuel (more trees).

For Going Medieval, we went with using just the cellular automata approach because:
  • It works on a 2D grid. Now, Going Medieval's terrain is made out of voxels, which is a 3d grid, but it's easy to add a 3rd dimension into the existing algorithm. Having fantastic programmers helps, too.
  • These models are generally simpler and require less computing power. This makes them ideal for quick simulations, where you can change the rules to explore different fire behaviors without needing complex calculations.
  • It's easy to add randomness due to its adaptability to different patterns. Cellular Automata is great for capturing irregular patterns of fire spread, like when the fire jumps between patches of vegetation or changes shape due to obstacles. It handles these kinds of “messy” patterns better than wave propagation, which is more suited for smooth, continuous waves.

Our version of the fire mechanic is adapted to the game’s world. That way it runs in real time and can work with other systems of the game. To ensure the fire mechanic worked smoothly with other game systems, we started by developing the algorithm as a standalone project. This allowed for fast experimentation and iteration in the early stages.

All voxels that have fire on them are updated across multiple frames.If we updated the fire on every single frame, it would look like it’s moving super quickly and could end up spreading too fast or looking too intense. Instead, the game only updates the fire’s behavior every 3-4 frames. This means the fire isn’t constantly changing, just changing every few frames, but it still looks smooth and realistic.
By updating the fire only every few frames, the game saves a bit of power (so it runs better) without you noticing any big difference. Since fire doesn’t suddenly grow really fast in this game, you won’t see any delay in the fire growing. So, even though fire updates 3-4 times less often than other things, it still looks like it’s burning smoothly, just like real fire.
For Going Medieval, it doesn't need to be updated every frame, but it needs to be updated frequently enough so the fire doesn't appear like it's lagging.

The fire mechanic sees the whole world as a 3d grid with each voxel having these properties:
  • Voxel health - Anything burnable (trees, grass, buildings) has health > 0
  • Flammability - Indicates how fast things should burn.
  • Flame intensity - Represents size and strength of fire and is between the range of 0.0 - 1.0. If the value is greater than 0, fire will burn. It will appear as a small fire with less strength if it has lower values. The closer it gets to 1.0, the bigger the size is and its strength.
  • Wetness - Affects voxels that are moist. This moisture slows down burning, may even stop it.

With that being said, here is the fire logic in (theoretical) action: Algorithm passes through all of the voxels that are detected to be in a burning state. Flame intensity of one voxel will be increased if there is something burnable on that voxel (like a wooden wall on a grassy ground) or be decreased if nothing is burnable at the voxel (very wet ground). Flammability is used to boost flame growth, but wetness slows it down. Rain and snow also slow down flame growth here. Water puts out fire almost instantly.

After a certain time, fire tries to spread to neighboring voxels. On one hand - we don't need it to spread after every time flame intensity is updated - that would burn your settlement too fast and we like to have fun in our game. On the other hand, it requires more calculations than increasing/decreasing flame intensity, so it's better to do it as rarely as possible (game designer is going to play around with this and come up with the appropriate value).

Here is the video of that in action on a 2d surface:
[previewyoutube=8Sfb26spjiw;full][/previewyoutube]
On the left, red channel is fire, green is grid health, blue channel is flammability. On the right, flammability and grid health are multiplied, showing how quickly things can get out of control if not properly set.

Cool, now to test how the fire looks in the 3d:
[previewyoutube=R01DaAiAFOE;full][/previewyoutube]
It’s getting there. We’ll use existing fire assets (ie the one from campfire) and use it within our gameworld. Let’s see how it looks now:
[previewyoutube=7HSKIUcL9i8;full][/previewyoutube]
Okay, a bit extreme, but we’ll tame it.

So to recap spreading: fire goes through all already burning voxels and finds all the neighbors the fire could spread to. For spreading to occur, those neighbors should not have fire on them, should be flammable and have health > 0, should not have too much wetness on them. Also, flame intensity should be higher than 0.4 to be able to spread fire to its neighbors. If the voxel passes all of these tests, it catches fire - its flame intensity will become larger than zero. This is how fire works in a nutshell, but without proper visuals it looked like this:


With a couple of shaders, it was time to upgrade it visually:
[previewyoutube=8dtioSjziqQ;full][/previewyoutube]
As the fire burns, it gradually damages the objects around it. However, to keep the game running smoothly, this damage isn’t applied immediately inside the fire system. Instead, fire damage is collected and applied later, outside the main fire logic, to avoid slowing down the game.

The game waits a few frames before applying this accumulated damage to objects in the world, which helps spread out the computational work. When the damage is finally applied, the health and flammability of each affected voxel are updated, so the fire system stays in sync with the current state of the world. Once applied, the accumulated damage resets to zero, and the process repeats as the fire continues.

Because of this, fire data will be stored in the save file the same way we store water - separated from data of all other game systems. That means if you get into an overwhelmingly heated situation and don’t want to deal with it gameplay wise, you will be able to delete all of the fire from your save. More on that once the update goes live.

But there is also still so much to talk about! This was just a fun (we hope it was fun) talk about fire movements. Next week we’ll discuss how to control fire spreading in the game. While you wait, let us know if this MMT was understandable as it went into more behind-the-scenes detail than we usually do. See ya in seven days and until then…

Stay medieval!

Foxy Voxel

Discord Reddit X/Twitter Bluesky TikTok Facebook

Logo for Going Medieval
Release:01.06.2021 Genre: Simulation Entwickler: Foxy Voxel Vertrieb: The Irregular Corporation Engine:keine Infos Kopierschutz:keine Infos Franchise:keine Infos
Einzelspieler Mehrspieler Koop

Aktuelle Steam News
Neue Steam News in der ePrison Datenbank

Patch Notes (0.22.15)
Going Medieval
19.12.24 14:02 Community Announcements
Hotfix (0.22.12)
Going Medieval
17.12.24 15:22 Community Announcements
Update #14 | Fire & Training Structures
Going Medieval
17.12.24 12:25 Community Announcements
Experimental Branch Patch (0.22.10)
Going Medieval
16.12.24 15:59 Community Announcements
Experimental Branch Patch (0.22.7)
Going Medieval
13.12.24 18:45 Community Announcements
Experimental Branch Patch (0.22.6)
Going Medieval
12.12.24 17:11 Community Announcements
Experimental Branch Patch (0.22.5)
Going Medieval
11.12.24 14:37 Community Announcements
Medieval Monday Talk #56 - Combat, Expanded
Going Medieval
09.12.24 10:12 Community Announcements
Experimental Branch Patch (0.22.3)
Going Medieval
06.12.24 16:19 Community Announcements
Experimental Branch Update (0.22.1)
Going Medieval
05.12.24 16:44 Community Announcements
Patch Notes (0.21.29)
Going Medieval
05.12.24 08:35 Community Announcements
Experimental Branch Patch (0.21.29)
Going Medieval
04.12.24 14:02 Community Announcements
Medieval Monday Talk #55 - Kindled Strikes
Going Medieval
02.12.24 19:11 Community Announcements
Patch Notes (0.21.28)
Going Medieval
02.12.24 18:00 Community Announcements
Patch Notes (0.21.27)
Going Medieval
02.12.24 16:21 Community Announcements
Nominate Going Medieval for Labor of Love award
Going Medieval
29.11.24 15:38 Community Announcements
Patch Notes (0.21.26)
Going Medieval
29.11.24 14:16 Community Announcements
Patch Notes (0.21.23)
Going Medieval
26.11.24 17:03 Community Announcements
Update #13 | Basic Modding
Going Medieval
26.11.24 11:03 Community Announcements
Medieval Monday Talk #54 - Taming the Beast
Going Medieval
25.11.24 12:12 Community Announcements
Experimental Branch Patch (0.21.21)
Going Medieval
22.11.24 13:08 Community Announcements
Experimental Branch Patch (0.21.19)
Going Medieval
21.11.24 13:22 Community Announcements
Medieval Monday Talk #53 | Fire, Ignited
Going Medieval
18.11.24 18:37 Community Announcements
Patch Notes (0.20.27)
Going Medieval
18.11.24 17:30 Community Announcements
Experimental Branch Patch (0.21.16)
Going Medieval
14.11.24 16:59 Community Announcements
Experimental Branch Patch (0.21.12)
Going Medieval
13.11.24 13:17 Community Announcements
Patch Notes (0.20.25)
Going Medieval
12.11.24 16:41 Community Announcements
Experimental Modding Introduction (0.21.11)
Going Medieval
11.11.24 14:17 Community Announcements
Patch Notes (0.20.24)
Going Medieval
07.11.24 15:02 Community Announcements
Patch Notes (0.20.23)
Going Medieval
05.11.24 11:43 Community Announcements
Patch Notes (0.20.21)
Going Medieval
30.10.24 15:28 Community Announcements
Patch Notes (0.20.20)
Going Medieval
29.10.24 15:52 Community Announcements
Experimental Branch Patch (0.20.19)
Going Medieval
29.10.24 12:51 Community Announcements
Roadmap Update
Going Medieval
29.10.24 12:16 Community Announcements
Patch Notes (0.20.16)
Going Medieval
25.10.24 15:02 Community Announcements
Patch Notes (0.20.14)
Going Medieval
22.10.24 13:26 Community Announcements
Patch Notes (0.20.13)
Going Medieval
17.10.24 13:52 Community Announcements
Patch Notes (0.20.12)
Going Medieval
16.10.24 11:21 Community Announcements
Update #12 | Prisoners & Gates
Going Medieval
15.10.24 10:02 Community Announcements
Experimental Branch Patch (0.20.9)
Going Medieval
14.10.24 15:50 Community Announcements
Experimental Branch Patch (0.20.8)
Going Medieval
11.10.24 14:25 Community Announcements
Experimental Branch Patch (0.20.7)
Going Medieval
10.10.24 16:44 Community Announcements
Experimental Branch Patch (0.20.6)
Going Medieval
09.10.24 15:36 Community Announcements
Experimental Branch Patch (0.20.5)
Going Medieval
08.10.24 17:18 Community Announcements
Experimental Branch Patch (0.20.4)
Going Medieval
07.10.24 16:11 Community Announcements
Experimental Branch Patch (0.20.3)
Going Medieval
04.10.24 15:52 Community Announcements
Experimental Branch Patch (0.20.2)
Going Medieval
03.10.24 18:31 Community Announcements
Experimental Branch Update (0.20.1)
Going Medieval
02.10.24 15:04 Community Announcements
Patch Notes (0.19.40)
Going Medieval
18.09.24 12:16 Community Announcements
Experimental Branch Patch (0.19.40)
Going Medieval
17.09.24 14:19 Community Announcements
Patch Notes (0.19.39)
Going Medieval
11.09.24 11:13 Community Announcements
Experimental Branch Patch (0.19.39)
Going Medieval
10.09.24 11:04 Community Announcements
Medieval Monday Talk #52 — Impactful Entrance
Going Medieval
09.09.24 17:24 Community Announcements
Experimental Branch Patch (0.19.38)
Going Medieval
09.09.24 08:02 Community Announcements
Experimental Branch Patch (0.19.36)
Going Medieval
05.09.24 11:11 Community Announcements
Experimental Branch Patch (0.19.34)
Going Medieval
30.08.24 12:54 Community Announcements
Experimental Branch Patch (0.19.33)
Going Medieval
29.08.24 09:03 Community Announcements
Medieval Monday Talk #51 — Prisoners Revision
Going Medieval
26.08.24 11:52 Community Announcements
Experimental Branch Patch (0.19.32)
Going Medieval
19.08.24 12:54 Community Announcements
Medieval Monday Talk #50 — Rewriting Buildings
Going Medieval
12.08.24 13:19 Community Announcements
Patch Notes (0.19.30)
Going Medieval
12.08.24 07:37 Community Announcements
Experimental Branch Patch (0.19.30)
Going Medieval
08.08.24 07:56 Community Announcements
Experimental Branch Patch (0.19.29)
Going Medieval
29.07.24 13:29 Community Announcements
Patch Notes (0.19.28)
Going Medieval
29.07.24 10:30 Community Announcements
Medieval Monday Talk #49
Going Medieval
29.07.24 08:20 Community Announcements
Medieval Monday Talk #48
Going Medieval
15.07.24 15:33 Community Announcements
Experimental Branch Patch (0.19.28)
Going Medieval
09.07.24 11:03 Community Announcements
Patch Notes (0.19.27)
Going Medieval
28.06.24 12:43 Community Announcements
Patch Notes (0.19.25)
Going Medieval
27.06.24 13:52 Community Announcements
Patch Notes (0.19.24)
Going Medieval
26.06.24 11:33 Community Announcements
Patch Notes (0.19.23)
Going Medieval
25.06.24 08:57 Community Announcements
Patch Notes (0.19.22)
Going Medieval
21.06.24 14:10 Community Announcements
Patch Notes (0.19.21)
Going Medieval
20.06.24 07:58 Community Announcements
Medieval Monday Talk #47
Going Medieval
17.06.24 15:05 Community Announcements
Experimental Branch Patch (0.19.17)
Going Medieval
14.06.24 11:34 Community Announcements
Patch Notes (0.19.16)
Going Medieval
11.06.24 11:59 Community Announcements
Patch Notes (0.19.14)
Going Medieval
06.06.24 13:12 Community Announcements
Patch Notes (0.19.13)
Going Medieval
04.06.24 14:25 Community Announcements
Patch Notes (0.19.12)
Going Medieval
03.06.24 15:15 Community Announcements
Update #11 | Events & Roles
Going Medieval
30.05.24 09:08 Community Announcements
Experimental Branch Patch (0.19.10)
Going Medieval
29.05.24 12:49 Community Announcements
Experimental Branch Patch (0.19.9)
Going Medieval
27.05.24 14:47 Community Announcements
Experimental Branch Patch (0.19.8)
Going Medieval
24.05.24 16:39 Community Announcements
Experimental Branch Patch (0.19.7)
Going Medieval
23.05.24 16:06 Community Announcements
Experimental Branch Patch (0.19.5)
Going Medieval
21.05.24 15:24 Community Announcements
Experimental Branch Patch (0.19.4)
Going Medieval
20.05.24 15:08 Community Announcements
Experimental Branch Patch (0.19.3)
Going Medieval
19.05.24 07:15 Community Announcements
Experimental Branch Patch (0.19.2)
Going Medieval
17.05.24 13:31 Community Announcements
Experimental Branch Update (0.19.0)
Going Medieval
16.05.24 15:07 Community Announcements
Medieval Monday Talk #46
Going Medieval
13.05.24 13:05 Community Announcements
Patch Notes (0.18.19)
Going Medieval
08.05.24 11:43 Community Announcements
Medieval Monday Talk #45
Going Medieval
29.04.24 11:31 Community Announcements
Hotfix Notes (0.18.18)
Going Medieval
26.04.24 13:05 Community Announcements
Update #10.5 | Migration & Camera Changes
Going Medieval
22.04.24 11:26 Community Announcements
Medieval Monday Talk #44
Going Medieval
08.04.24 11:55 Community Announcements
Experimental Branch Patch (0.18.8)
Going Medieval
03.04.24 13:10 Community Announcements
Experimental Branch Patch (0.18.7)
Going Medieval
28.03.24 14:19 Community Announcements
Experimental Branch Patch (0.18.5)
Going Medieval
22.03.24 21:32 Community Announcements
Experimental Branch Patch (0.18.3)
Going Medieval
20.03.24 13:54 Community Announcements
Medieval Monday Talk #43
Going Medieval
18.03.24 15:07 Community Announcements
Patch Notes (0.16.26)
Going Medieval
13.03.24 14:28 Community Announcements
Experimental Branch - Save Migration Guide
Going Medieval
07.03.24 10:39 Community Announcements
Patch Notes (0.16.24)
Going Medieval
06.03.24 13:51 Community Announcements
Patch Notes (0.16.23)
Going Medieval
29.02.24 11:28 Community Announcements
New Save System is coming soon
Going Medieval
26.02.24 18:54 Community Announcements
Patch Notes (0.16.22)
Going Medieval
26.02.24 12:38 Community Announcements
Patch Notes (0.16.20)
Going Medieval
13.02.24 12:26 Community Announcements
Hotfix Notes (0.16.19)
Going Medieval
07.02.24 12:27 Community Announcements
Hotfix Notes (0.16.17)
Going Medieval
06.02.24 11:48 Community Announcements
Hotfix Notes (0.16.16)
Going Medieval
05.02.24 12:03 Community Announcements
Patch Notes (0.16.15)
Going Medieval
01.02.24 13:52 Community Announcements
Patch Notes (0.16.14)
Going Medieval
25.01.24 13:03 Community Announcements
Patch Notes (0.16.13)
Going Medieval
18.01.24 14:49 Community Announcements
Happy Holidays!
Going Medieval
22.12.23 14:27 Community Announcements
Patch Notes (0.16.10)
Going Medieval
20.12.23 14:05 Community Announcements
Hotfix (0.16.9)
Going Medieval
08.12.23 14:11 Community Announcements
Patch Notes (0.16.8)
Going Medieval
07.12.23 08:05 Community Announcements
Hotfix (0.16.7)
Going Medieval
23.11.23 14:05 Community Announcements
Nominate Going Medieval for Labor of Love 2023 Steam Award
Going Medieval
22.11.23 12:56 Community Announcements
Update #10 | Water & Fishing
Going Medieval
21.11.23 10:56 Community Announcements
Experimental Branch Patch (0.16.6)
Going Medieval
20.11.23 10:51 Community Announcements
Experimental Branch Patch (0.16.5)
Going Medieval
17.11.23 10:37 Community Announcements
Experimental Branch Patch (0.16.4)
Going Medieval
15.11.23 11:28 Community Announcements
Experimental Branch Update (0.16.2)
Going Medieval
10.11.23 14:06 Community Announcements
Medieval Monday Talk #42
Going Medieval
30.10.23 13:39 Community Announcements
Medieval Monday Talk #41
Going Medieval
16.10.23 12:25 Community Announcements
Medieval Monday Talk #40
Going Medieval
02.10.23 13:26 Community Announcements
Medieval Monday Talk #39
Going Medieval
18.09.23 12:15 Community Announcements
Medieval Monday #38
Going Medieval
04.09.23 14:34 Community Announcements
Hotfix (0.15.8)
Going Medieval
23.08.23 12:46 Community Announcements