Obviously, this may lead to some horribly inefficient scouting schemes. Worst-case, a single scout would travel through the entire empire to explore one system and then again cross the empire for another system just because it is closer to the empire capital. An inefficient scouting scheme may slow down early game expansion significantly.
I think it is much more reasonable to find suitable systems for each scout instead of finding a suitable scout for a system as this inherently will consider the distance.
I currently have the following exploration algorithm in mind. Before I start implementing it, I wanted to ask for additional ideas or issues that should be considered.
Code: Select all
For each unexplored system:
Assign a high value if we can reach the system with colonization ships: Make use of MinFuel attribute of ShipDesigner here.
Potential chokepoints or nodes close to good defensive positions will get a bonus as well
If early game:
Prefer points with many unexplored nodes around to speed up finding new colonization sites
If mid game:
Prefer single node in hope to find the end of the starlanes and reduce the number of points to defend
If enemies came from that general direction and an enemy planet is not visible there:
Increase the rating for that system
For each scout:
For each unexplored system, calculate a scout-specific mission value:
Calculate (unobstructed) path from scout location to target system.
If with current fuel we can't reach the system and afterwards refuel:
Check if we could go for a refuel now and then target the system.
If we can:
Update the distance to the target system including the refuel
If we can't but refueling now gives us more fuel to work with:
Update the distance to the target system including refuel weighted by a factor of 1e3 and divided by remaining fuel.
If we can't and we won't gain any more fuel:
Use current distance weighted by factor 1e3 and divided by remaining fuel.
Rating for each scout-system pair is given by SystemValue / WeightedTimeToReachTarget # includes speed considerations of the design
While AvailableScouts and UnexploredSystems:
Take scout and system with best corresponding rating.
Check if that system is also the best rated system for another scout
If not:
Assign Scout to that System
If yes:
Check if switching the first and second best systems of the second-best scout leads to a higher overall value.
If not: assign Scout to best system
If yes: Assign Scout to second-best system
# maybe think of some better and more accurate heuristic here but definitely avoid the O(n!) complexity of comparing all possible choices
Remove scout and system from list to assign
Calculate the jump-distance from assigned system to all other unexplored systems.
Reduce the exploration value of each remaining system based on that distance # In order to spread the scouts instead of assigning them to neighbouring systems.