Monday, February 27, 2012

Keeps You Guessing

A few days after starting my project I have come up with a basic dungeon map layout builder. The actual tile map that the player will see will be built based on the layout that this chunk of code will spit out.

What the code does is starts ("S") a dungeon at the surface (top) of the map, or just below from the side to allow a different style of entrance. It then branches out in random directions (weighted depending on the type of level) and lengthens rooms randomly, adding a door ("D") at the end. If a dead end is encountered before the minimum amount of spaces are used, then a treasure room ("T") or key room("R" for red keys, "G" for green, "B" for blue) is created, and the program backtracks to another room, starting again with colored door for keys when applicable.  When the number of dungeon spaces are acquired, a door to a boss chamber will be created in the end of the dungeon("X").

I'm now trying to figure out what scale everything is going to be in so I can start developing the tiles for the tile map. I'm not a great artist, but at small scales it may be doable. If you would like to help, that would be great too! I need to find a program that edits tile maps easily and efficiently. Research is still in progress...

See below for some dungeon outputs the code spits out so far! I generated all of these in a row. I did not pick and choose my favorites.

The first dungeon features an early green key room, which unlocks the door allowing you to venture downward. The bosses chamber is located halfway down, but for the true treasure hunter, they will continue down the treasure room located at the deepest depths of the dungeon. 
The second dungeon offers a choice to the player. With the first blue key they find, will they open to door that leads to the boss chamber, or will they open the door to yet another key, making the player venture back and forth through dangerous corridors.

The third dungeon is a straight run to the finish, probably riddled with traps and dangerous creatures whose loot can be just as useful as those found in treasure rooms of other dungeons.

Dungeon number four is a fairly easy venture to the boss, however, it may prove quite valuable to look further, acquire the blue key to the early found door, leading to a treasure room.
For this fifth dungeon, I doubled the amount of room spaces. See if you can find your way through. As you can see, with more densely positioned rooms, you get interesting variations, such as treasure rooms that aren't in dead ends, and you may even find yourself carrying a few keys at a time. Also, if you choose the wrong doors, you can still make it to the final boss, however, you might miss out on the two extra treasure rooms!

2 comments:

  1. I have a question!

    You acquire keys in the rooms labelled with the corresponding letter (i.e. A green key is found in a "G" room), correct? So if this is the case will you only get one key per color per room of that designation or do you just have a possibility of getting one key of each color per dungeon, which would then, in turn, allow you to unlock every door of the same color? If that's confusing let me put it this way: Can you only get one green key in a dungeon and does it open every green door or do you get multiple green keys and they each have a one-time use?

    ReplyDelete
  2. I know what you mean. One use and it disappears. Choose wisely (but don't sweat too much, I do not believe you can get stuck. There may be an item at one point which will allow you to open any one door for free per dungeon, but it will be a rare item indeed.

    ReplyDelete