AI Trade steps

Trade steps are the building blocks of the trade strategies. Some of the trade steps in turn make use of strategies to make decisions (i.e. joining guild, repairing or upgrading ship).

Trade steps class diagram

Trade strategies are run by executing the trade steps. Each execution can decide if followup trade steps can be executed. When further steps are not executed, there must be a means to pick up trade steps execution. Usually these are events like ship arrives at the destination after traveling or finished repair.

Following this procedure there are some ways to define trade steps: * Initially the trade steps are defined, normally up to the traveling trade step * When an event occurs that was cased by a trade step that prevented further steps to be executed, additional trade steps are defined as needed

The BasePlayerTradeStrategy provides a basic setup of trade steps:

Default trade steps

The various trade strategies mainly differ in the way they define what wares to buy and sell and where to travel next. Some strategies also have a slightly different flow through the steps. Many of the strategies have in common that a certain ware is to be transported from location A to B. To make the return trip somewhat provitable wares are carried along that might be sold.

Knowledge of what is needed were is based on players presence. Everytime the player visits a city the knowledge of what is needed and produced is updated.

SupplyHometownAIStrategy

This basic trade strategy aims to supply the hometown with wares that are required, thereby defining the wares to be picked up in close by cities.

Supply hometown

SupplyCentralTradingStationAIStrategy

This strategy goes along with the next one. This part of the strategy is aimed to supply a central trading station with wares needed, very similar to SupplyHometownAIStrategy, only with the difference, that the wares are not sold to the city, but transfered into the trading office.

Supply central storage

CentralStorageDeliveryTradeStrategy

This second part of the strategy takes the goods stored in the trading office and supplies nearby cities.

Central storage delivery

CheapProductionTradeStrategy

The wares in this strategy are refined wares that are produced in a city and sold at a good price and then they are sold in nearby cities.

Cheap trade strategy

CollectionWaresStrategy

This is a base strategy for collecting wares for different purposes (i.e. celebration or ship construction). The city where the wares have to be delivered to is defined by the purpose, as are the wares. The goods are picked up wherever they can be found, preferring close cities.

Collect wares

DynamicTradeRouteStrategy

This strategy focus on on a few high value wares that are bought where cheap and sold where most profitable.

Dynamic trade route

ProductionChainTradeStrategy

This strategy focuses on a production chain. Collecting primary wares that are required in a production chain, delivering them to a city where they are used to produce secondary wares cheap and grabbing the produced wares to sell elsewhere.

Production chain

TradeRouteTradeStrategy

Together with the map trade routes are defined. This provides the cities and the main goods in this strategy.

Trade route