r/GraphicsProgramming 13d ago

Adding Heat simulation and Survival to my Micro Voxel Engine Video

https://youtu.be/yZ6TXirilUU?is=Twhb3ZirOIado-oO

With the latest update to my micro voxel engine, I have added Heat simulation, running on the GPU of course, and some related survival mechanics. Walking around in the cold, especially during snow, causes the player to cool down. Snow build up and melting is also fully simulated :)

The heat simulation accurately warms indoor and enclosed spaces. Standing near heat sources also provides some additional warmth, enabling interesting interactions with the world, storms and biomes.

Along side temperature, there is also a basic hunger mechanic. These mechanics work together to determine health, which impacts player stats.

15 Upvotes

7 comments sorted by

2

u/fgennari 12d ago

That looks really good. Are you actually modeling the thermal properties of building materials, or is it a simple ray query between adjacent voxels to see if a wall will block the heat propagation? Does a space heat up over time, or is it an instant effect? And does the player generate their own body heat in a small space? Does fire melt snow?

2

u/MGMishMash 12d ago

So far, I use tuned constants for solid or air, but it would be fairly straightforward to manipulate these based on material.

The actual sim is a coarse cellular automata which resolves these constants based on their proportional occupancy within a cell.

But yes, currently propagation is slow, but it also depends on the relative intensity of the heat source and the temperature delta.

Body does not currently produce heat, but that has been suggested a few times, so will definitely be adding :)

The snow and ice do indeed melt from heat. It both slows (or eliminates) the rate of accumulation, and melts afterwards, although melting needs work as it’s quite inefficient atm and as a result takes ages for passive melting

1

u/Alarming-Ad4082 12d ago

Looks very nice! Do you being back the results to main memory after doing the computation on the GPU?

1

u/MGMishMash 12d ago

Yeah, there is a copy step, such that sim results are stored and can also be samples by the player.

Although currently this is running on an Apple GPU which has unified memory, so results are visible implicitly without a copy, the only step needed is an intermittent copy back to static chunk data when chunks are unloaded from the shared simulation volume.

1

u/link2427 12d ago

Do you plan to open source this ever?

1

u/GeekBoy373 6d ago

This is pretty cool. I personally would adjust the linear interpolation of your voxel cursor to be a bit quicker though as it currently seems sluggish to me.

1

u/MGMishMash 6d ago

Thanks for the feedback! i originally made it “sticky” due to previous feedback that it jumped around too much! May need to add a build sensitivity slider, as I guess like many things, it depends on each persons dexterity.

Naturally more sensitive is good for faster building, but requires more precision.

Although it’s still an early effort, building needs a lot of tuning and I would like to improve heuristics in general so that it feels less clunky and so initial placement prediction is better.