0 Favourites

Generating premade rooms in random sequence.

  • I'm currently working on a platformer rogue-like game but the thing I'm struggling with is generating the rooms in random sequence. All my rooms are premade but I want then to be generated in random sequence and connect properly.

    The rooms can be made of left/right entrance but sometimes also up/down or both up & down. They shouldn't repeat also. The thing is, how do I make them all connect properly and prevent the existence of entrances leading to nowhere? Some examples would be really appreciated.

  • You probably want to look into procedural tilemap generation. There's lots of way to do it and the general idea can be translated fairly easily into many engines/programming languages.

    https://www.scirra.com/tutorials/1112/procedural-dungeon-generation-a-roguelike-game Seems like a good start but it doesn't use tilemaps.

    I recommend you look into how you'd code it to fully understand. Tilemaps and arrays go together really well because they both are conceptually a grid.

    Put simply, it moves across each tile in a sequence and applies actions to each tile based on a bunch of conditions you set. If you set the right conditions and actions you'll end up with what you want.

    Edit: This looks like maybe a better tutorial https://www.scirra.com/tutorials/1123/smarter-procedural-roguelike-dungeon

  • I'm not sure if that will help me, maybe I'm too newbie in this kind of stuff, but I will try to explain again. My rooms aren't based off grid tiles and they are all premade by me, all on separate layouts. Some of them have left/right entrances, some of them have up/down entrances, and some of them have left, right and up etc. just like Rogue Legacy for example. And my problem is, I don't know how to connect all those rooms based on the entrances, so there are no entrances going to nowhere and everything connects in a smart way. So I want to have rooms created by me be generated in random sequence with every run.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hi MozayKnows

    So, if you want to leave a room by the right, you need a way of seeing a list of rooms with entrances on the left but which haven't already been used in your game?

    Could you create some arrays - rooms with left entrances, rooms with right entrances etc. and then use the randomize function to select a particular qualifying room?

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