Make rooms and exits?

onimike
09 Sept 2016, 00:31Hello all, I have topics on room generation mainly from pixes Deeper game but wanted to know how to implement something like that to my game like you exit a room and a room and exit spawns to line up with other room. Any help is appreciated as I need a island worth of rooms but with same things in them.
Mike
hegemonkhan
09 Sept 2016, 04:22there is Pixie and Jay library files/guides on/of this stuff, just search through the 'libraries and code samples' forum... one whatever pages, you'll find them... look for 'pathfinding and/or random map/grid/room generation' -named type of threads.
http://textadventures.co.uk/forum/samples/topic/3214/path-library
http://textadventures.co.uk/forum/samples/topic/3546/map-generation-demo
http://textadventures.co.uk/forum/samples/topic/4280/move-to-an-undiscovered-room

onimike
09 Sept 2016, 04:52Thanks as always HK one more problem though I can't add any library's to my game, even if I add library where my game is nothing it never shows up. Any idea what could cause this?
Never mind I had to manually add code in thanks again.
Mike
hegemonkhan
09 Sept 2016, 06:18ya, you got to have the library file in the same folder/location as your 'quest.exe', AND add in the code line for it too, into your game file's game code.
The Pixie
09 Sept 2016, 07:04The library file has to be in the same location as your main game file, not quest.exe. You should never have to touch anything in the folder quest.exe is in.
If you add the library through the GUI interface, Quest will add it to the game code, and copy it to your game folder for you.
The Pixie
09 Sept 2016, 07:18With regards to the OP, I take it this is more about an algorithm to create rooms in a logically structured map, rather than the code to create an exit or a room. I kind of feel like a magician revealing the workings behind the magic, but anyway...
The way I did it was to have each level generated at a time, rather than 1 room at a time. Each room has a position in a grid, and is named on that basis, so room_3_5_2 would be on level 3, five to the east and 2 to the north. This is important because it means you can iterate through them once they are created (GetObject("room_" + level + "_" + east + "_" + north)
).
Step 1: At each location in the grid, there is a certain probability of there actually being a room there, and that probability decreases the further it is from the centre of the grid.
Step 2: Go through each room and see if it has an adjacent room to the south; if it does there is a certain probability of an exit to that room, and from that room to this room. Do the same to the east.
Step 3: Check every room can be accessed from the centre. Any that cannot get deleted.
Step 4: Give the remaining rooms their descriptions and other features.

onimike
09 Sept 2016, 13:22Thanks HK I figured it out d Pixie I tried from the GUI editor it does not work any more cause I have been trying for days lol. Its like HK said the Library has to be in game file the have to add code, the last part got to me as I don't mess around a whole lot in code but know things would be some much easier if I did lol. And Pixie wow thanks for the reveal but you need not worry from me I don't think I'll be messing with it seems a little more advanced then just create room and create exit lmao. It would be perfect to generate a island but I can manually generate it even though its so tedious mostly connecting the exits, but anyway thanks again to both of you man where would quest help be without you both.
Mike
hegemonkhan
09 Sept 2016, 19:32HK tries to make a mental note that it's just the game file that the library needs to share location with, and not the 'quest.exe', thank you for the correction, Pixie, and sorry onimike for the wrong information.