Hi all,
I am developing a basic roguelike, I have a ok UI in place and for the first time I managed to make my dungeon rooms generated at random, this works well, I also place a single door at a random location in each rooms however I cannot for the life of me envisage how to connect these rooms up with paths, could someone explain to me how I can do this in a procedural way?
My current system works as follows:
I have a SCREEN array which has all the asci in it e.g '#' , '.' and '+'
I have an SFLAGS array which clones the screen array except that it has the following in the array :
#define FLOOR 0x1
#define WALL 0x2
#define ROOM 0x3
#define DOOR 0x6
#define UIHPBAR 0xA
I have a third array named PFIND which is made up of:
#define NCONN 0x4
#define CONN 0x5
(NCONN = not connected, CONN = connected)
for the PFIND array Im not sure if I have done things correct, basically everything gets marked as CONN except the room walls which are NCONN
I have another array called COORDS which is a 1d array only and is the format off
coords[x] =<room number>
Coords[x+1] = <rowCoord>
Coords[x+2] = <colCoord>
I could have saved on the arrays by using structures but I will tidy up later.
so in essence I have say 2 randommly generated rooms
I am unsure how to get the paths to connect the rooms from this setup and its the only aspect I need to understand and I know I can make a roguelike since I have done other aspects####### ###+##
# # # #
# + ######
#######
note the formatting of my room is lost
also what constitutes a path in my rl is something the is 3 squares with , is bordered with 2 walls and has dots in the middle
Any help is greatly appreciated