I'm creating a game in Flash AS3 in which the player needs to modify land in order to direct the water in the right direction.
However, water simulation is a new topic for me and I'm kinda stuck. It doesn't have to be like realistic water, with ripples and stuff, but it has to flow, and if there's enough water, it needs to rise.
I've thought up two different types of water:
- A Spring: Infinite source of water. Used for simulating seas and stuff.
- Water block: Just one unit of water.
My current implementation shows how I'd like the water to spread, but it doesn't rise, and doesn't allow for finite water. Also, the spreading isn't accounting for any amount of water, it just duplicates instead of actually moving units of water.
I'm curious to how you guys would solve this problem. Any examples/pseudo-code is always appreciated.
Current version: http://dl.dropbox.com/u/319897/ProjectWater.swf You can manipulate the land by pressing left mouse. And can simulate one step of water at a time by pressing A.
Source of the water part: http://pastebin.com/Js2kYt4y