Friday, December 16, 2011

Virtual Water Movement: Water Flow in Minecraft and Other Digital Worlds

I've recently become rather addicted to Minecraft, a computer game with a highly modified world of blocks of different types that you can modify and move to build structures and search for resources in an effort to survive.  By day (for about 10 minutes) you can wander the huge, complex, randomly generated world, gather resources, cut and plant trees and crops, and explore, but for the 10 minute night zombies and other monsters emerge and you must retreat to your fortress or go underground to mine for minerals.

When I first started playing this game, my friend told me that I'd probably really enjoy it, except for how the water works.  He's right - modeling water flow is incredibly complex, and it doesn't make sense for a game like this to try to develop a realistic model as it would be a huge drain on computing power.  To someone like me obsessed with water flow, the way water is modeled is silly and a bit frustrating - but not enough so to detract from the enjoyment of the game.

2011-12-15_22.06.37





Virtual worlds and computer games have long struggled with how to represent flowing water in a way that creates an immersive environment but doesn't take up so much computing power that it slows everything else down.  SimCity 2000 allowed you to place water anywhere, and created waterfalls when the water dropped in level.  As a consequence, I remember covering huge areas with waterfalls and building dams on them for free hydroelectric power.  The Civilization series generally did a good job generating rivers on their random maps, but sometimes created irrational rivers that split randomly or flowed out of one ocean into another (later versions seem to do a better job with rivers).  Most of the waterways on World of Warcraft make absolutely no sense, but there is a nice looking delta on the eastern continent.  The goal of these waterways is to create a backdrop for gaming, of course, and most people won't care if a river is flowing uphill when they are killing night elves, but I still always notice and wonder how much harder it would be to create realistic rivers in a game world.

Minecraft strikes a compromise between simplicity and realism when modeling flowing water.  The rules?  Water can flow laterally up to 7 tiles for each tile of downward drop, after which time it 'soaks in' and the flow progresses no further.  If water encounters a drop of at least 1 tile, it can flow 7 horizontal spaces further (but does not add up momentum with consecutive drops).

2011-12-16_13.40.49

Above, there is a source of water in the middle of the 'water pile', and it can be seen flowing outward.

Below, I dug a trench with sufficient drop, allowing a stream to flow off into the distance.

2011-12-16_13.44.35

If trenches and gullies are created, and the terrain is steep enough, realistic streams and even a network of tributaries can be created, as seen in the first image in this post.  However, if water pours down a hill without a defined path, it flows widely, creating unrealistic and bizarre structures.

2011-12-15_22.10.00

It can be fun creating a path for water and watching the stream flow... (people use Minecraft to create anything from models of fictional spaceships to small working in-game computers, but I'm probably one of the first people to try to create realistic watersheds in the game).  By starting at the base of a saddle and working downhill, I created this realistic stream:

2011-12-16_13.55.16

However, once the water finds its way to flat land, I had to dig a deeper and deeper trench to keep the water moving and the creek eventually ended up below 'sea level'.

2011-12-16_13.55.21

It's too bad that a long trough won't fill with water, but there are good reasons for the water in the game to work this way.  With a bucket of water, you can create a permanent spring (imagine how different the Desert Southwest would be if this worked in real life!).  If water would fill any depression, vast areas of the map could be flooded with one bucket.  This is especially a problem on multiplayer servers, where one 'griefer' looking for trouble could flood entire cities.  The computing power involved with creating huge lakes and reservoirs would probably also slow the game significantly.

One of the most interesting things about Minecraft is how it creates a microcosm of human nature and our actions that were, perhaps, fully justified at the time, but have caused so many long-term problems.  You start the game with nothing, cut down a few trees to make tools, mine to get coal so you have light to keep the monsters away.  You have to build a structure for shelter by nightfall or you will die.  Over time you find you want more - more iron so you can build mine cart tracks so you can dig deeper and find diamonds you need to create stronger tools; a larger base so you can store supplies; farms and livestock paddocks and tree plantations so you don't have to roam in the dangerous wilderness hunting for food.  Soon, the beautiful, randomly generated world starts turning into something else - a combination of the starting conditions of the world and the products of your labor and design.  The game doesn't, so far, model long-term environmental issues - erosion or drought caused by removing too many trees at once; rising sea levels caused by climate change due to burning too much coal; runoff from mines ruining water supplies...  I find myself channelizing streams in-game, even though in real life such an approach is fraught with trouble.  In a simplified sense, Minecraft is a simulation of the progression of humanity, from when we first started using tools to when we criss-crossed the world with mines and roads and pushed the 'wilderness' to the verges and least inhabitable areas.  Perhaps the next version of Minecraft, or some other similar game, will address what we do next - how we reclaim the beauty, emergence, richness, diversity of the world we first started out in, without throwing away the creativity of billions of hard working, inspired people, without having to hide inside at night for fear of zombies.  Or, perhaps it is impossible to create such a simulation before we first figure it out in the real world.  Either way, I look forward to the future and the increasingly complex virtual worlds where we can experiment and, in their reflection, realize truths about the one real, vast, powerful, and in some ways surprisingly fragile planet we now call home.


***Update:  I did figure out a way to continue waterways through flat areas.  It works pretty well and looks fine but it doesn't flow any longer so you can't use it to transport things.  Still, it does make my task of installing realistic tributaries a bit more feasible.***



2 comments:

  1. Terrific experiment! And a fine example of Minecraft as a teaching/learning tool.

    ReplyDelete
  2. Are you looking for an Australian Minecraft Tekkit server, one right in your backyard? Tired of playing on Minecraft hosting servers outside the country, with too much lag and a base of players that don’t speak your language or aren’t on when you want to play? It’s time to take a look at our growing community.
    We’re a solid new survival multiplayer Minecraft server running Tekkit, the multiplayer port of the hugely popular Technic mod to Minecraft. As you probably already know, Tekkit adds a host of new technological options to SMP, reinventing the game entirely. Anybody can do a little mining and craft a diamond pickaxe. The Tekkit and Technic collection of mods challenge your mind and mastery of the Minecraft universe by introducing ways to construct incredible machines, allowing you to automate mining, manufacture materials, or even create your own fully-functioning computer. Where Tekkit’s concerned, the only limit to what you can accomplish is your own imagination.

    ReplyDelete