Procedual Wall Generation

I was doing some coding for my game recently, and I was wondering how you would going about doing procedural walls like shown in Software Inc. Currently, I have a system where you place a point in the world, that point is added to a list, walls are drawn between the points, and if the tiles (stationed between the world points) have the corresponding flag to them (!upwards, !downwards, !diagonal) then you may place the points. I was wondering 3 things.

  1. How would I go about upgrading this system to include diagonal walls

  2. How do I check if one wall runs into the other wall

  3. How would I go about finding the area between the walls and trigger the corresponding indoors flags?

Thank you for your time

  1. I would be storing the start and end coords of each wall, then it isn’t too big a deal to just find a mid point and draw your wall between the start and end, just follow the diagonal direction you want the wall placed in.

  2. By storing the walls start, end, and direction you just need to check if a wall’s intended path would cross between start and end.

  3. Since you’ve been saving the walls coordinates, you are really just checking the coordinates of your game object are in the bounds of the corners drawn by the outer walls. Possibly consider making colliders on the walls that extend much further than the width of the wall. Then you would just have to check if the object is touching all respective colliders and you know you are inside. If you have roofs it’s absolute gravy. Just raycast up the appropriate distance from floor to ceiling, and if you hit the roof, you’re indoors.