The original post can be found here.Pathfinder Version 6.2
======================
Author: Ralf Beck alias hraban
What is Pathfinder:
-------------------
Pathfinder is the generic term for a small collection of script libraries which work together to calculate a flightpath for ships and where settings in the ship's command console control how the pathfinder will be invoked. A ship that has been sent on a journey with the pathfinder will, for example, avoid all Khaak, Xenon and Pirate sectors if these have been set as enemies in the ship's command console.
What script libraries are there and what do they do:
----------------------------------------------------
-> setup.hraban.pathfinder
Generates an array for each sector containing all neighbours 1 jump away.
-> lib.hraban.pathfinder.main
Starts the route finding and guides the flight to its target.
-> lib.hraban.pathfinder.move
Internal routine for steering the flight to the target.
There is also a
-> lib.hraban.pathfinder.move.test
included. If this is activated, all routefinding will be documented in Log 3055.
-> lib.hraban.pathfinder
Internal routing (recursive) which calculates the flightpath.
-> mmove.movetosector
Modified standard Egosoft routine
This routine must be renamed if the pathfinder is to be used by all ships.
Which scripts should the user call:
-----------------------------------
The user must ensure that 'setup.hraban.pathfinder' is in the script folder. Until 'setup.hraban.pathfinder' is executed, nothing else will happen. Once the preparatory work is done, an appropriate message will appear in the logbook.
Other than that, the user only needs to pass parameters containing the start sector, the target sector, and a flag for checking relations, to 'lib.hraban.pathfinder.main'. If the "check relations" flag is passed as [True], enemy sectors will be avoided. Otherwise, the pathfinder works similarly to the standard command '!move.movetosector'.
Alternatively, the user can pass the pathfinder a list of prohibited sectors. To do this, a global variable with the name 'hraban.sector.stop' must be created. If this array exists, then the sectors it contains will be avoided, regardless of the value of the 'check settings' flag.
Important information:
----------------------
Checking relations can lead to relatively long search times. Because of the command structure of the SE, it isn't possible for me to create a faster routine. To quantify this, in the worst case it can take up to 60 seconds.
My personal attitude is: rather wait longer and find a safe flightpath than lose an expensive ship.
If a ship flies into an enemy sector, either the relations in the ship's command console must have been changed, or the target sector must otherwise only be reachable by flying through more enemy sectors than by this route. Patherfinder is written so that if a sector turns out to be unreachable, the relation check will be ignored and a direct route found.
Personal test results:
----------------------
So far I have not been able to identify any impact on gameplay from using Pathfinder. Only that the time that a ship takes to start its journey has increased significantly if forbidden or enemy sectors have to be avoided.
The script can be downloaded here.
@hraban - If for any reason you don't want this info posted here, please PM me and I will remove it.