godot_voxel icon indicating copy to clipboard operation
godot_voxel copied to clipboard

Implement Fluid Support

Open zauberparacelsus opened this issue 5 years ago • 10 comments

This is probably going to come up as a feature request at some point (if it hasn't already), so I'm going to create an issue page for it so that it implementation details and potential problems can be discussed.

Would probably depend on #69

zauberparacelsus avatar Sep 21 '19 17:09 zauberparacelsus

I don't play minecraft, so what does fluid support mean and what does it look like?

TokisanGames avatar Sep 21 '19 20:09 TokisanGames

Okay yeah, the original post was vague. To clarify, I was mainly referring to support for a liquid flowing mechanic.

Details on how fluids spread in minecraft can be found here: https://minecraft.gamepedia.com/Liquid#Spread

But to summarize: Water is divided between source blocks and flow blocks. Flow blocks will spread outward, preferring to flow downward if they can. If two or more source blocks are adjacent to a flow block, then the flow block is converted into a new source block.

zauberparacelsus avatar Sep 22 '19 01:09 zauberparacelsus

This is getting close to gameplay features so I'm not sure if that should be implemented directly in this module. There are countless features like that which could be implemented in various ways, I just don't feel they should be necessarily built-in. Also that fluid mechanic can only apply to blocky terrain, so as such it would not depend on #69.

Anyone is free to implement this, but I would like it to be doable with a minimal amount of changes so that it can be made modular and doable in different ways. Which means, it won't have to be built-in as "the only way to do fluids". It might even be doable from a script, as fluids are basically cellular-automata that read and write voxels.

Zylann avatar Sep 22 '19 15:09 Zylann

I've played a lot of minecraft. To implement something like the water in minecraft, a few things are necessary (which I'm not sure yet if this module supports):

  • Custom mesh voxels (water blocks sit a bit below other blocks height-wise)
  • Animated texture voxels (flowing water blocks have animated textures)
  • Transparent voxels (water is slightly transparent, allowing blocks behind it to be seen)

There might be other things I'm not aware of that would be required.

I've also played modded minecraft and some weird interactions with how water is drawn seem to indicate it is a difficult problem to solve (e.g. water sometimes draws over some in-game particle effects or UI textures)

voxelv avatar Mar 02 '20 07:03 voxelv

Custom mesh voxels (water blocks sit a bit below other blocks height-wise)

This is supported, although there is no "auto-tiling" to choose orientation or level, you need to handle that at the moment.

Animated texture voxels (flowing water blocks have animated textures)

Supported by giving those blocks a specific material (the amount is limited but you can find ways to re-use it, in Minecraft there is a material just for any kind of animated block).

Transparent voxels (water is slightly transparent, allowing blocks behind it to be seen)

Also supported, there is a transparent flag on Voxel to affect face culling. Then again, a material is needed.

water sometimes draws over some in-game particle effects or UI textures

That's a rendering problem, which is not specific to this module.

Zylann avatar Mar 02 '20 10:03 Zylann

This is supported ... Supported ... Also supported ...

WIth this information, I would argue that Minecraft-like fluid can be implemented project-side.

voxelv avatar May 12 '20 16:05 voxelv

The least obvious thing to implement is probably the fluid simulation itself. It can also be done project side since there is an API already to modify voxels, but it's unclear what extra requirements would arise depending on the game.

Zylann avatar May 12 '20 17:05 Zylann

I thought this was about smooth voxels and im not sure if this is a thing that has been done but physics based voxels that would rely on other solid voxels for positioning would be insane with the smooth generator, i dont know how it could be done and it would probably be too intensive to run anyway though

im gonna try to just make smooth voxel lakes that will be static and float if the land voxels are removed

spiro-angelakis avatar Dec 24 '21 01:12 spiro-angelakis

This is getting close to gameplay features so I'm not sure if that should be implemented directly in this module. There are countless features like that which could be implemented in various ways, I just don't feel they should be necessarily built-in. Also that fluid mechanic can only apply to blocky terrain, so as such it would not depend on #69.

Anyone is free to implement this, but I would like it to be doable with a minimal amount of changes so that it can be made modular and doable in different ways. Which means, it won't have to be built-in as "the only way to do fluids". It might even be doable from a script, as fluids are basically cellular-automata that read and write voxels.

Where do you draw the line between gameplay and gamemechanic? They are literally the same thing.

liquid is directly tied to voxels, since it is implemented with voxels (aka a grid of items) Just because it's optimized differently doesn't mean it doesn't belong.

All your replys I look at just screams that you only plan on implementing it if it's in minecraft.

I hate to break it to you minecraft is not the only voxel game.

I suggested a while ago for wrap around worlds but that was deemed gameplay specific also. Even though starbound uses a wrapped world and while it is 2d I wanted to make a 3d equivalent.

I also suggested a block size of 8 but that was deemed too hard on performance, yet a guy made a game called lay of the land that literally uses voxel's of size 1.

Of course it was made in unreal engine, but that's not the point. A engine and it's libraries are only as good as it's programmers or as good as it's programmers lets it be.

Now you may be a good programmer but it sounds like you shut down idea's just because it doesn't fit in your idea of what a voxel engine is.

My suggestion would be either start listening to people or stop using the gameplay specific excuse, Because gameplay is literally just a bunch of fun game mechanic's tied together, and yes voxel liquids do fall into a voxel tool's domain.

Also note I am not saying this to hurt your feelings, so if it sounds aggressive forgive me.

Shadowblitz16 avatar Jul 28 '24 04:07 Shadowblitz16

All right, long story short: I don't have time for this.

Zylann avatar Jul 28 '24 13:07 Zylann