Name: Anonymous 2009-06-08 10:18
Dear /prog/,
I'm attempting to make a randomised node-map (a network of nodes and paths between them) for /tg/. Essentially, I have a point, randomly generate 1-6 adjacent nodes (hexagonal grid layout really) and paths to those new nodes. It is possible that another node nearby can generate an adjacent node of its own to the same location, creating a path between the nodes via this joint node (and when more nodes are involved, closed loops, etc). It is possible to have "gaps" where nodes haven't been generated, and the overall shape of the map is undefined (allowing long thing ones, spread out, short fat ones, etc).
My problem is how to store the grid-locations of the nodes in such a way that it's fast and "elegant" to locate nearby nodes. I.e. not just making a fixed 2D array and filling it in with Nodes and "gaps". I was thinking of using multiple linked-lists so that it's possible to traverse the map in any direction (not necessarily along the specific paths), but I think there's a problem with this since you have to take into account the "gaps" again, storing empty data.
Any ideas?
I'm attempting to make a randomised node-map (a network of nodes and paths between them) for /tg/. Essentially, I have a point, randomly generate 1-6 adjacent nodes (hexagonal grid layout really) and paths to those new nodes. It is possible that another node nearby can generate an adjacent node of its own to the same location, creating a path between the nodes via this joint node (and when more nodes are involved, closed loops, etc). It is possible to have "gaps" where nodes haven't been generated, and the overall shape of the map is undefined (allowing long thing ones, spread out, short fat ones, etc).
My problem is how to store the grid-locations of the nodes in such a way that it's fast and "elegant" to locate nearby nodes. I.e. not just making a fixed 2D array and filling it in with Nodes and "gaps". I was thinking of using multiple linked-lists so that it's possible to traverse the map in any direction (not necessarily along the specific paths), but I think there's a problem with this since you have to take into account the "gaps" again, storing empty data.
Any ideas?