Simplest way to generate random dungeons?

Get help using Construct 2

Post » Sat Oct 08, 2016 10:00 pm

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.
B
5
S
1
Posts: 7
Reputation: 337

Post » Sat Oct 08, 2016 10:37 pm

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.
Image ImageImage
B
171
S
50
G
179
Posts: 8,394
Reputation: 113,482

Post » Sat Oct 08, 2016 10:40 pm

newt wrote: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.
B
5
S
1
Posts: 7
Reputation: 337

Post » Sat Oct 08, 2016 11:35 pm

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.
B
23
S
11
G
6
Posts: 181
Reputation: 5,010

Post » Sat Oct 08, 2016 11:38 pm

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.
Image ImageImage
B
171
S
50
G
179
Posts: 8,394
Reputation: 113,482

Post » Sat Oct 08, 2016 11:53 pm

megalocrator wrote: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.
B
5
S
1
Posts: 7
Reputation: 337

Post » Sun Oct 09, 2016 12:01 am

newt wrote: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.
newt wrote: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).
B
5
S
1
Posts: 7
Reputation: 337

Post » Sun Oct 09, 2016 12:08 am

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.
Image ImageImage
B
171
S
50
G
179
Posts: 8,394
Reputation: 113,482

Post » Sun Oct 09, 2016 12:16 am

@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.

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...
B
23
S
11
G
6
Posts: 181
Reputation: 5,010

Post » Sun Oct 09, 2016 12:27 am

megalocrator wrote:@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.

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.
B
5
S
1
Posts: 7
Reputation: 337

Next

Return to How do I....?

Who is online

Users browsing this forum: CreativeMind, jezjones24 and 17 guests