Wednesday, March 30, 2011

But When?!

Coming soon is all well and good, but I want to know when God damn it!






I loved (LOVED!) the last series of Doctor Who, and utterly adored the Christmas special. This is a first. Previous to Stephan Moffat taking over as show runner I enjoyed it sporadically (generally when the man Steve was the writer) and uniformly hated all of the Christmas Specials. Last season was different, though, and hit just about every nail square on the head. David Tennant was a tough act to follow, but Matt Smith rose to the challenge, and sold one thing in particular very, very well: The Doctor is not human. The companions were great, as well, and I'm not just saying that because I find Karen Gillen to be almost supernaturally attractive. Honest.

Final note: River Song FTW.

Thursday, March 24, 2011

Features

So, in my last post I remarked that for procedurally generated landscapes to be interesting, they would need features. But what sort of features was I talking about? Population centres, in particular, tend to to be found close to certain kinds of... things. The first of these which always comes to my mind is the "defensible position." Something like, say, this:

[caption id="" align="aligncenter" width="518" caption="Edinburgh Castle"][/caption]

A lot of the truly great cities in Europe tend to centre around castles, but you don't tend to find castles just plonked anywhere on the landscape. Edinburgh Castle is a good example because:

  1. I think it looks awesome. Look at the way it seems to just grow out of the rock of those cliffs!

  2. It's pretty much unassailable from every direction but one (I think I mentioned the cliffs);

  3. It's on a raised vantage point with a decent line of sight to just about every direction of approach.


It's not the most castle-ey looking castle and it lacks, for instance:

  1. A moat;

  2. The sort of tower Rapunzel might hang out in.


But I think it makes a reasonable example here. I think this is a good rule of thumb: a castle should look good and be well situated (defensibly speaking).

Another feature which population centres tend to spring up around are harbors. They're very important for trade, thus they attract people. Wikipedia served up a reasonable example:



[caption id="" align="aligncenter" width="527" caption="Capri harbour, Italy"][/caption]


Rule of thumb number one for a harbor: it should be at the intersection of the land and the sea, ideally. If we're playing in a fantasy sand pit this isn't actually the only option, but that's a story for another day. The nature of the coast is important as well, though. You need reasonably deep water right next to the land, but not too deep. Lastly, and just as importantly: it should provide shelter. The boats in the harbor need to be able to survive the harsh weather the sea sometimes serves up. A sheltered cove with high cliffs to each side sounds about right, no?

The last kind of feature I'm thinking of here is again something quite important to trade: the bridging point. You need to get your trade caravan across the river (or gorge) which separates the harbor and the castle (for example), thus you need to cross the bridge. The bride spans the river at a conveniently narrow point and it's the only one for miles. Thus, the bridge becomes a nexus of activity and a town springs up there. Over time the town increases in size and more bridges get built. Before you know it... BOOM, Florence!

 




[caption id="" align="aligncenter" width="535" caption="Ponte Veccio"][/caption]

This is, of course, just the tip of the ice berg. We've not even talked about churches, cathedrals, monasteries, oases, and any number of geological features.

Another question, of course is how to go about actual generating the population centres themselves. Well, I'm going to talk more about this later, when I actually get around to talking some other people doing some procedural content related stuff, but here's a little something to wet your appetite:






