Scripters: Burianek and AalaarDB
Station Manager is a fully automated software system that manages and coordinates traders assigned to a station or complex. It will decide which wares need to be bought and sold, and where the best locations are to buy and sell them. It's very flexible and allows you to assign as many or as few traders as you like to take care of a factory.
Traders assigned to the same factory will coordinate with other automated traders and will not all try to buy the same ware at the same time. They will also try not to visit the same stations to trade the same ware. Station Manager allows you to customize the traders belonging to a station and set up individual parameters for each ship for which wares should be traded, and how far of a jumprange to look within. So, for example, it is very easy to set up a Solar Power Plant to have two customized ships supplying it: a small, fast ship that looks for crystals to buy within a large jumprange, and a huge energy tanker that sells energy cells to the stations immediately surrounding the Solar Power Plant.
In order for your traders to be able to see the ware prices within a sector, you must have a satellite, ship, or station in the sector to be scanned (this is shown by a green border around the sector in the galaxy map). Your ships will not visit sectors where they cannot see the ware prices. You can use this to your advantage. If you don't want traders to visit sectors because you think they might not be safe, do not put any satellites, ships, or stations in those sectors, and your traders will not look for stations to trade at within them.
Starting Station Manager:
Select the 'Station Manager: Automate' command from the station command console. The first time this is activated on a station, the station account (or player account) will be debited 25,000 credits to install the software. This is a one time fee per station. If you stop the Station Manager command on your station and restart it, you will not be recharged. After Station Manager is running on a station the commands 'Station Manager: Add Ship' and 'Station Manager: Remove Ship' will appear in the station command console.
Stopping Station Manager:
Go to the station's command console and select the command slot Station Manager is running on. Select none to stop the station from running Station Manager.
'Station Manager: Add Ship' station command:
To add a ship individually, select the 'Station Manager: Add Ship' command and then select one of your ships. Note that your ship must not currently be docked to be able to find it to select it. Once your ship has been selected, it will be added to the station's list of traders (set homebase) and the ship will be automated by the Station Manager software. The following ship types can be assigned to trade for a station: M3, M4, M5, M6, TS, TP.
An alternative action for this command is to run it and select the station itself instead of a ship. This will do 1 of 2 things. If a station has any number of owned ships that are not automated traders, there will be the option to add all owned ships as traders. If a station has any number of automated traders there will be the option to list all of the traders belonging to the station and their status. If both of these are applicable then you will be presented a choice between these 2 options, or if only 1 is applicable then that option will execute without the choice.
When a trader is automated by the station, 4 new commands may be added to the command console of your automated traders. In the Additional Ship Commands section of the command console will be the commands 'Station Manager: Display Status', 'Station Manager: Prohibit Ware' and 'Station Manager: Set Jumprange'. In the Trade Menu section of the command console may be 'Station Manager: Continue' under certain circumstances.
'Station Manager: Remove Ship' station command:
To stop a ship from being an automated trader, select the 'Station Manager: Remove Ship' command from the station command console, then select a ship that already belongs to the station. The ship will be removed from the station's list of traders (remove homebase) and will stop trading for the station and will begin to idle in space.
An alternative action for this command is to run it and select the station itself instead of a ship. This will stop all the station's ships from being automated traders.
'Station Manager: Continue' ship command:
It is possible to manually interrupt one of your traders by simply issuing it a new command. This can be useful to dock the trader somewhere safe if it is in danger, or to make a lucrative one time transaction. A short period of time after a trader has been manually taken control of, the station will place the command 'Station Manager: Continue' in the Trade Menu of the ship's command console. Select this to order the ship to begin trading for the station again. If your trader has been automatically sent to a repair dock to get fixed, you can also restart the trader by using this command after you fix it. Stopped traders will not restart trading until this command is issued.
'Station Manager: Display Status' ship command:
Select this command to display the status of this ship. The information received is Ship Name and ID, Homebase or Location, Current Status, Traded Wares, and Jumprange.
'Station Manager: Prohibit Ware' ship command:
Select this command and then select one of the wares to prevent your trader from trading it. To reallow your trader to trade a prohibited ware, simply select the command again and choose a prohibited ware. Your trader will now be allowed to trade it again. To see which wares a ship can trade, use the 'Station Manager: Display Status' command. Traders are set up to trade all of the wares of a station by default.
'Station Manager: Set Jumprange' ship command:
Select this command and then enter a jumprange. To use the station's standard jumprange parameter, enter a negative number for the jumprange. To see the jumprange defined for a trader, use the 'Station Manager: Display Status' command. Traders are set up to use the station's standard jumprange by default.
Detailed Trader Logic Description:
- Traders will only buy resources if your station is less than 90% full, and will only sell products if your station is more than 10% full.
- Your ships will look at their homebase and make a decision as to what the most critical ware to trade is. They will look at what other ships belonging to your homebase are attempting to do to help them make the best decision. So, if your station desperately needs energy, but you already have another freighter enroute to buy more than enough to supply the station with energy, your trader might look for a different ware to buy or sell.
- After a trader has decided which ware to trade for the station, it will look for the best station to go to. It will search the stations of all sectors within jumprange that have a player asset in them (have a green border on the galaxy map so the player can see ware prices). The trader will rank order the stations by best price, and then by shortest jumprange. It will then visit the best station that no other trader is visiting for this station for this ware. Traders can visit the same station if it is to trade different wares, i.e. two traders from an spp might visit the same crystal fab if one was going to sell energy, and the other to buy crystals.
- Once a trader has a ware and station to trade, it will start travelling towards that station. Every sector, the trader will make a limited search to see if there is a better station to trade at. A limited search means that only stations that are as close as, or closer than the current target station will be checked. This is to prevent a trader from flying one sector east and then saying, "oh wait, the best station is to the west", flying one sector west and then saying, "oh wait ..." and never landing anywhere. Traders that set out from a station will always continue to close to a target with every sector travelled unless something happens such that there are no stations within the jumprange to the current target that trade the ware for the price limits set at the homebase. When this happens, the trader will abandon the current trade run and will start completely over, looking for the best ware to trade for the station. (if it picks the same ware, it will expand its search to include all sectors within the jumprange of the homebase)
- If a trader ever picks a ware and finds that it cannot find any stations at which to trade that ware within the price limits set at the homebase, it will give up on that ware and pick the next best ware to trade for the homebase.
- If a trader finds that it cannot trade any wares for its homebase, it will return to its homebase and sit there until it is possible to trade something.
- Traders that have been damaged to have less than 80% hull value will not continue trading for your factory. Instead, they will automatically fly to the nearest safe repair dock and contact you for help. Safe means that they will not cross any sectors owned by races defined as enemies in the ship's friend/foe settings.
- Traders can either buy or sell intermediate products of complexes, but they cannot do both at the same time. If the station's intermediate products parameter is set to buy and sell then they will only be bought.
- Traders cannot coordinate with other station's traders or with traders from the same station that are not being automated. For best results, allow the station to automate a trader and restrict it to one ware instead of issuing other trade commands.
Explanation of Pathfinding Algorithm:
The Station Manager uses AStar to find paths to the destination, rather than the normal paths. These paths are, in general, safer. You can change the way AStar makes paths relatively easily, to customize it to your playing style.
AStar assigns a cost to each path it could take to get to the destination. It then chooses the path with the lowest cost as the optimum route. The easiest way to think of cost is: safety_weighting * distance, with higher safety weighting meaning more dangerous.
As an extremely simplified example, assume there are two paths to get to a destination:
Path 1: 300km travelled through enemy sectors
Path 2: 400km travelled through neutral sectors
Foe weighting: 1.55 (this is the default weight used for Foe sectors in Station Manager)
Path 1 cost: 300km * 1.55 = 465
Path 2 cost: 400km * 1 = 400
In this example, AStar would pick the safer route because it costs less, even though it is a bit longer. Notice that if Path 2 were much longer (greater than 465km) AStar would actually prefer to go through the enemy sectors.
To change the saftey weightings to get AStar to prefer different routes on your computer, open up your script editor, and open the file lib.ad.astar.getplayercustomcosts. Please do not edit any other files. You may edit the 4 numbers at the top, but it is recommended you only edit the FOE number. You may also edit the center of the script in between where it says to edit. This spot is for those who want to have different costs for different races of the same type. For example, Xenons might be more dangerous than Pirates although they are both FOE.
For instance, if you want the trader to stay safer by visiting enemy sectors less often, increase the FOE number. If you want your traders to prefer faster routes with increased risk, decrease the FOE number slightly. You can even make traders prefer visiting 'Allied' sectors more often by decreasing the Friend number.
If you are interested, please see http://forum2.egosoft.com/viewtopic.php?t=104166 for a further explanation of AStar. Please note: the AStar here and there are different, the Station Manager version will not overwrite the commands - it is only for your station traders.