10-03-2012, 12:40 AM
I've created a new SVN branch to play with an algorithm for water physics that I've wanted to try out. I call it "floody water", because what I expect it to do is to distribute water much more aggressively than the vanilla algorithm, yet it should be perfectly predictable, unlike our current fluid simulator.
The general idea is to completely remove current fluid simulators, then code the fluid physics in the block update handlers. The block udpate handler will decide if it wants to flow or not, based on the block ID (same as vanilla MC; the reason for having still-water and regular water); if it wants to flow, it will check the immediate neighborhood of itself in 4 directions and try to flow into all 4, if possible. Then it will mark itself as having flowed, not wanting any more updates, until a block next to it updates.
The vanilla algorithm tries to search for a "hole" that would allow it to flow lower, and then only flows towards such a hole. "Floody" will flow all over the place, reaching not only the hole, but all its surroundings.
I believe it will be possible to finally include a switch and have the world use either Floody or Vanilla algorithm, based solely on server admin's desire.
The general idea is to completely remove current fluid simulators, then code the fluid physics in the block update handlers. The block udpate handler will decide if it wants to flow or not, based on the block ID (same as vanilla MC; the reason for having still-water and regular water); if it wants to flow, it will check the immediate neighborhood of itself in 4 directions and try to flow into all 4, if possible. Then it will mark itself as having flowed, not wanting any more updates, until a block next to it updates.
The vanilla algorithm tries to search for a "hole" that would allow it to flow lower, and then only flows towards such a hole. "Floody" will flow all over the place, reaching not only the hole, but all its surroundings.
I believe it will be possible to finally include a switch and have the world use either Floody or Vanilla algorithm, based solely on server admin's desire.