Cool, no? More about procedural city generation from me later (I don't want to get too far ahead of myself), but you can read more about this project at this excellent series of blogs. Start at the beginning, and be ready to loose a good hour of your time.

Monday, March 14, 2011

Brave New Worlds

If you were writing a taxonomy of stories you might choose books as a good place to start. Flicking your way through the world's libraries, time and the Dewey Decimal System would eventually bring you to the fantasy genre. There is a lot of fantasy writing out there, and you might choose to subdivide it further. A one potential way of cutting it neatly in twain is like so:

  1. Stories set in our world;

  2. Stories not set in our world.


Simple. Harry Potter, for instance is set in our world. That's a big part of the appeal. Likewise so are Neverwhere, Kracken (if you like'd Neverwhere, you'll want to read this), and most of Stephen King's work. Lord of the Rings is not set in our world. Simple. There are other options, of course. What about the  Chronicles of Narnia, for example (which is set in a world beyond our own)? Or Magic Bites* (which is set in an alternate version of our world)? Clearly we're looking at some shades of grey here as well, but I'm sticking the with the original idea while it still serves my purpose.

What is my purpose here, though? Why the ramblings on this most nerdy or genres? Well, I'm thinking about procedurally generated landscapes again, you see. Clearly, if you're generating your landscape procedurally, it's going to be entirely of this world. Existing fantasy landscapes are a good place to look for ideas, then, particularly because they were designed specifically for the purpose of telling stories in.

The quintessential fantasy landscape is, of course, Tolkien's Middle Earth, which looks a lot like this:

[caption id="" align="aligncenter" width="502" caption="Middle Earth"][/caption]

That should look vaguely familiar to anyone who's read the films or seen the books (or words to that effect). There's a definite feeling of size there. Clearly we're looking at a chunk of a continent, split into something not unlike countries. It always bothers me on maps like this, though: what about the rest of it?

There are a couple of well known knock offs of Tolkien's work out there, so why don't we consider a few of those as well? One which used to be close to my heart in my adolescent years is Games Workshop's Warhammer:

[caption id="" align="aligncenter" width="502" caption="The Warhammer World"][/caption]

Now, it should be quite obvious that the good chaps at GW are knocking off more than just Tolkien here. The Big G / the anthropic principle (depending on your world view) could probably claim some royalties here, because the shape of some of those continents looks very familiar. Grand Cathay, indeed. Now we appear to be looking at close to an entire planet, though, unwrapped using something not unlike the good old Mercator projection (or possibly something more politically correct). I assume so, anyway. It's entirely possible that the Warhammer world is flat.


Another world with more than a bit of Tolkien about it it the World of Warcraft:




[caption id="" align="aligncenter" width="512" caption="The World of Warcraft"][/caption]

Blizzard have taken no chances, though. This is a world you can actually go wandering about on, virtually speaking. They've made sure there aren't any inviting edges for you to go wandering off. If this isn't the entire of the world, it is at least self contained. That doesn't stop Blizzard causing new continents to pop to surface whenever they need to make new content, of course.

Okay, I'm only going to show one more, then I'll get to the actual point. This is a big one, though, so take a deep breath:

[caption id="" align="aligncenter" width="502" caption="Westeros"][/caption]

This is also one you might be less familiar with. If you haven't already, I heartily suggest you take a look at George R R Martin's "A Song of Fire and Ice" series, which starts with "A Game of Thrones," which is not coincidentally the name of the TV adaption of the books which starts on HBO quite soon. This is probably the best of the four maps I've posted here, thanks to a fairly stupid amount of detail (click on it, I dare you). This detail is evident in the books themselves (which I have to confess are not for the faint of heart) as well. This giant map actually represents only a smallish portion of the world these books are set in. It makes a good illustration though. We have mountain ranges, plains, rivers, cities, castles and so on.

If I'm going to procedurally generate a landscapes to tell stories in, they need to have at least a percentage of this amount of detail. Take "The Neck," the narrow portion of land around halfway up, for example. The fact that the land perceptively narrows here feeds heavily into the plot at several points in the books. This is a choke point which cuts the continent in half. Likewise, "The Eyrie" (*shudder*) is a fort sitting at the peak of a mountain range. Towns are in places that towns would be placed: bridging point on rivers, sheltered harbors, and so on.

The point is this: my procedurally generated landscapes will need variety, but the right kind of variety. They will need "features." That's the first major problem I'm going to need to work on once the basic engine is in place, but first I need to make a decision: should this be done top down, or bottom up? Or some combination of the two?

First, though, I need some terrain simplification and some unit tests. The unit tests I'm actually quite looking forward to doing (oddly), since I'm going to try doing them in Groovy.

PS I wanted to include the world from Brandon Sanderson's utterly spectacular "Mistborn" series here as well, but I couldn't find a good map online. These books are truly awesome, though. As well as been part of a series, each actually stands alone and completes it's own story, unlike the fast majority series in the fantasy genre. Seriously. Read them.

* Confession: I enjoyed this book, even if there is a gramatical error in the first sentence. The very first sentence.