Skip to content

sdether/MoreEffectiveTransfer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inner workings

This is a continuation of pcfantasy's More Effective Transfer Manager (https://steamcommunity.com/sharedfiles/filedetails/?id=1680840913).

He was so kind as to license his code under the MIT license for us, so if you like this mod, please take the time to go to the above posting and show your appreciation for his original work!

The core code for the match-making logic has been mostly completely rewritten, but with pcfantasy's original idea and design in mind.

This mod is compatible with the Airports DLC and the accompanying base game patch

What it does

The vanilla transfer managers handles service requests and goods transfers by matching highest priority orders (incoming and outgoing) first, regardless of distance. The observed effect is that trucks go from A to B, and from B to A; fire response is inefficient if fire fighters have to rush through heavy traffic across the map, and problems such as garbage or crime are unattended for longer than necessary.
You can learn more about the inner workings of the vanilla transfer manager by reading the excellent article here: https://jamesmonger.com/2021/02/24/cities-skylines-trading-market.html

This mod attempts to improve the situation by:

  • Optimizes the service dispatching and goods transfer for industries. All match-making between supply & demand is done by shortest distance ("as the crow flies", not actual pathfinding distance!).
  • Serves highest priority requests (=more urgent problems) first, working its way down the queue (like vanilla).
  • Different match-making modes carefully selected per service / goods: OUTGOING_FIRST (most services), INCOMING FIRST (transfers and maintenance), and BALANCED (goods).
  • Additional options to further improve service locality and warehouse effectiveness. If they work as intended heavily depends on how your city is structured, though. YMMV.

What it does not

This mod only affects supply/demand involving "building based" services and goods (=a building is sending out some vehicle to service/transfer something somewhere). With the exception of health care (hospital visits) it does not affect any "citizen activity based" services (=a cim actively travels somewhere for some reason), such as: school, leisure, shopping, going to work, ...

All of these matches are going through the vanilla transfer manager, so:
=> citizens go to any school as they like, they go shopping wherever they please, they pick a work place as they want, and they dont just go to the nearby park, instead travelling all across the city to the fancy 5* zoo.
This is intentional - the Cims value their freedom and certainly dont accept being restricted to their district...

This mod does not change the match-making to use actual pathfinding distance/routing. Using that would be very costly without optimized data structures and algorithms, and cannot be easily done.

Settings and their effect

Prefer local district services (recommended to enable)

Affects: garbage, police, health care, maintenance, mail, taxi
This setting further improves locality of services by further restricting the matchmaking:
All low priority outgoing transfer requests will only match with services from the same district. If no matching services from the same district are available, the request is unfulfilled. As the problem (garbage, crime, ...) accumulates, the request will gain urgency and increase priority. Once reaching hiher priority it will be matched to fulfill, regardless of district restrictions (but still with a bias towards local district services).
Effect:
While not quite duplicating mods such as DistrictServiceLimit or EnhancedDistrictServices, it ensures that most services stay local as much as possible, while at the same time ensuring that high priority requests will eventually be serviced, even if that means a service has to "rush across the map".

Warehouse First (recommended to enable)

Affects: warehouse goods deliveries
This setting makes all incoming and outgoing goods deliveries prefer warehouses as source/destination.
Effect:
This can help a lot in city logistics if there are some well-placed warehouses as "buffers" between industry & commercial, or industrial producers & consumers. Note that this can make things worse if you do not have strategically well-placed warehouses, and will in general increase traffic around warehouse routes.

Reserve Warehouse Trucks for local transfer (recommended to enable if Warehouse First is used)

Affects: warehouse goods exports
This setting will prevent all warehouses from using all their trucks to export goods out of the city. A contigent of trucks will be held in reserve and will only be used to fulfill requests from consumers within the city.
The setting's effect is:

  • 25% capacity reserved at all times.


Problems

There is obviously a conflict between the "higher priority first" approach and the "closed distance preferred" approach. In particular, preferring matchmaking by closest distance cannot fully prevent that buildings get serviced by service buildings from far away. That is because a more suitable, closer service offer might have already been matched to a higher priority request, so now the closer building has no choice but be matched with an offer from a service further away.

This whole situation cannot be easily prevented, and would rather require a complete redesign of the offer matchmaking system, with a "global optimization" approach (instead of the current "line-by-line, from high to low priority" approach).

TLDR: you notice in your city that garbage trucks go from A to B, and from B to A, and you think this mod is not doing its' job. This mod usually reduces these situations, but cannot fully prevent them.

For reference also see original user guide / wiki by pcfantasy:

MoreEffectiveTransfer User Guide Steam Downloads

English version

MoreEffectiveTransfer 说明书

MoreEffectiveTransfer 模组说明书

Impact and Performance

As this transfer manager does a lot more than the vanilla one, it naturally executes more work on the CPU and thus taxes your system a bit more than pure Vanilla. Care has been taken to implement these additional functionalities as efficiently as possible. I have done some long-term measurement with the following results:

City: "Cim City" (Vanilla.crp) by ThisHero (https://steamcommunity.com/sharedfiles/filedetails/?id=2117400989)
It is a massive pure Vanilla+DLC city, spanning 25 tiles and having over 300,000 cims in it, with a stable economy suitable for running unattended. Additional mods used to gather statistics:


Letting the sumulation run for almost 1 year resulted in the following performance statistics:
  • * VANILLA TRANSFER MANAGER: NUM INVOCATIONS: 213164, TOTAL MS: 83101, AVG TIME/INVOCATION: 0.3898454ms
  • * NEW TRANSFER MANAGER: NUM INVOCATIONS: 160056, TOTAL MS: 64400, AVG TIME/INVOCATION: 0.4023592ms

Source Code

On Github: https://github.com/TheDogKSP/MoreEffectiveTransfer
License: MIT
Be sure to always respect pcfantasy's original copyright!
This mod uses the Harmony2 library by Andreas Pardeike.

Incompatible mods:

(1) Original More Effective Transfer Manager by pcfantasy. Please completely unsubscribe original before using this one.
(2) District Service Limit (any version)
(3) Enhanced District Services
(4) Transfer Broker - MALWARE WARNING! DO NOT USE!

Recommended mods:

(1) I highly recommend to use this mod in conjunction with "Smarter Firefighters: Improved AI" by themonthlydaily (https://steamcommunity.com/sharedfiles/filedetails/?id=2346565561).
While METM ensures that your fires are serviced by the cloeset fire department, Smarter Firefighters will make each fire truck (or copter) vehicle work relentlessly until everything is extinguished before calling it a day and returning to the station. With both mods together your city fire fighting force will actually be quite effective in containing and putting out fire spread.

Contributions wanted

Contributions in the form of Github Pull Requests are welcome! Unfortunately with the rewrite of this mod the original localizations have been lost. If you want to provide a localization to any language, this is always welcome!

About

Cities: Skylines Mod: Optimize transfer manager in vanilla game. match the shortest transfer bettween offers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%