Random roguelike map

Started by
3 comments, last by menyo 12 years, 5 months ago
I have started working on a roguelike game since a lot of them are or way too awesome without graphics, or to boring with good graphics, or are way to complicated for beginners. Not that i can do better but i like the genre and i think it will be a very educative project. This probably won't get near as good as some titles out there but i will do my best to stay focussed on this and put as much time in as i possibly can.

I'm aiming on starting small, get some action going in a random dungeon and expand on that. I have some great ideas including a random world map with continents, coastal capitols to move to other continents. The player will start out somewhere in the middle of the map and the difficulty increases outward. The theme will be cyberpunk, which is a change as well. I am still deciding wheater i make this real time (more hack 'n slash-ish) or semi - turn based with a speed modifier.

I will use this thread to update, get some help and catch some ideas. Currently i'm looking for dungeon generating alghorithms. All the info on this topic is welcome since i need a lot of different types of dungeons/forests and other places that will need to look nice but still randomly generated.

Gz,
Advertisement
Here is my first random algorithm at work. I'm pleases with it but there are a little to many dead ends but that can be fine for some maps imo. I do like to tinker on this a bit further, like carving out some rooms to change the shape a bit and adding some support pillars for the larger rooms. Adding items and monsters to this will be a breeze.


roguelike01.jpg
That's awesome, man! Really cool. :cool:

I hope to one day make something like that!

Keep us updated!
A 30-year-old interested in learning to program by making an old-school, simple, text-only or 2D dungeon fantasy video game.

  • As of 9/28/2011, currently attempting to learn the basics of Python 2.7.
  • As of 10/14/11, Dabbling in C#.
  • As of 10/24/11, decisively surpassed my small knowledge of Python in C#.

That's awesome, man! Really cool. :cool:

I hope to one day make something like that!

Keep us updated!


Hey, it's not that difficult. What i have there is just 1 tile and i work with just colors to test it. Then i generate this with a step by step plan.

1. creat initial room.
2. pick a wall that is not a corner.
3. Create a rectangle that represents a new room. Check the space the new room will occupie if it's free.
4. Create that room, and repeat from step 2.

rectangle is a really nice way to represent rooms. You can also use smaller rectangles somwhere in this step to carve out some shapes from rooms. Or use a switch to pick an action like create a new room, carve something out, create corridoor, etc.
This was a bitch to do on my own but i came up with a very nice algorithm for generating a natural cavern.

What it basically does is pick a direction, generate a 1 by X rectangle strip. Move it 1 tile in the direction each time, scale it up or down and carve out. Whats exceptionally nice (sorry i'm proud of how i did this, so let me brag :D) is how the direction can help with all the math on the rectangle.

Say the direction X is 1, so Y is 0.

i can just do.

rectangle.width += change in width * X
rectangle.height += change in width * Y

Now the rectangle just scales in the opposite way of how it's moving each itteration. When direction is -1 you just make the number absolute.

Another example is realligning the rectangle each itteration.
rectangle.X -= (amount to move) * absolute Y (since when the strip is moving up/down you want the rectangle to reposition itself on the X axis.)
rectangle.Y -= (amount to move) * absolute X

And while i can still optimize the picking of the direction, the below images are generated by only 150 lines of code. Well not the rendering obviously, but the algorithm.

Enough talk, here are some shots.

With some imagination.... 2 fighting warriors. :D
rand1.jpg

Casper the angry ghost
rand2.jpg
Crocodile
rand3j.jpg
And a tree, i could almost post this at a pixel art forum :D.
rand4o.jpg

What i don't like about it are the size of the rooms in some area's, but thats probably solved easily with adjusting the direction picking since it goes over the same rectangle strip a couple of times. So adding some detection of where it has been to it should fix that.

This topic is closed to new replies.

Advertisement