Cubyz icon indicating copy to clipboard operation
Cubyz copied to clipboard

A possible solution for the implementation of flowing liquids

Open ZilverLazarus opened this issue 2 weeks ago • 1 comments

Description

When browsing the Discord, I noticed some uncertainty on how flowing liquids could be added into the game. I'm not sure where the uncertainty comes from, but I'm assuming some of it is from the concerns presented by cubic chunks (infinite waterfalls, etc).

Water in voxel games like Minecraft behaves strangely. It acts more gelatinous than as full-on water. Realistically, water that starts as a source block from Y=250 and flow down as flowing water blocks would not stay cohesive enough to remain just in a square meter of space as it's falling.

So my proposal to avoid making infinitely-tall waterfalls from just 1 source block is that water and other fluids should have a "dispersion" property. After a certain falling distance (based on environmental factors within the current biome, such as temp and etc), flowing liquid begins dispersing into droplets and then vapor. The moment the flowing liquid starts dispersing is when players can no longer swim up it.

Fluids should also be given a 'viscosity' value, and flow speed (in blocks per second) should be determined by the formula of:

F = (100 / V)

• F = Flow speed in blocks per second
• V = viscosity value

For example, Minecraft's water would have a viscosity of 25 since it flows at a rate of 4 blocks per second.

F = (100 / V)
F = (100 / 25)
F = 4

• Round the end result of F to the nearest integer

From a fluid's viscosity value, we can also determine the 'dispersion distance' value with a second formula that looks something like this:

D = (V * (1.5 / (B + 0.5))

• D = dispersal distance
• V = viscosity
• B = biome temperature (from 0.00 to 2.00)

• The 1.5 is a constant to ensure dispersal acts quicker in hotter biome temps and slower in colder biome temps.
• 0.5 is a constant being added to B to ensure we're not dividing by 0 if B = 0.00. It is also a large enough decimal value to ensure there isn't a runaway division involving setup for D. Ex; "1.5 / (0.0 + 0.5) = 3" INSTEAD OF "1.5 / (0.0 + 0.0001) = 150"
• Round the end result of D to the nearest integer

As for what happens when a flowing, non-dispersed liquid comes into contact with the top of another solid block as it falls, the dispersal distance resets to 0. This would allow for "chain waterfalls" as long as the liquid makes contact with another solid block after falling a height less than the dispersal distance.

ZilverLazarus avatar Dec 09 '25 07:12 ZilverLazarus

I like this, would work well with water on floating sky islands

There was some talk of more realistic water physics, like The Powder Toy, and if we go with that we still need a way to deal with oceans draining into caves

thecreare avatar Dec 09 '25 09:12 thecreare

I linked this in #62 and I'm closing this as a duplicate. We will consider your ideas when it comes to implementing fluids.

IntegratedQuantum avatar Dec 13 '25 15:12 IntegratedQuantum