How to create new Layouts in-game? (Rougelike Proc-Gen)

0 favourites
  • 6 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • I'm learning how to accomplish randomly generated layouts for my Rougelike project. I believe I can figure this out on my own.

    However, I want the player to eventually leave that one "room" and advance to another room that is also randomly generated. I also want the previous room layout to be saved so they can return to it. I believe that the best way to do this is make every new room a new layout. How would I accomplish this though?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are many resources online describing algorithms to accomplish this kind of thing, and even a plugin or two if you search the add-ons forum.

  • I know it's just I've searched both resources and I couldn't find any on my own is the issue, hence the post :u

  • https://www.scirra.com/forum/roguelike-plugin-c2-rot-js-interface_t118452

    edit: this is just to generate a whole level, I guess it doesn't really answer your question. I'm not sure why you need a layout per room.

  • Thanks! I spent the day reading that and although it has helped me along well in my progress of a Proc-gen system, it still doesn't answer my initial problem.

    I know now that Creating a new layout for every new cell is not ideal. Rather I'd like to create a dictionary or array to do this instead. I still don't know how though. I know how to work with both when it comes to individual values but not complete game data.

    My issue is: imagine that plugin generating a whole layout with rooms and such. Then at the end of said level a door opens up to a new "cell" that's completely regenerated and procedurally made. Now the player is required to go back to the first randomly generated room. This is what's stumping me.

  • The basic idea is:

    The random numbers that you get from the random number generator depend on the initial number that is used to seed it. If you start with the same seed then you get the same sequence of "random" numbers every time.

    You take a random number generator that lets you specify a seed. You give it a random seed and then generate your level. Generate a random x position for an object, generate a random y position for an object, generate a random number of enemies, etc. You save the seed for later. When you want to recreate that same level, you just use reseed the random number generator with the stored value and create the level again. Same random numbers = same layout.

    Here's an example using the RandomPlus plugin:

    randomSeedExample.capx

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