Listen, I've never created a game before. I have very basic programming experience from ROBLOX and it's certainly not enough for what I want to achieve. I'll probably abandon this as soon as I get overwhelmed, but as for now I'm motivated. So here's the idea; I'd like to create a winter survival game where temperature is the core mechanic. I don't know how Luanti's API looks like yet, but I'm willing to learn it by trial and error. So, here's what I'd need:
Every step, nodes in the world exchange a portion their temperatures with neighbors, based on thermal resistance. Nodes with high resistance gain/lose temperature to other nodes more slowly. If there's no heat source (by that I mean a node with a constant temperature), the temperature should eventually equalize with the atmospheric temperature (based on attitude; the deeper you are the warmer it gets). If my reasoning is correct, this way blocks with high thermal resistance could be used to create rooms that when heated from, e.g., with a torch. will retain heat (even for some time if there's no active heat source). In addition, blocks that are difficult to heat up/cool down would additionally radiate with heat, extending the range of a heat source.
I'd like to implement such system, but I have no idea where to start. Can someone please help me? Maybe if i get an initial idea of how to approach this problem, I could push it forward myself. I don't know if it's possible, but i know that i'd need to give the built-in air block temperature and thermal_resistance properties. Additionally, I don't know how to scan the right nodes; looping through everything seems expensive and i care about optimization.
I prefer to learn from examples and hope it's not wrong to ask for code like this. If it is, I'm sorry. Thanks in advance.
Temperature system for a winter survival game.
- sorcerykid
- Member
- Posts: 1920
- Joined: Fri Aug 26, 2016 15:36
- GitHub: sorcerykid
- In-game: Nemo
- Location: Illinois, USA
Re: Temperature system for a winter survival game.
This is certainly doable to some degree (no pun intended). My game server makes extensive use of weather and temperature based survival, including a "Temp Felt" HUD and even a vignette overlay to give a visceral indication of temperature extremes.

https://github.com/sorcerykid/survival? ... me-ov-file
Players must be selective when venturing out in the cold (to avoid frostbite) or when mining in lava caves (so as not to get heatstroke) by wearing armor with suitable insulation and conduction properties. Similarly wielding a torch will give a warming sensation while holding an ice cube will result in a cooling effect.

While the game mechanic on my server isn't quite as elaborate as you described (i.e. heat being confined to a specific room) it nevertheless does account for radiation sources. That is, a node can propogate heat radially or on contact, or even both (such as a furnace which will burn you when touched, but provide moderate warmth from a distance). This is accomplished by use of my Axon framework:
viewtopic.php?f=9&t=24721
Of course, in my case I'm focused on optimizing for server performance (network, CPU, etc.) rather than ultra-realism. But since your game is most likely intended for single-player on a local machine, you probably won't have those same constraints. I would be interested in seeing what direction you plan to take with your project!

https://github.com/sorcerykid/survival? ... me-ov-file
Players must be selective when venturing out in the cold (to avoid frostbite) or when mining in lava caves (so as not to get heatstroke) by wearing armor with suitable insulation and conduction properties. Similarly wielding a torch will give a warming sensation while holding an ice cube will result in a cooling effect.

While the game mechanic on my server isn't quite as elaborate as you described (i.e. heat being confined to a specific room) it nevertheless does account for radiation sources. That is, a node can propogate heat radially or on contact, or even both (such as a furnace which will burn you when touched, but provide moderate warmth from a distance). This is accomplished by use of my Axon framework:
viewtopic.php?f=9&t=24721
Of course, in my case I'm focused on optimizing for server performance (network, CPU, etc.) rather than ultra-realism. But since your game is most likely intended for single-player on a local machine, you probably won't have those same constraints. I would be interested in seeing what direction you plan to take with your project!
Re: Temperature system for a winter survival game.
We have a fairly extensive system for this in Exile, which works acceptably well in multiplayer and on low end machine. The primary functionality is in climate/temperature.lua.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile
- Skamiz Kazzarch
- Member
- Posts: 694
- Joined: Fri Mar 09, 2018 20:34
- GitHub: Skamiz
- In-game: Skamiz
- Location: la lojbaugag.
Re: Temperature system for a winter survival game.
Couldn't find it when I first read this topic, but happened on it by coincidence today. Yet another mod that does temperatures: Temperature Survive
A more detailed response to your suggestions:
In practice, simulating temperature for every single node is not feasible from a performance perspective. Maybe if it was a feature built in into the engine? But implementing it just through the API would be way too slow for sure.
You could cut out a lot of the calculations by ignoring large volumes of air and underground stone, presuming that they are already well mixed. Maybe updating the nodes at random rather then every node every time? And probably a lot of other things.
Generally you will want to focus the mechanic as tightly as you can around the stuff that is most directly relevant to the player. And even then you might not get away with it without knowing specialized optimization techniques. Making faithful yet performant simulations is not a simple mater.
A more detailed response to your suggestions:
In practice, simulating temperature for every single node is not feasible from a performance perspective. Maybe if it was a feature built in into the engine? But implementing it just through the API would be way too slow for sure.
You could cut out a lot of the calculations by ignoring large volumes of air and underground stone, presuming that they are already well mixed. Maybe updating the nodes at random rather then every node every time? And probably a lot of other things.
Generally you will want to focus the mechanic as tightly as you can around the stuff that is most directly relevant to the player. And even then you might not get away with it without knowing specialized optimization techniques. Making faithful yet performant simulations is not a simple mater.
Last edited by Blockhead on Tue Mar 10, 2026 01:22, edited 1 time in total.
Reason: Fix link to temperature survive (was this thread)
Reason: Fix link to temperature survive (was this thread)
Re: Temperature system for a winter survival game.
You might find myweather useful. https://donbatman.github.io/myweather.html
Who is online
Users browsing this forum: No registered users and 1 guest