2,3,4 - Done
1 - Will try to keep in mind.
Do you not like indexes within indexes?
how do you feel about parsing buffers with pointer arithmatic?
Each room ID, corresponds to its’ index for the array that holds all the room data.
Each object within that array has the attributes N, S, E and W for North, south, east and west respectively. These hold the IDs for the rooms connecting in that direction. the value within the index map.locations[roomdraw].N returns the index of the connecting room which subsequently passes as map.locations[index].Type, returning a string indicating what kind of room it is (Hallway, Living room, bedroom, ect).
Basically it says that if this room is a different type to the one north of it, place a door.
It is being handled in a better way now, where I check these type comparisons while placing the rooms and simply write a string for each room indicating where the door, wall and open-air placements should be.
On drawing the room using your function in the main code, I just check if that string is populated by nsew characters and call the relevent object functions if needed.
Room types also dictate what rooms can be spawned from them (EG you can have a bathroom spawning attached to a hallway or bedoom, but not a kitchen). For now this helps generate rooms in a branching tree fashion, but ultimately it should help when these various room types start getting populated by approriate furnishings.
I have made some more progress integrating my mapgen code with the current code.
This is still in my branch and does not yet have the jinn code added. That will need to come next
Although still far from perfect.
The game does not seem to spawn the player or apply lighting effects when the house contains 100+ rooms.
I currently have the generator set to generate upto about 70 rooms.
The Crafty viewport functions also seem to not be working.
I had to disable them to get those images above, with these functions present I just get the green background from the Crafty windown with no rooms, player or lighting effects.
You might notice in the last image, there is no wall between the current player room and the room to the north. This is due to the rooms being of the same type causing them to be drawn as 1 larger room.
If possible I would like to have the lighting effect extend to these connected cells, otherwise will need to work out how to define larger roomsizes in the generator along with the additional locations for doorways.
At this point unfortunately however, I will have to put my work on hold as tomorrow is the last night before I head overseas and we have to leave at 3am to head to the airport.
If you want to put this all on hold until I return then I would be happy to pick this up again from this point later, otherwise you can take what I have so far and run with it.
Edit:
I have disabled the Crafty viewport functions in the main code and instead added a viewport ‘CentreOn’ command on the player movement code. The results are perhaps a little slow, but it looks cool.
Though currently the lighting effect is limited to the starting location.
Taking a quick walk around the generated structure, I am quite pleased with how it has turned out so far
There are some nice winding corridors, little branching paths I am guessing are bedrooms + ensuites, interconnecting rooms, paths that branch off, to connect together again later…
Final edit;
Okay, it is 2am and I got as much working as I can for now, I go to push my work and git starts complaing about my branch having a broken ref…
warning: ignoring broken ref refs/remotes/origin/severok
Not sure how to resolve it, and honestly this time of night it would be stupid to attempt anything.
I have uploaded my current code to my previous repo https://github/severokst/JSTest.
You can check it out there for now, and Insha Allah I can get what ever issue has occured now, resolved