I'm creating a strategy-based kingdom expansion game, where you start with one city and try to expand as far as possible from there. All the cities fit on a hexagon-grid and are connected by the edges of the hexagons.
Here's a diagram to illustrate what I'm trying to achieve:
Each city must be connected to another city by road, which means that all the cities are connected. At this point, I began to realize that this map is very similar to a graph, with the cities being nodes, and the roads being edges. I've already done some graph theory and implement multiple algorithms. However, when implementing it in a graph format (Map<Node, List<Edge>>
), I ran into 2 problems:
There is no way to force that each node can only have 3 connections, with each being a multiple of 120º If it was stored in this format, it would be very difficult to render just loop it through for updating. I'm wondering if any of you have any better data structures that can be used for this. Any criticism, suggestions, or advice is welcome.
Thanks!
Ps. I've seen other questions that are somewhat related, however they either do not have an accepted answer or do not solve my problem.