procedural generation and connecting layouts

Get help using Construct 2

Post » Wed Oct 02, 2013 5:45 pm

I've downloaded the free version of construct and I've been doing tutorials for the last week on platformers and arrays, and looking at some procedural generated arrays that create random layouts.

I really like construct 2, it feels almost like the Starcraft 2 editor.

Here is my question / problem:

I've learned how to "teleport" the player to the next layout when they leave through a door, and appear in the next layout.

I want to create something similar to rogue legacy. The rooms / layout are pre-made, but they are connected randomly. So the game would have to know which rooms have doors on their left, right, top or bottom and which don't, place a room next to it that fits that criteria, and do it again until finished. It would also have to remember the the order, so they player can back track, and possibly create a mini-map of the floor plan.

It would also need to be able to loop around, find a room that has already been placed, and connect to it if possible.

I fear I've bitten off more than I can chew, I just can't wrap my head around getting it to work.
B
1
Posts: 1
Reputation: 127

Post » Thu Oct 03, 2013 10:13 am

It's not that hard. Use an array. Different values in arrays could mean which room to load. "0" would mean no room there.

Then you can make a nice loop to check for each array location to check neighbouts, and if 0, no door there. If not 0, there is a door. And to which room that goes is defined by the neighbours "number".

Only difficulty lies in rooms that have more than one doors towards same direction. Imagine a large room with two exits to right. For this to work, the large room itself should take two "squares" or "positions" in the array.

Or you could use a 3D array perhaps?
B
18
S
4
G
1
Posts: 332
Reputation: 3,149


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, michaelverdi and 23 guests