Many engineers have asked us this question, "Youthcat! Why does my ship go to a farther planet to get items instead of a closer one?"
Good question! In today's dev log, we will introduce the history and evolution of the interstellar logistics system. We'll roughly explain the iteration process of optimizing the interstellar logistics system experience.
![](https://www.eprison.de/pics/games/https://clan.akamai.steamstatic.com/images/38718364/5c5e77e1ffe625c8e526d374066ef8a59d3a3fad.png)
Before the Update
In the previous interstellar logistics system, the transportation of an item from interstellar logistic station A to Station B was facilitated by a mechanism called Supply-Demand Pairing. Each supply-demand pair contained information about the supplier, the demander, and the item being transported.
Each interstellar logistic station managed all its supply-demand pairs internally. It needed to check with all other stations to see if its supply and demand could match with those of other stations, and then store all the matched supply-demand pairs.
All these supply-demand pairs formed a complex logistics network. For example, if there were 10 interstellar logistics stations in the universe demanding iron ore and 100 stations supplying iron ore, there would be 1000 supply-demand pair routes regarding iron ore.
After obtaining all the pairing information, logistic stations need to undergo periodic updates. As you all know, interstellar logistic stations are very convenient to use. You just take out items from your inventory, place them on the ground, set the items, and the goods start to be transported continuously.
Therefore, generally speaking, the number of interstellar logistic stations in the entire universe is not too small. Consequently, the pairing information within each interstellar logistic station grows exponentially.
To balance the entire supply-demand relationship (as well as optimize performance costs), each time a station judges the pairing information for picking up goods, it adopts a "fair share" strategy. This means traversing through all the pairings one by one and marking the last position after the traversal ends. The next traversal starts from this position to ensure that each pairing has a chance to be "loved".
![](https://www.eprison.de/pics/games/https://clan.akamai.steamstatic.com/images/38718364/892451a8434020f675160b406a4c82b8d102ac21.png)
Behind the vast transportation routes, thousands of stations and tens of thousands of supply-demand pairings perform logical computations every second.
Seeing this, you might already feel your brain getting a bit fuzzy, right? But the complexity doesn't stop here!
To avoid wasting transportation resources, if a pairing passes various logical checks (such as availability of goods, energy, transport ships, etc.), it also needs to consider whether it can conveniently deliver some additional items.
For example, when a vessel destined to pick up iron ore sets off, it needs to reevaluate if it can conveniently bring a small gift to the supplying station on its way. Similarly, when a vessel from the supplying station arrives at the destination and unloads the iron ore, it needs to check if it can conveniently pick up some other items to take back.
Our intentions were good, but things went awry during execution. Code is rigid. It doesn't care whether a pairing is closer or farther away. It simply follows the rules: if a pairing is detected and passes all logical checks in this frame, then that's the route to take!
This puts a strain on our engineers, especially when transport ships are relatively slow in the early stage. It's frustrating to watch a transport ship ignore a mining area just light-years away and instead head straight for a destination tens of light-years away, never looking back.
Beginning the Optimization
When the CentreBrain requested optimization of the interstellar logistics system, the designers were quite unwilling, even resistant at the beginning. The previous logic was already complex enough, and further optimizing the experience would only lead to considering even more complex situations.
As the saying goes, the complexity of design doesn't decrease; it shifts. Now that we have such a complex situation causing experiential issues, the only solution is to devise even more complex rules to match these complex demands.
After continuous battles between designers and programmers, we decided to expand the "pairing" mechanism into multiple dimensions. We allowed engineers to set priorities across different dimensions, ensuring that engineers could adjust the priorities by manipulating pairings across various dimensions. This approach aimed to reduce the occurrences mentioned before and enhance engineers' sense of control over the entire cosmic factory.
![](https://www.eprison.de/pics/games/https://clan.akamai.steamstatic.com/images/38718364/6ea452776599b643dc7dc898e78354e75d7f66d2.png)
We can do it!
The new design of supply-demand pairings consists of five dimensions:
① Point-to-point priority pairing between individual interstellar logistic stations.
② Setting up "routes" between planets for specific items, with priority pairings for stations along these routes.
③ Setting up "routes" between star systems for specific items, with priority pairings for stations along these routes.
④ Grouping interstellar logistic stations, with priority pairings for stations within the same group.
⑤ Regular pairings for items not assigned any specific priority.
Their priority decreases sequentially, meaning that interstellar logistic stations will first check if point-to-point pairing (①) is feasible for transportation. Then, they will consider dimensions ②, ③, and ④ in order. Finally, they will only address regular pairings (⑤) if necessary, based on the settings.
![](https://www.eprison.de/pics/games/https://clan.akamai.steamstatic.com/images/38718364/b36c263db61d7e545d0efa498ac8c3a59c2689ba.png)
After setting up a planetary route between the third and fourth stars, titanium glass will be prioritized for transportation between these two planets.
Just as we were eagerly diving into development, we encountered a problem after a week of joyful coding — the situation was far more complex than we had imagined.
During testing, we found that in specific situations, logistic stations planned for point-to-point pairings(①) couldn't transport due to reasons like lack of warpers or energy. They could still transport (either delivering or fetching) when considering regular pairings (⑤).
After obtaining items from regular pairings, when it's time to check point-to-point pairings (①), it may be discovered that there are no items available. Alternatively, in cases where transportation is not feasible in ①, some demanders from lower-priority routes might opportunistically "steal items". Because they do not know why ① doesn't work, whether due to a lack of energy or a lack of warpers, the handling methods for these situations are different.
Moreover, the lack of energy needs to be categorized into situations where power is disconnected or not. Some situations require waiting for higher priority, while others cannot wait.
If these situations are not addressed, low-priority pairings will almost always override high-priority pairings, leading to the prioritization meaningless.
![](https://www.eprison.de/pics/games/https://clan.akamai.steamstatic.com/images/38718364/262571b9989b112d59cca6cf8a0de2bd0076c9c3.png)
A simplified transportation model, where arrows represent transportation direction, and double arrows represent high-priority pairings.
So we adjusted the design of priorities. Priority no longer completely determines who goes first and who goes later. Moreover, in situations where high-priority pairings cannot be transported, it is not guaranteed that low-priority pairings will be served next; it depends on the specific circumstances. By studying the departure conditions of transport ships, we found that there are 9 situations to consider for each station.
Therefore, there are a total of 9x9=81 different situations to consider for both the supply and demand sides.
![](https://www.eprison.de/pics/games/https://clan.akamai.steamstatic.com/images/38718364/c80922dfa239029428f2602fccf436eefe2c88b5.png)
The designers and programmers felt "intimidated" looking at this table.
Bad news: every 1000 logistic stations will increase CPU overhead by approximately 1ms on average.
![](https://www.eprison.de/pics/games/https://clan.akamai.steamstatic.com/images/38718364/563193d4ccde64a8c931e5671c5670e58b3aab4a.png)
some fake codes
To implement these mechanisms, not only do we need to synchronize the timing of updates, but we also need to introduce a "locking" mechanism. When a pairing is transporting items between each other, they will apply a lock to each other. If a lower-priority pairing attempts to transport items and finds a high-priority lock on the logistic station, it will "back off".
Conversely, if a higher-priority pairing attempts to transport items and finds a low-priority lock, it will simply ignore the lock. Of course, this is just a simplified situation. More complex situations, such as when a higher-priority pairing cannot transport items, are not discussed here.
![](https://www.eprison.de/pics/games/https://clan.akamai.steamstatic.com/images/38718364/7fb27431671ba71b2a5cc70ec5e9e2b4cf63cf40.png)
A Shipshape Panel
Thank you all
After this update, the brand new interstellar logistics system is about to meet all the engineers.
We appreciate everyone's patience during this period without new features, and we are grateful for your continuous support and love for "Dyson Sphere Program".
As mentioned earlier, the complexity of design doesn't decrease; it shifts. However, we will always carefully consider engineers' needs and will not give up simply because of design or code complexity. In the days to come, we will continue to bring updates "Dyson Sphere Program".
Thank you all!