Geoff the Medio wrote:
You need to be able to remove vertices as well, and the interface should have a way to set all the vertices in one go, rather than requiring the user to add one vertex at at time.
Trivial.
Quote:
Each empire will have a separate set of known and accessible systems... But also consider that there might arise many other cases in which paths would need to be found that varies even for objects owned by the same empire. One ship might not be able to travel to certain types of stars, or might have a max allowed starlane length it can go along, or similar. So, it should be possible to calculate a the shortest path (by various definitions) or the existence of any path of a certain range of lengths (not necessarily the shortest, as long as its within the given length range) between systems for an arbitrarily different set of vertices, not just the whole set known to an empire.
Can be done in linear time rather than in N log N through Dijkstra.
Quote:
I don't see why you really need three separate classes to do the different types of distance calculations. It would seem simpler to the user to just have a single multi-function distance matrix class, or namespace of functions that are called by the already-existing Universe path-related functions. You'd set the vertices for the condition in which you want to path check, and then call ShortestPath(), LeastJumpsPath(), LinearDistance() or whether the systems are connected. Internally, you can store separate information for each, as necessarily.
If you have one object which has FastestPath(), LeastJumpsPath() and LinearDistance() methods, all algorithms which use it must know which method to call. If you have 3 different objects each with different ShortestPath() method, you can make one algorithm do three different things without changing a single line of code just by giving it the right object.
Quote:
It would probably be useful to be able to pass a UniverseObject* or Ship* or Fleet* to a function in your class that would set the functions to return paths for the passed object.
Trivial, the worst thing that can happen is having to temporarily "inject" a new origin vertex "inside" an edge.
Quote:
This is somewhat future proof in that for now you could just check the owner empire of the object and react accordingly, but in future we could set up some way to do per-object graph adjustments. It'd probably be necessary to add an "AccessibleSystems" function to class UniverseObject for this purpose.
Distance matrix is not supposed to know anything about empires. All it needs to know is basic vertex/edge info and vertex/edge accessibility map (IsVertexAccessible() and IsEdgePassable() or something like that).
Quote:
You could assume undirected graphs, but we might want directed in future, if it's not too much extra work.
Trivial.
Quote:
Quote:
... whether empire distance matrix should belong in the empire or in the universe.
The distances between systems is a property of the Universe, not of the empires, so a distance matrix doesn't really belong in the Empire class.
Distance between systems is property of the universe defined by universe graph and system visibility is property of the empire. Distance map is a combination of these properties. Empire distance map actually doesn't make sense outside the scope of the empire and the empire might be the only entity which should be able to modify its own distance map.