#Pattern Matching for Procedurally Generated Dungeon?

1 messages · Page 1 of 1 (latest)

severe monolith
#

If you have lists of all the rooms, hallways and stairs I really don't see how this is an issue. Create a folder with your prefabs for a floor, a stair, a wall, ceiling and door and then iterate through your rooms and hallways first and place the floor prefabs, then go through the stair tiles and place the stair prefabs by checking the previous and next hallway tile locations to know which orientation to place. Then go trough the wall prefabs for the rooms, hallways and stairs. Check each tile in the list and look for tiles in all 4 directions. If there is no tile there, then there should be a wall prefab facing that direction, but if there is a tile then there shouldn't be a wall prefab there. Then go through the rooms or hallways and check for the opposite thing if its there to place a door instead of a wall . So either check each of the room tiles for hallway tiles or check each of the hallway tiles for the room tiles. Then add a boolean somewhere that can remember that the room already has a door on the "west" side or something, so to not have 5 door prefabs if the hallway goes parallel to the room. Then go through all the stair tiles and check if there are any hallway tiles above on the sides, if so then add the railing prefab. And finally go through every tile and check if there is no tile right above this tile then add a ceiling prefab. And ur done. Do the same checks for any other prefabs you want to add. It's honestly not very difficult, you just gotta think about the rules

odd fjord
#

Thank you for such a quick response. On account of your answer, I started revising my project to find out that the problem with stairs orientation that was driving me crazy resided in the fact that they got their pivot not in their centre but in a corner which caused them to spin around incorrectly and therefore get misplaced.

I agree with you that the logic wasn't that complicated at all to implement. However, they were the little nit-picks of this sophisticated system the ones which were causing me problems, alas making me doubt on if I knew how to correctly implement this.

#

Speaking of which, what would you do or at what stage in the process would you correct a new little problem that has arisen that has to do with stairs placing one following another, I'll take a screenshot to illustrate it

#

That is an incorrect situation; however, the pathfinder allows it