Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon May 21, 2018 7:24 am

All times are UTC




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Sep 29, 2017 1:31 pm 
Offline
Engineer
Engineer

Joined: Thu Sep 28, 2017 1:39 pm
Posts: 1
I've created a patch do distribute incoming cargo over multiple industries, This so i can get some extra good's out on my stations by building extra factories.
It's my first patch and my first c++ in 10 years, so any feedback is welcome.

It works as follows:
When the game tries to deliver the cargo from the unloading vehicle to the industry instead of finding the first one and drop all the items in that industry it first checks how much accepting industries there are.
If there is only one it will drop the cargo on that one.
If there is more than one it will divide the amount of cargo evenly over all the industries, and buffer the remaining cargo for the next run.
Eg: 5 items of cargo delivered to 2 factories mean both factories will get 2 items and 1 item will be buffered. When the next 5 units arrive it will add the 1 still buffered and deliver 3 cargo to the factories.

The buffered cargo isn't saved when saving (As far as I know, I don't know how data is getting saved), so saving and loading may cause some lost cargo, but this is only a small amount (< num factories for the station per station). I don't think it's worth
I'm not sure how this patch will work in multiplayer or if it will cause desyncs, I've got no knowledge about how the multiplayer code works.

Note that when applying the patch to an already patched game or newer version it may be needed to manually adjust the savegame version in saveload.cpp and settings.ini

There is a setting to toggle the function on and off, By default, it is off. So you have to enable this manually.

Attachment:
cargodistribute_r27917_1.diff [8.94 KiB]
Downloaded 36 times


Screenshots:
[+] Spoiler
Image
Image


Attachments:
throughput.png [676.84 KiB]
Not downloaded yet
ecs.png [322.91 KiB]
Not downloaded yet
Top
   
PostPosted: Sat Nov 04, 2017 1:44 am 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Feb 26, 2015 12:52 am
Posts: 212
I tried to code something similar.
I've also tried adding a "buffered cargo", which i called "fraction cargo" but instead of making it part of the station struct, I made it part of the Industry instead.

It didn't do as well as yours. I was getting a high degree of variance on cargo delivered per industry.
Image

When I tried yours, I got a better picture.
Image


Wish I had the code to show you, but I gave up on it.

_________________
Formerly known as Samu


Top
   
PostPosted: Tue Dec 05, 2017 9:09 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 6997
Bartje321 wrote:
The buffered cargo isn't saved when saving [...] I don't think it's worth
I'm not sure how this patch will work in multiplayer or if it will cause desyncs

saving is essential for multiplayer-safety. all players must get the exact same game state, which is done by transferring a savegame.

so even if you think one or two cargo pieces is not that relevant, it's exactly that one or two difference that will cause a desync in multiplayer. (this is also why we cannot use floating point numbers, because we cannot have any rounding errors)

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.