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.
Thanks once again for sharing this! Your solutions are so elegant in their simplicity.
ReplyDeleteWill you be showing any sample code excerpts for this "Metroidvania" series?
@KC, I may show some code but probably not. I do plan on describing the algorithms I use though.
ReplyDeleteI 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?
ReplyDeleteI'm sort of delighted and disappointed you don't have any source code posted. I have everything up through regions done, except the doors.
@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.
ReplyDeleteNie wiesz, którą stronę kasyna online wybrać? Sprawdzone i niezawodne kasyna w naszym portalu https://top10casinoexpert.pl/casino/22bet/
ReplyDelete