Propagation By Water, part 1

Published December 03, 2009
Advertisement
water flow test

Click the image to play with this one.

This is my first go at the "Propagation" portion of the UnOfficial Four Elements Contest. Not complicated; click and drag your mouse around the bitmap and watch the particles spawn and flow downhill.

Simple mechanic: each particle sniffs each of the eight pixels around it, and goes toward the darkest one. If the darkest neighbor is the same color as the current pixel, it stops moving. I check the neighbors from upper left to lower right, so there is a bias toward the upper left in case of a tie between more two or more neighbors. Adding vector data to the particles will take care of that.

It will take a lot more work to make this usable in a game. It also gave me an idea for making a simple erosion simulator which will make the terrain much more realistic...if it works.
Previous Entry Declarative Declarations
0 likes 2 comments

Comments

Slather
I hate to break it to you, but the element is "Proliferation" not "Propagation", as in multiplying or breeding.
December 04, 2009 03:48 PM
Jotaf
Cool! Anyway, you need to make particles check for other particles nearby and have a "pressure" proportional to number of particles; randomly displace the particle proportionally to the pressure, that should do it. The problem is that many particles accumulate in the same spot. They could form a basin, fill up and eventually spill to another basin; the method I described could accomplish that with a couple lines of code :)
December 05, 2009 09:42 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement