spicylobstergames / astratomic

Survival game inspired by Noita and Starbound, fueled by Rust and Bevy.
Other
102 stars 8 forks source link

Temperature #70

Open Zac8668 opened 10 months ago

Zac8668 commented 10 months ago

Thermodynamic simulation will be awesome! So that we can have rocks melt, water freeze, etc We probably want to add #52 first

Zac8668 commented 9 months ago

My idea for the implementation is like this:

The problem with just adding a temperature field to the atoms is that if we want to update the temperature we would need to keep a lot of atoms "awake", that would drastically affect performance negatively.

But temperature spreading is not something that makes particles move, so we can probably use a compute shader to do that, that way we can make it awake only the particles that change state, and by having this separate simulation we can probably have some nice thermodynamics without damaging performance.

It would also spread temperature on a vast portion of the map without problems.

References: https://github.com/bevyengine/bevy/blob/main/examples/shader/compute_shader_game_of_life.rs

Zac8668 commented 9 months ago

We can maybe also use a similar system to implement how fluids(gas/liquids) dissolve into each other. For that we would probably need each fluid atom to have unique properties that can be changed in runtime. We would probably have space for 4 properties, so that we can fit in a RGBA

Zac8668 commented 9 months ago

Resource: https://youtube.com/shorts/4xWpQe3G9qI?si=DWxswQNuYaS6SCHL

Zac8668 commented 9 months ago

Another resource: https://thermtest.com/what-is-thermal-conductivity