Simplest way to generate random dungeons?

0 favourites
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hello everyone, i'm experimenting a bit with some rogue-like elements and one thing that is proving to be very difficult for me is finding a way to do procedural dungeon generation. I've already found some guides or examples around the internet, however, they are way too complex for me. I know this isn't such an easy task but i do believe that the way i'm aiming to do this does not require such complex work.

    For example, let's say that i make 10 different room layouts and, to make things even easier, they are all the same size with no hallways separating them. How could i make it so, at the beggining of the game, the entire dungeon is generated using those different room layouts? Also, how can i make them have exits at different walls (so the dungeon doesn't end up being just a straight line or a square grid)?

    I don't need a flawless system, as i said on the title, i would like to do it in the simplest way possible. I have over 100 hours in Construct 2, but i've avoided most of the more complex features the software offers. After 2 and a half years, only today i've discovered the usefulness of Arrays, even though i'm still struggling to use it. So it's being a little extra hard for me to do this.

    Anyway, thank you in advance. I love messing around in Construct and trying to figure things out by myself but this time i just couldn't handle it.

  • Create 10 random sized rectangles in random locations. Draw a line from each (sprite.iid) to the next. Draw a line from each to all.

  • Create 10 random sized rectangles in random locations. Draw a line from each (sprite.iid) to the next. Draw a line from each to all.

    I'm sorry, i didn't understand what you said.

  • You could spawn them rooms on the go. Supposing, for claritys sake, these rooms are simple sprites. You create an image point in each door. Then as you approach a door (but before it's seen on screen), you spawn room number random(10). You'd still need to figure something to make both rooms' door connect properly, avoid room repetition, etc.

  • If you want more detail, you'll have to provide some.

    I don't know what objects you want to use.

    I don't know what behaviors you want to use.

    I don't know how big you want anything to be.

  • You could spawn them rooms on the go. Supposing, for claritys sake, these rooms are simple sprites. You create an image point in each door. Then as you approach a door (but before it's seen on screen), you spawn room number random(10). You'd still need to figure something to make both rooms' door connect properly, avoid room repetition, etc.

    I was thinking about doing something like that, the problem is that creating the rooms as sprites would make it extra hard to program collision on them, wouldn't it? Also, most room layouts will have random enemies/items in set positions (i know how to make this, i'm just not sure how would i add this to a room that is just a sprite). But maybe these two things are simpler than i think they are.

    (Oh, and about the "You'd still need to figure something to make both rooms' door connect properly, avoid room repetition, etc.", those are indeed problems, although they will be easily solvable if i manage to use the method you suggested).

    Either way, thank you for the answer.

  • If you want more detail, you'll have to provide some.

    I meant i actually didn't understand what you said on your previous reply, not that it didn't have enough detail. I didn't get what your instructions were.

    I don't know what objects you want to use.

    I don't know what behaviors you want to use.

    I don't know how big you want anything to be.

    I don't know which objects or behaviors i will use, it will depend on what answers i get, if people tell me it will be easier to do it using tilemaps, then i will use tilemaps, if they say arrays, i will use arrays, anything is fine, really. (Oh, and the size won't matter. My plan is to make a very big map, but for experimental purposes any size will do, as long as i understand how it works).

  • Tilemaps would be the simplest.

    Using Erase tile range to create the random rectangles.

    Using Erase tile and some trig to create passages from the rectangles.

  • newt means actually generate random dungeons... cos what you're pointing is not real, procedural generation, but some random assign of premade rooms... and i say you stick to that, unless you wanna go into heavier coding.

    [quote:31sg2liu]But maybe these two things are simpler than i think they are.

    I'd say they are. Anyway the sprite could work as a "template" for the room, and onCreated it could spawn its own walls, wandering monsters or whatever. I dunno. There's always many ways...

  • newt means actually generate random dungeons... cos what you're pointing is not real, procedural generation, but some random assign of premade rooms... and i say you stick to that, unless you wanna go into heavier coding.

    [quote:1rr0icxz]But maybe these two things are simpler than i think they are.

    I'd say they are. Anyway the sprite could work as a "template" for the room, and onCreated it could spawn its own walls, wandering monsters or whatever. I dunno. There's always many ways...

    Yes, random assignment of premade rooms is what i had in mind. Of course i won't stick to 10 room layouts, i plan on doing many more. Plus, instead of they having the same enemies or items, they will have certain spots that may or may not spawn enemies or items, adding more variety.

    As for the sprite working as a template, i could use image points to set where some things will spawn. The collision walls are what's mainly bothering me, since i would have to put image points at each wall (since the same sprite can't have multiple hitboxes). But anyway, i'll try to find a way.

    Later today (or maybe tomorrow) i'll try to experiment a bit using your idea, and will report back with the results.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes! I did get it to work, thank you for the help. Everytime the player goes through a door, the game randomizes a number that is responsible for choosing a room, which is then created (as a tilemap) at the correct distance. There are different events depending on which type of door you touch (left, right, up or down) and some rooms are restricted to appearing only from the sides, the ceiling, etc.

    Anyway, it did end up being way more simple than i thought, so again, thank you for the help.

  • DarkDemon

    Here is an example. I get rid of lot's of things like walls and other stuffs because I was using it in another project.

    You can start from here and then add walls which is basically checking the edges. You can use the array I was using to see where is ground and where is not ( value 0) so you know where is the edge. And make sure to enlarge the passages enough so your walls don't block it.

    https://www.dropbox.com/s/388lo3tgqa4fw ... .capx?dl=0

  • DarkDemon

    Here is an example. I get rid of lot's of things like walls and other stuffs because I was using it in another project.

    You can start from here and then add walls which is basically checking the edges. You can use the array I was using to see where is ground and where is not ( value 0) so you know where is the edge. And make sure to enlarge the passages enough so your walls don't block it.

    https://www.dropbox.com/s/388lo3tgqa4fw ... .capx?dl=0

    For some reason i couldn't open your project. It is saying i need to upgrade my version of C2 to r237. And as far as i know, the newest version is r233.

  • Check out releases.

    https://www.scirra.com/construct2/releases

    Some are considered stable.

    The betas are pretty much guaranteed to do less damage than a Samsung.

  • The way I did it was to generate random rooms of different sizes using the default grid. It keeps checking until it can place the room somewhere suitable.

    Check out http://plinkie.neocities.org/ and keep refreshing/reloading the game. It generates 3 little rooms each time in close quarters at random spots, with the 'boss' being inside a room and the 'player' being outside of the room spawning at a random location.

    I'm going to expand this to generate tinier rooms and then go on to spawn other enemies at random inside the rooms using enemy counts. Then onto the actual gameplay I guess...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)