Resources

The different resource systems deal with creating, moving and consuming items. Items are ScriptableObjects that specify how the item is visualized in storage and UI among other settings.

wood, meat, clay, iron, …

Items are stored in the ItemStorage class which can limit how many items they fit by item quantity, item units or stacks. ItemStorages are either part of building components or a global manager. ItemsStorages on Buildings can be set to global mode so their items go to global storage instead.

gold is stored in global storage, food is stored in buildings

The two essential interfaces regarding resources are IItemReceiver and IItemGiver.

  • Item receivers are building component that accept items from others.
    Other components deliver items to receivers.
  • Item givers are building components that provide certain items for others.
    Other components acquire items from givers.

Storage

Storage Components act as both receivers and givers. They need a StorageOrder for every Item they store. Storage components performs actions in the following order.

  • get items with StorageOrderMode GET from other givers
  • supply receivers with a higher priority with items(production)
  • empty items with StorageOrderMode EMPTY to other receivers

silos, storage yards, …

Production

As long as it is supplied with items specified in ItemsConsumers a production component will periodically use up those and produce the items specified in ItemsProducers. It does not actively get the consumer items but instead registers as an IItemsReceiver. It does however spawn delivery walkers to move produced items to other receivers.

barley farm, brewery, clay pit, potter, …

Distribution

These components send out roaming Sale Walkers that take note of the items IItemRecipients it passes need. They then look for IItemGivers that give out those items and send Purchase Walkers to get them. The Sale Walkers are filled up with items whenever they leave and pass out the items to the IItemRecipient they pass.

markets

Retrieval

Retrieval Components periodically send out walkers that get items from the closest dispenser. They then spawn delivery walkers that try to move them to an items receiver.

hunting lodge, wood cutter, …

Collection

Collection Components spawn walkers that collect items from generation components the pass while roaming. These also use delivery walkers to move the collected items on.

tax collector