Point-to-Point Delivery Agent

One of the most useful agents is a point-to-point delivery agent that delivers cargo from one place to another. In this example we will set up a filament transport agent that will transport filaments from an extraction fleet to a manufacturing fleet. It assumes that all three fleets have compatible cargo limits set. i.e. the extraction fleet must be configured to export refined K filaments, the manufacturing fleet must be configured to import refined K filaments, and the cargo fleet must be configured to both import and export refined K filaments. If the cargo limits are not configured correctly the agent will not work.

First, navigate to the agent panel of the faction window and click the add  icon and choose a name for the new agent. A blank agent will now appear in the agent panel ready for configuration

Variables

Select the new agent and click the information  icon to bring up the agent window and switch to the variables tab

A point-to-point agent will need a source and a destination, so click the add  icon and create two new variables for SOURCE and DEST, both of type Fleet

Now select the variables from the table and click the cog  icon to select the specific fleets to use as the source and destination

Once complete the fleet variables should look something like below

Collect behaviour

Now go to the Behaviours tab and click the add  icon to add a new behaviour, and call it Collect. Select this behaviour and the bottom panel will be accessible with the default settings for a new behaviour, which is to do nothing (Idle). Click the Idle task and choose Import (fleet).

The import parameter will default to null, change that by clicking it and choosing var > agent > SOURCE

Now in the utility box click the default 0.0 and change it to a new constant with value 10. Do similar for the switching cost and set that to 2. Change to the preconditions tab of the behaviour and click the add  icon to create a new precondition. This will default to not true. Select the new precondition and click the cog  icon to open an editor

Select the not true predicate from the table and click the editor to change to Has Exports( Fleet, Fleet )

Then edit the two parameters so that the first is var > agent > SOURCE and the second is this. This predicate is true if the fleet bound as the SOURCE variable has exports to the fleet this agent is bound to. As long as the predicate is true the behaviour is selectable with a priority equal to its utility. If the agent has no other behaviours active it will perform the task as configured (collect from source). If the agent is already performing another behaviour then the utility of the new task must exceed the utility of the task currently being performed plus the switching cost of the other behaviour. The switching cost acts as a kind of persistence to avoid the agent switching whilst in the middle of another action.

Deliver behaviour

The deliver behaviour is very similar to the collect behaviour. Create a new behaviour named Deliver and configure the task as an Export task for the variable DEST, and configure the utility and switching costs.

Similar to before, change the precondition of the task, except this time it should be HasExports( this, var( DEST ) ) to indicate that the destination fleet has space for some of the cargo that this fleet is configured to export.

Idle behaviour

Whilst not necessary, it is often nice to keep things tidy by giving agents a task that will be performed if none of their primary tasks are active. For a point-to-point delivery agent this may be to orbit close to either the source or destination as appropriate. If the transport fleet is able to carry more cargo than the destination fleet can store then it makes sense to keep close to the destination to wait for a production cycle to complete and then immediately drop off a new cargo. In our case of a K filament fleet the source and destinations are both in the same system so we simply set up an idle task to orbit the primary star of the source system. We set both the utility and switching cost to zero to be sure that the behaviour will always defer to any of the primary behaviours.

To have the idle behaviour as always applicable we set its precondition to be simply True()

Activate behaviours

Newly created behaviours default to state suspended which means they will not be considered for action. This is to allow you to add new behaviours to active agents without interfering with the agent’s behaviour until you have completed the configuration of a new behaviour. To activate the behaviours select them and click the play  icon. At this point the state will switch to Inactive because we have not bound the agent to a physical fleet yet. To do this, switch to the Fleet tab in the agent window and click the connect  icon. This will bring up a fleet selection window where the fleet you desire the agent to run can be selected.

On selecting a fleet your agent should spring into action

Common Problems

some common problems in getting agents to work are listed below.

  • behaviours are suspended
  • preconditions have not been configured
  • tasks or preconditions are not fully defined
  • variables are not set
  • not linked to a fleet
  • linked to a fleet with insufficient capabilities (lacking cargo space, unable to jump to specified locations)
  • fleets have incorrect cargo limits set which leads to failures in HasExports preconditions