I know you were burning with desire to know this, actually probably (if I'm able to re-enable comments without being spammed into oblivion, er, please don't sue me bethesda) I will get a lot of comments telling me that I don't know what a vector field is or that I'm slightly wrong. Whatever!
Take a piece of graph paper. On each square, draw a tiny arrow. It can point in any direction at all. Some arrows can be longer than others, these are "stronger".
You can do some fun things with vector fields, it's actually a simple concept. You could put a little bubble into it and use those arrows to apply forces to the ball, depending where it is. You could turn those arrows around randomly a bit and create some kind of turbulence (Major Tom does not do this though and I like somebody's explanation that the bad steering was not due to unseen atmospheric effects, but Space Gin.)
This is a cute example of a vector field. Remember this level in Cave Story?
Screenshot borrowed er stolen from Prof's Let's Play Cave Story.
VECTOR FIELD! Each tile has a water flow direction and they push you around.
Those little arrows in the vector field don't have to represent forces, though. They could represent something... else.
Lately you must have been thinking, "How can I use vector fields to make rivers in a terrain algorithm?" I know I sure am. I've been thinking about it every day for like 3 days or more, maybe has it even been a week?
"Oh, Richard Gere, I'm so thirsty after you rescued me!" "Here, Gwendolyn, drink the water that has accumulated on this leaf!" "You are so rugged to think of drinking water from a leaf! Let's have an awkward near-kissing moment" "Ooh that's good, but Sean Connery won't like..." YOUTUBE LINK. Consider yourself warned.
We think of rivers as lines of water that flow. But are they? What's a river, really? I think it's something far more elusive.
A raindrop falls on a leaf, but is this part of the river?
It joins another raindrop, and they run down in a nearly-straight line-- is it now?
It lands on the ground, where it mixes with soil and pushes some other water out further down hill, which forms a tiny dribble of water running over rocks. That moves along, joining another dribble, and so on, until it's a creek, and finally the mighty Elbow River that runs through my city, claiming hundreds of cattle each year (not really, but... people do lazily float on it in dinghys.)
I have forded the Elbow in places, which by the way is a fun hobby (fording rivers.) Leave your shoes on and point your bike up river, if you aren't going to carry it over your head.
Well it's more complex than that. But my idea is to model rivers as a vector field representing water flow. An arrow's magnitude represents the amount of water flowing, scaled in some way. An arrow's direction represents the direction of flow.
We iterate the algorithm over terrain like this:
For a randomly chosen terrain point P:
Eventually, we want to convert this into rivers. Not hard!! We just determine where there is water flow stronger than a certian limit, by comparing each |P.water_v| (the length or magnitude of the water flow) we can determine if the water flow at that point is strong enough that there would be visible water overtop of the terrain.
If there is, again we have to specify water depth. The water depth at each point should be a factor of |P.water_v|. We can use the actual direction of flow to create various effects! After all, it's a simple vector field-- step into, it could apply a force, or even just generate a frothy animation on the upstream of the object immersed, or we could put little chevrons to show the direction of flow, etc. etc.