ID:1010654
 
Has anyone come across a demo/library for, or have any ideas on how to simulate volumetric water physics? Where you can create one tile of water of specific depth and it spreads until the it is leveled?
Funny that you ask this because I randomly found this recently, which will not help you at all:

http://www.youtube.com/watch?v=GbJgZj4qmwA&feature=related
Gunbuddy13 wrote:
Has anyone come across a demo/library for, or have any ideas on how to simulate volumetric water physics? Where you can create one tile of water of specific depth and it spreads until the it is leveled?

No but I do know that it is in a certain mining game here on byond. I don't think it is public, best bet is to search the resources.

Could you imagine what kind of game this community could create if we all just banded together instead of being individuals?
Gunbuddy13 wrote:
Has anyone come across a demo/library for, or have any ideas on how to simulate volumetric water physics? Where you can create one tile of water of specific depth and it spreads until the it is leveled?

Using the source of the water as a variable container you can keep track of the value of water and spread it out dividing the source blocks water-variable as it spreads.
I remember Koil had one. He might still have it lying around somewhere, if you ask him I'm sure he'd be willing to help. :)

[EDIT] Just remembered! If if I recall correctly, Koil handed his work over to Calus CoRPS who then put into use in his project called MOLE. Worth checking out. :)
In response to Metamorphman
Metamorphman wrote:
[EDIT] Just remembered! If if I recall correctly, Koil handed his work over to Calus CoRPS who then put into use in his project called MOLE. Worth checking out. :)

Koil actually gave me the slime graphics in MOLE. The code is all mine and prior to his offering, each "water particle" was a 4x4 square and it looked ugly. Unfortunately, the demonstration is slow and isn't a representation of water physics. :(

Skysaw has a neat demo of how water physics could work in BYOND. The source code was never released but it isn't too difficult to replicate. But to answer the OP question, there isn't an open source water physics demo on BYOND.
We've saw how that would work on a SIDE_VEW map format, how about TOPDOWN_MAP?

I think about it and a few ideas come across my mind, one would make a 1px lines that'd represent our water source, and scaling them with a loop while(volume), scaling a new icon with the line to take a step into the next pixel available, and blend both icons to make one new.

Although it could be a bit unefficient, it is a starting point. If this interests people I could start work on a libry.
Gunbuddy, are you trying to do this for a side-scroller or a top-down game? And also, how exactly would you want the water to behave? Minecraft has water "source blocks" that fill their surrounding area with water. If the water is in the air it will make a waterfall until the next ground it hits, but when spreading on the ground it will only go a certain distance. This approach might be good because you have one 'controller' object that produces more than one tile of water. On the other hand, it's not very realistic, and would provide no way to do things like split a large body of water into two smaller ones.

The game is top-down, and as of right now the water does behave similar to how it works in Minecraft. But I'd rather have the water actually level itself out instead of having a source tile of depth 5 and then 4,3,2,1 outwards. It just isn't going to work for the final product.
And splitting the large body of water into 2 smaller ones is exactly what I want to do. For example, a room could be flooding with water and you shut the door... I want the water level in each room to level itself out independently of the other.
Well, you could use an object-oriented approach. You could have a water object with a variable depth. Say the depth is 5 and the water is totally contained. When an adjacent tile opens up, the water object spawns a new object with depth 2 and its own depth drops to 3. You would also have to code it to "push" water objects outward so that it doesn't just get stuck.

This is going to give you some problems however. You would have to be very careful that these water objects run as efficiently as possible, or else anything more than a small pool might totally lag your game out.

Another solution might be to give each turf a water-depth variable. Then have one procedure that checks all water-containing turfs to see if they can spread out more. Again, processing power is a major concern here! I'd recommend maintaining a list of all turfs with water in them, which is *only* updated when water moves to a 'dry' turf or when a turf's water is completely removed. Looping through all turfs in the map is a surefire way to slow your game to a crawl...