I am currently working on a citybuilding game and planing on how to store buildings on the map.
In previous projects I used either a grid where each Object was exactly 1 cell; or Unity Objects placed freely in the scene using collision detection.
While the second method would work by simply clipping objects to grid-coordinates I hope to achieve better relationship management by actually using a grid while still having multi-cell buildings.
For a reference look at Anno. The grid is quite small compared to even the tiniest buildings. At the same time most of the map is unused. I would therefor prefer not to have an array for the entire map but rather an own datatype storing only used cells. All cells need to know what building they occupy and creating and removing buildings should work without too much work. Buildings also need to know their neighboring cells.
I am planning on using ECS for the actual behind the scenes management of the buildings. But I assume I will still need colisionboxes for the mouse to work
More generalized non Gamedev development: How does Exel work? I assume it only stores cells with content. Merging cells is possible and based on a cell i can easily get its content regardless if it was a subcell-adress of a merged cell.
Any Hints on making a Datatype for that?