I'm making a game using in C# and Javascript that uses a map which has tiles, corners and borders. Here's a graphical representation:
I've managed to store tiles and corners in memory but I'm having trouble getting the borders structured.
For the tiles, I have a Map Width * Map Height
sized array. For corners I have (Map Width + 1) * (Map Height + 1)
sized array.
I've already made up the math needed to access corners from a tile, but I can't figure out how to store and access the borders from a single array.
Tiles store their type (and other game logic variables) and via the array index I can get the X and Y coordinates. From this tile position it is possible to get the array index of the corners (which store the Z index).
The borders will store a game object and accessing corners from only border info would be also required.
If someone even has a better way to store these for better memory and performance I would gladly accept that.