Hey,
So, I am developing a strategy game which has a grid of nodes, described by a list of nodes. Nodes have references to their neighbors and I’ve already have systems in there like basic pathfinding, road building and so on. However, I just started creating the system to build stuff, the caveat being that buildings can be larger than 1 tile (unlike roads which connect with other nearby roads but are just 1 tile in size).
The question is… what is the best way to do that? I mean, what I am doing right now is, choosing the X tiles the building will occupy (say 9 tiles), setting them all to have a reference to this building, and instantiating the building prefab in the center tile. This works, and seems like a good enough solution, but I am serializing the most barebones I can of this so I can recreate the world from a pre-set state (saving a json), and idk, but it feels I might be doing something wrong here. This is making it hard for me for stuff like rotating the building (rotating is easy, but the building has entrance and exit points and rotating those among the 9 selected tiles is going to prove not trivial), and idk, the linking between the nodes is… weak, is index based… so say this 9 tile building, at time of construction it will store a tile index in each tile, so if I click on tile 9, I have a way to calculate what are the other 8 tiles… but idk.
Anyone knows some good resources on ways to approach this problem? This has been done thousands of time already in the history of gaming but I couldnt find anything about this specific question… so any references would be super helpful!
As a ps, I do have some years making games so Im not the noobest there is, this is actually a deterministic multiplayer game and I got that going so I feel like I am struggling with a part that should be easy haha but is proving a bit of harder than expected.
Anyway, thanks for the attention!
Best,
Allan