bbjGames
I actually didn’t measure if it’s that much slower, so I’m probably mistaken. It does move slower but that’s just to prevent water from going negative. There is likely other ways to do this that are faster.
The other game wasn’t made in Construct so there’s lots of things he could have done to make it faster.
Events are basically interpreted, so there’s that. If you made a plugin with JavaScript to do the water calculations there it would be a lot faster since JavaScript is jit’d into machine code.
dop2000
I guess I’m not seeing what you mean from the pictures. The water will try to flow downhill when it can. If too much water is added to one spot the water spills over in every direction. Given a bit of time it should settle down to the valleys. So if anything it solves it too slow. I haven’t based this on any existing algorithms so I’m probably not doing many parts of it the right way. Even after posting it there are things I want to try to do differently.
The idea behind it is simple enough. I take two adjacent cells and calculate how much water to move from the higher one so the two are level. If there is enough water that is.
The tricky part is doing that with the four adjacent cells at once and keep things unbiased. I’m also trying to keep the total amount of water the same as it moves around. The only problem so far is it flows too slow in large quantities, but given enough time it will level out.