Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.52k stars 236 forks source link

Liquids #378

Open slakibk opened 2 years ago

slakibk commented 2 years ago

Thank you very much for your work. Thanks to you, I was able to make the first iteration of the game. I have a question about liquids. Should the liquid spill system be prescribed in the module or can something like randomtick be used? I tried to add a system similar to random, but constantly processing blocks. And faced performance degradation.

Zylann commented 2 years ago

Liquids are expensive. That's why Minecraft uses a simplified version. In https://github.com/Zylann/voxelgame I implemented a simple propagation model, although water never runs out so it can cover the whole map. I did not use randomtick, instead I used a list of "voxels to update" and then process a certain amount of voxels per frame. So CPU usage remains constant but liquid spread can slow down. Terraria might be doing that too but in a more advanced way. See also https://github.com/Zylann/godot_voxel/issues/70, might be a duplicate.

slakibk commented 2 years ago

You're right. I should have asked my question at #70.