Sunday, February 28, 2010

Going Underground

You know what difference is between a building on the ground and a building underground? A front door.

I've been working on tweaking spawn points, item generation, and a number of other little adjustments to tinygame, none of which would make good blog posts, really, but one thing I did accomplish that's worth talking about is the creation of underground dungeons.

Now, before this point, there were staircases randomly generated on a map that would link to a staircase randomly generated on a different map. Good for them, that part had my brain wrapped around it like a small slice of lemon wrapped around a large gold brick. Now that I have staircases working, the next step is to get them working predictably.

The first item of business was to have the staircases generated only inside the buildings. So, after randomly generating a spot inside a random room (tweaked of course by my code which now almost always works for getting items inside rooms). So the staircase on the ground floor where I had the building now appeared inside. Unless the building was really small, then it occasionally appeared inside the walls instead. Like I said, not quite perfect.

Now that we had it appearing in the building on one floor, we needed it to appear inside on the next floor down (down being my decided direction for this first generation to go). But all I had was code to generate a randomly colored ground with a building with a nice front door. Obviously, both of those had to go.

I added new ground tiles to represent being underground, (and ones to represent sky, though they're not in use yet), and added a new algorythm to generate a building without a door, for use on non-ground floors.

And, now we have actual floors underground! My next planned step is to properly tie the spawn points to rooms in the dungeon - so you no longer see the monsters all wandering around underground, outside the dungeon!

No comments:

Post a Comment