Wednesday, April 28, 2010

Dwarf Fortress Settles Down

Once a world exists in Dwarf Fortress, you can then start the game. Obviously, but it's not so simple as click start and go.

First, you need to pick where, in this vast vast world you want to begin the game. Do you want to start in the arctic, in the desert, the mountains, the forest? Each has different resources available and thus different challenges for the player.

There's lots of different options between those few generic choices, too. Do you want there to be sand to make glass? How about coal? How plentiful and near the surface is the magma? Do you want a lot of plant life nearby? How about animal life for hunting? What races do you want as close neighbors? How about soil to grow crops? Each of these has a strategy and costs and rewards associated with.

Most of these things will make your game easier if chosen right. Lots of coal, great - you have easy metalsmithing. Lots of sand, glass is really valuable! Lots of plants outside? Wood, and food. A lot of people choose deliberately harder starting areas to have more fun while playing, because as DF is still 'in alpha' that means there is no real goal. Much like simcity, actually. You have to make your own goals, the biggest of which is to pace your city's growth so as to avoid having other civilizations become jealous and attack you before you're ready.

But this isn't about gameplay yet. This is bout picking a location for your fortress. Ultimately, I prefer to choose a maps with a river, lots of rock, and some trees. But, there have to be balancing acts there too. If there's rock that water can seep through, your fortress is quickly going to flood. If there are no trees, you'll have a hard time buildng beds (sleep on a rock? silly man). It' really interestng, but as everything else in DF it's probably a lot more complex than i really needs to be. Certainly far more complex than I need for tinygame.

Tuesday, April 27, 2010

Dwarf Fortress Builds a world

The best place to start with dwarf fortress would be the same place the game does. Generating a world.

I don't pretend to udnerstand everything that goes on behind the scenes in the game, it's incredibly detailed and complex, but this is what I understand.

First, one of several types of maps is selected to generate. This could be a pangeta, several continents, or a land-based world, where the oceans are less common and more intersperced. From that, it builds a randomly shaped landmass of a few thousand grid spaces to a side. Each space is randomly selected to be from a biome (that is, the type of rocks in that section of the world map) based on it's Y location in the world, and closeness to water.

Then, it shakes things up,and adds elevation to the areas, which has the effect of creating seas, mountains, and valleys and such. Then, it adds the temperature. Towards the ends of the map are ice caps, towards the middle it's much hotter. This will effect the creatures and plants found in that area.

Next, it adds rivers, by selecting coastlines, and basically blasting inwards randomly, creating very river-like rivers. They sway all over the map, and it's pretty cool. Then, it does lakes. I'm pretty sure all lakes are tied to rivers, but like I said, I don't know everyting.

After it does that, it actually generates the specific content of those tiles. It determines the exact stone, plants, wildlife and so on in each area of the world. It decides if an area is full of predators, or calm. If the area is evil or good, and if evil whether or not it's a full-undead map.

Then, it creates civilizations, and megabeasts like dragons. And if that's not enough, it simulates a thousand (by default) game years of cities rising, falling, killing and being killed by beasts. Heroes rise and fall, gods fight demons and demons eat civilians. The races war it out and make peace. And it writes it all down so that you can look t it later, and your dwarves can talk and write about it in the game. They do a lot of writing.

I don't think Tinygame would need this level of detail, but a good degree of it can't hurt, eh?

Monday, April 26, 2010

Smells like dwarf fotress

I'm sure you're asking - what's happeed to you, Ronars? You had been just getting back into the swing of things, ad then you disssapeared!

http://www.bay12games.com/dwarves/

Dwarf Fortress happened, is what. I thought I was clean, I swear. Then a new, major update was released, and I was like 'oh, one fortres won't hurt'... I've only put maybe a dozen hours ino it, but those hours are almost exclusively from time I should have been working on tinygame, so I'm a bad person.

But at least I can blog about it, as Dwarf Fortress is probably the single biggest procdurally generated game out there. Even bigger than Diablo, though less mainstream. I'm hoping I an tear myself away from the game long enough this week to actually blog about it. Wish me luck.

Friday, April 9, 2010

More Dungeons

So, I was talking about tinygame a while back, and it was pointed out to me that when I'm talking about procedural dungeons, I'm the one writing the specific, and in this case short, procedure. There aren't a infiite number of dungeons that can be generated, there are a finite () number of them, all in one specific style.

It's undoubtedly better than spagetti dungeons, but it's still not exactly what I want. Close, but no cigar as it were.

So, for now, I'm adding in another few types of dungeons as I work my way towards code that will generate a huge, sprawling dungeon. The first is a massive, single floor room. Not the best dungeon, and something that would have made sense to work on first, but it was easy enough to implement. One big room, boring. I'll probably remove this before I'm even done.

Next, I made a change to something that had been bothering me. Towers used the same random generation code a the rest of the dungeons. Which means that the first floor could be a tiny, 5x5 hut, and the second a massive 30x20 labarynth, suspended inexplicably off the ground. I've changed it, though it's still not perfect. The bottom floor generates normally, but as the floors increase, the tower remains a simple shape, and gets narrower and narrower.

Small progress, I know, but progress nonetheless.

Tuesday, April 6, 2010

Exploring the world

Tinyworld is coming along well. I managed to fix all the issues with items displaying in the game world, all the issues with multiple floors, and all the issues with things drawing off the edge of the map. Great!

However, this brings me to an unfortunate point, one I knew would come (because I'm not the most efficient coder). The game is slowing down the more content I add in. The effect is certainly not as large as when things were drawing wrongly, or on the wrong maps, but it is there. The game is just a hair slower now than it used to be, and I've only got two dozen small maps.

Which means, as much as I didn't want to, I have to turn off the bulk process of every tile in the world, every clock tick. I really want the world to be living, so I'll have to come up with a more general way to handle this, perhaps running through each map the player isn't on one at a time (and thus much less frequently), or perhaps finding a more generalized way of handling them. Regardless, I have to make other maps static for now.

There's been a tiny bit of progress in working on the world, though. I know there are a few things I need to get building before I'm fully into an alpha though - towns, roads, more than the one type of dungeon, and so on.

Roads, is what I started with. They're the easiest. Of course, they're not randomly generating yet, but what I have working is that a map is chosen, and then a width, and weather the road runs horizontally or vertically. It then recursively calls each adjacent map and draws a road in the same position, direction, but one width smaller. And so, you can follow roads to their sources - which will eventually be towns. There's another thing I'll need to add, a source direction. This way, when you're on a map, you'll be able to tell which direction the road on it came from, and you won't need to guess. It'll be handy for dungeons and such, too. Put a big crosshair on each dungeon so you know when you're walking near them.