Saturday, October 29, 2011

Randomized metroidvania 02: map connections

The rooms are now connected! I used a very simple method that's guaranteed to connect and will even create loops to join different "branches" that happen to be near by.




to connect a room:
    after placing a room
    get a list of all adjacent cells that are in a room
    randomly pick some cells to create doors

This can create multiple opening between two rooms. That's not a problem yet but it could be tweaked later on. This should be enough to create the gameplay portion but I'd like to work on defining different regions at the world-gen level before I move on to creating a player to run around.

4 comments:

  1. Thanks once again for sharing this! Your solutions are so elegant in their simplicity.

    Will you be showing any sample code excerpts for this "Metroidvania" series?

    ReplyDelete
  2. @KC, I may show some code but probably not. I do plan on describing the algorithms I use though.

    ReplyDelete
  3. I was wondering, how are you storing the connection points? Are you flagging cells? Holding a list of all exits from a room in the room?

    I'm sort of delighted and disappointed you don't have any source code posted. I have everything up through regions done, except the doors.

    ReplyDelete
  4. @Dhinanta, At this point, the world is just a list of rooms and a list of doors. Each room also a references to it's doors. I've also tired this with a 2d array of screen-sized tiles where each tile had 4 sides that were WALL, OPEN, or DOOR. That also works well.

    ReplyDelete