thanks for more explanation vuto, and reg for more info.
that is true... there may be sectors between the ship and the homeworld, and those sectors might belong to another race. (eg they build an outpost nearby or colonised a world in recent turns etc.
The suggestion about "next friendly system,station/fleet" etc could be easy to do... heres my pseudocode
Easier Option, for Terrans:
- identify ship retreating and it's range (let's assume range = 1)
- identify the 8 sectors around it, and temporarily assign those sectors an ID (1 to 8)
- identify Sector information: (Sec)
IF Sector 1 = Terran sector, OR has Terran Fleet, store temp value for Sector 1 = "good" sector for retreat
IF Sector 1 = NOT Terran, OR not Terran Fleet, store temp value for Sec1 = "bad" sector for retreat
-repeat for the other 7 sectors.
Then, use random code to pick one of the "good" sectors and the ship retreats to it.
(this way, the larger the ship's range, the further it can travel from its current battle destination, hopefully reaching a friendly sector)
More Complex method (similar to a Morale Modifier table, for battles)
for Terran's
- identify ship retreating and it's range (let's assume range = 1)
- identify the 8 sectors around it, and temporarily assign those sectors an ID (1 to 8)
#- identify Sector information: (Sec)
IF Sector 1 = Terran, store temp value for Sec1 = 1 point
IF Sector 1 = Terran Colonie, store temp value for Sec1 = 2 points
#(add bonus points)
IF Sector 1 has Terran Outpost? = +1 point
IF Sector 1 has Terran Starbase? = +2 points
IF Sector 1 has large Terran Fleet? = +2 points
IF Sector 1 has small Terran Fleet? = +1 point
#
add values for total points, and the highest points has more chance of target for retreating ship