Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Designing a Logistics System

Discussion in 'Game Design' started by ProductiveHippo, Feb 1, 2022.

  1. ProductiveHippo


    Jan 7, 2022
    Hi all, this is more of a architectural question, so no code. I am building a game that requires items to be transported from one place to another, and to support that I am making a logistics manager to oversee exchanges between inventories.

    There are three types of inventory: Export, Import and ImportExport. Each import inventory has a priority, so the system should fill up the higher priority inventories first.

    My question is around the best way to structure this, whilst still allowing the game to run on mobile.

    my current approach which works well is for the logistics mamager to receive an event when an inventory changes and then look for logistics solutions. It does this by firstly itterating through the list of Export inventories and finding an Item to export, then itterating through the list of Import inventories and finding a viable location, sorted by priority. This matched pair is then used to create a logistics job.

    So two questions:
    Is there a better way to do this? Perhaps a ticket is raised when a new export becomes available that the logistics manager responds to?

    When I have 20-40 import and export inventories will itterating through all these lists cause performance issues?

    Cheers for any help!