I am struggling to find a way to even ask this question. It might be clearer if you look at the Glossary I am getting my terms from: http://crpgaddict.blogspot.com/p/glossary.html
This is an example of "Razor Walls", this is what I am trying to do:
This is an example of "Worm Tunnel Walls", this is the other approach:
In "Worm Tunnel Walls" I would use a 2D array. Each index in the array would either be a wall or a floor, pretty easy.
I am having a harder time figuring out how to conceptualize Razor walls. I have tried some different approaches, such as making the array of a custom type so that each cell tracked whether or not each of the edges had a wall, but you want adjacent cells to share a wall, which means walls have to be stored in two cells, which seems inefficient. Then I tried setting up a 2D array and making all the even numbers walls, and all the odd numbers floors, but I am having to code a LOT to make that work in the various edge case. I can make either of these approaches work, of course, but it feels klunky. Pool of Radiance did this in 1988 on Amiga! It has been a standard way to make these games for decades on machines with serious memory and processing limitations. It seems like there should be a more elegant approach that I am missing.
Ok, I have another idea. I am thinking 3 2D arrays.
Array one stores floor information.
Array two stores Up-Down wall information.
Array three stores left-right wall information.
So my map is 8x8. The first room is floor[0,0] with walls at UDWall[0,0] and UDWall[1,0] and walls at LRwall[0,0] and LRWall[0,1]
I am on mobile right now, but I will try it later and report back.