distribute cargo to multiple stations or industries patch

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
xarick
Transport Coordinator
Transport Coordinator
Posts: 283
Joined: 26 Feb 2015 00:52

distribute cargo to multiple stations or industries patch

Post by xarick »

Changes the way cargo amounts appear on multiple stations, and the way cargo is received by multiple industries accepting that same cargo type.

For stations, instead of spliting the load between the two highest rating stations for that cargo, it splits to all nearby stations, while still considering station rating from highest to lowest. The higher the rating, the more it receives.

For industries, instead of the first nearby industry accepting the cargo, the amount is distributed piece by piece, at random, to any accepting industries within the station catchment area.

screenshot valid for v2
Image

screenshot valid for v2, v1
Image
v2

- Modified the way each piece is delivered. In relation to v1, instead of starting from the nearest industry and ending at the farthest one, it now picks one randomly from all avaiable nearby industries.


[+] Spoiler
Older versions (v1) v1

For industries, instead of the first nearby industry accepting the cargo, the amount is distributed piece by piece, starting from the nearest industry to the farthest industry. This isn't perfect, as the unloading from most vehicles is done in amounts of 5, but it's the best I could think of without requiring a savegame conversion. In the screenshot below, you may notice that only 5 sawmills received wood.

screenshot valid for v1
Image
Formerly known as Samu

User avatar
odisseus
Engineer
Engineer
Posts: 99
Joined: 01 Nov 2017 21:19

Re: distribute cargo to multiple stations or industries patch

Post by odisseus »

While splitting the produced cargo across more stations sounds like a good idea, automatic distribution of delivered cargo to multiple industries does more harm than good. The proper way to distribute deliveries is a distributor service.

User avatar
SciFurz
Engineer
Engineer
Posts: 93
Joined: 13 Oct 2018 16:33
Contact:

Re: distribute cargo to multiple stations or industries patch

Post by SciFurz »

xarick wrote:
03 Nov 2017 19:47
Changes the way cargo amounts appear on multiple stations, and the way cargo is received by multiple industries accepting that same cargo type.

For stations, instead of spliting the load between the two highest rating stations for that cargo, it splits to all nearby stations, while still considering station rating from highest to lowest. The higher the rating, the more it receives.

For industries, instead of the first nearby industry accepting the cargo, the amount is distributed piece by piece, at random, to any accepting industries within the station catchment area.
The way I handled the delivery problem in my patch is to set every station, apart from bus staions, to a 1 tile radius. A cargo station tile needs to be in direct contact with an industry to handle incoming and outgoing cargo. There's no reason to serve stations that are not in direct contact with an industry. Place a (train) station tile against an industry and you can always link a truck or rail station or dock with it if you want to have some distance. Deliveries can be made to different station tiles placed in a row for instance (station1-station2-station3).

As far as I see, the core of the problem is the unbalanced distribution of cargo and the push based economy. Because of that I set cargo distribution to manual to evenly distribute cargo as I see fit, but it would be better if consumers (industries) created cargo packet requests at available source industries to maka a demand based economy, something I plan to look into when I solve the major bug in my realtime patch.
Another method is to set the final destination of a cargo packet to a specific industry instead of a station. For that you'd need to make a virtual link between indusstry and station. I prefer to use the reverse feeder station method though and distribute everything from a single station with trucks to various industries.

For example:
In my test game, incoming cargo is delivered to the north station and distributed by truck to industries while outgoing cargo is handled by the south station.
ModCo, 20780731-0238.png
ModCo, 20780731-0238.png (278.87 KiB) Viewed 762 times
Tinkering in the code in between writing mostly naughty stuff.
See https://www.patreon.com/scifurz

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 8 guests