PowerCrazy wrote:
I couldn't agree with you more, unfortunetly... The way an adjacency matrix works is it takes the pathways from one node to another and calculates the number of possible hops of n between those two nodes. Adjacency matricies are used primarilly in network theory and most internet routers use them. They are good because it assumes that a hop of 2 is going to be shorter than a hop of 4. And its VERY easy math to figure out how far away (and thus what type of threat it is) a node is. I'm think that in our universe of having the starlanes connect only the 3-5 closest stars that if there is a shorter path the AI won't care at least not until v.7 or so.
A--------------------------------------------B = 1 hop
A--------C----------D----------------------B = 3 hops
In most cases A directly to B will be shorter than the other. However as the AI code matures i'm sure we can put some exceptions and other considerations to help "optimize" the AI.
Well, the thing is, if we allow offroad travel, which we probably will, then the graph is actually going to be fully connected, in other words, you can get anywhere from anywhere else in some finite amount of time.
(Unlike in a network where you can only go along the graph edges)
If you just do a breadth-first search of the starlane graph to calculate node distances, you're going to misjudge the threat levels of nodes where going offroad is faster than going via starlane.
Also, if we have anything like downgrading/upgrading of starlanes (like MOO3 was going to originally), then you've got to deal with weighted edges, in which case, a path of more hops might be shorter.
That's why you're probably going to want minimum travel time instead of just number of starlane hops. This can still be done in an adjacency matrix. It'd just be different data stored for each pair.