Cargo Distribution

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

zde-nek
Engineer
Engineer
Posts: 57
Joined: 15 Jun 2008 20:34
Location: Prague

Re: Cargo Distribution

Post by zde-nek »

hi, i have one question: how to set link graph setting in order to ensure that most of generated passenger destinations will be near the starting station (regional or even within city in case of big cities (2000+ in my games)). is it somehow possible? it's very hard to transport all passengers by long-distance trains or planes in late years of game. thank you in advance
dasy2k1
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 20 Sep 2006 23:43
Location: UK
Contact:

Re: Cargo Distribution

Post by dasy2k1 »

Im having problems with the tourist cargo flows,

Tourists will only go to the tourist centers (newgrf) if thats the only destination for their source,
and for some reason cargodist isnt tiggered.

if i were to have 2 possable destinations, one of them another city area all the toursists will travel between the citys totally ingnoring the centre

im not sure how demand is worked out for delivery to an industry with other cargos but surely if the watch tower staton accepts tourists there should be cargo generated
Attachments
screenshot showing newgrfs etc
screenshot showing newgrfs etc
Wehill Transport, 3rd Nov 1928.png (74.32 KiB) Viewed 1093 times
Wehill Transport, 3rd Nov 1928.sav
(172.61 KiB) Downloaded 77 times
User avatar
bluebottle
Engineer
Engineer
Posts: 29
Joined: 21 Sep 2009 03:23

Re: Cargo Distribution

Post by bluebottle »

huss wrote:
bluebottle wrote:a sudden, massive negative income on my aircraft
That sounds exactly like the problem I had, which I reported to fonso and (according to him and as far as I can tell) has been fixed since then. Have you tried the latest version or the binary supplied by id10terror?
Yes, it looks that way. I didn't know exactly what had caused it (the zero cost) when I reported the bug, and I was thrown off by the aircraft fleet window showing all aircraft still with positive income. I'll try a git build since I can't use a Windows binary.
KingJ
Engineer
Engineer
Posts: 6
Joined: 06 Oct 2007 12:32

Re: Cargo Distribution

Post by KingJ »

I'm having a small issue with id10terror's binary. It appears that when passengers interchange at a station (e.g bus -> train, or train -> another train) they simply disappear. For example, at station A there are 10 passengers that want to get to C. To do so, they take a train from A to B, then switch onto another train from B to C. However, when they arrive at B, the train unloads and gets income, no transfer income appears and no passengers appear at the station. Also, at stations where passengers are not accepted, they will not switch, instead they remain on the vehicle.

I'm not sure why this is happening, i've not come across this in any previous builds. I have attached my savegame. If anyone can offer any insight as to why this happens, it would be appreciated.

NewGRFs used in the save game are eGRVTS1.0, UK Renewal Trainset 3.04, UK Renewal Addons 3.04 and Very large ships 0.1.

Many thanks.

Edit: The only vehicles that seems to get transfer income are the planes, i've never seen any trains or buses get transfer income in this build.
Attachments
GB Rail Services, 31st Aug 2044.sav
(2.05 MiB) Downloaded 61 times
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

I'm back. I'll take care of the various reports in the next days. I already have a nice idea on how to get rid of the remaining desyncs. That will be done first.
The guy on the picture is not me, it's Alonso.
WWW
President
President
Posts: 920
Joined: 28 Jan 2005 20:37

Re: Cargo Distribution

Post by WWW »

can you give us a couple of .diffs and the versions they're against, please?
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

WWW wrote:can you give us a couple of .diffs and the versions they're against, please?
I'll give you a new release when the known problems are solved. These are:
  • desync because of multimap
  • possibly still massive negative income (huss, bluebottle)
  • possibly tourists can't be defined as symmetric cargo (dasy2k1) - they should be "EXPRESS", but maybe they aren't.
  • possibly influence of distance on demand can only be decreased, not increased (zde-nek)
  • unknown problem reported by KingJ - maybe he's missing the "non-stop"
  • maybe other problems earlier in the thread I can't remember at the moment.
I'll give you a diff on current trunk here. If you'd like to help me, you can try to verify the problems where I'm not sure with the save games from the reports and give me more specific descriptions. I'm working on the desync.
Attachments
cargodist_r17641.diff
patch
(289.87 KiB) Downloaded 86 times
The guy on the picture is not me, it's Alonso.
PetasIII
Engineer
Engineer
Posts: 18
Joined: 17 Aug 2009 15:19
Location: Czech republic
Contact:

Re: Cargo Distribution

Post by PetasIII »

Here´s latest compiled win32 build of cargodist. Compiled using MSVS08 + DirectX SDK (with working sound).
Attachments
CargoDist r17641.rar
cargodist r17641 win32
(3 MiB) Downloaded 111 times
ImageImageImage
philipabbott
Engineer
Engineer
Posts: 10
Joined: 29 May 2005 03:30

Re: Cargo Distribution

Post by philipabbott »

Hi, I just tried new win32 build (r17641). And i am getting this error when to goto some road depots.
Assertion failed at line 43 of c:\17641\sre\core/pool_type.hpp:index <this->first_unuesd.
Attachments
Kentown Transport, 3rd Feb 1950.sav
(394.47 KiB) Downloaded 82 times
Kentown Transport, 6th Jan 1950.png
Kentown Transport, 6th Jan 1950.png (167.8 KiB) Viewed 996 times
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Cargo Distribution

Post by NekoMaster »

philipabbott wrote:Hi, I just tried new win32 build (r17641). And i am getting this error when to goto some road depots.
Assertion failed at line 43 of c:\17641\sre\core/pool_type.hpp:index <this->first_unuesd.
did you have any ai's on?
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
philipabbott
Engineer
Engineer
Posts: 10
Joined: 29 May 2005 03:30

Re: Cargo Distribution

Post by philipabbott »

Yes, I had TownCars running
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

philipabbott wrote:Hi, I just tried new win32 build (r17641). And i am getting this error when to goto some road depots.
Assertion failed at line 43 of c:\17641\sre\core/pool_type.hpp:index <this->first_unuesd.
This savegame is inconsistent. The depot IDs in the map array don't correspond to the actual depots. What is the history of that game? With which revisions of cargodist and possibly other patches did you play it? And can you post earlier saves of it? It would be nice to find the last save where the depots are correct, the first one where they are broken and the trunk and patch versions you created the broken one with.
The guy on the picture is not me, it's Alonso.
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Cargo Distribution

Post by NekoMaster »

philipabbott wrote:Yes, I had TownCars running
Thats why, the last few nightlies (fixed yesterday) had a problem with loading ai's, openttd would crash when they loaded up and started a new company
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

NekoMaster wrote:
philipabbott wrote:Yes, I had TownCars running
Thats why, the last few nightlies (fixed yesterday) had a problem with loading ai's, openttd would crash when they loaded up and started a new company
Are you sure? I guess you mean this one:

Code: Select all

git diff 200a83d033f2248c71412ba0fb71bab74e59f99b 3bcec1e93165f72eb1859454facdef505ff33232
diff --git a/src/table/settings.h b/src/table/settings.h
index 1bdb6f5..0fee7ef 100644
--- a/src/table/settings.h
+++ b/src/table/settings.h
@@ -83,7 +83,7 @@ static bool UpdateClientConfigValues(int32 p1);
  */
 
 #define NSD_GENERAL(name, def, cmd, guiflags, min, max, interval, many, str, proc, load)\
-       {name, (const void*)(def), {(byte)cmd}, {(byte)guiflags}, min, max, interval, many, str, proc, load}
+       {name, (const void*)(def), {(byte)cmd}, {(uint16)guiflags}, min, max, interval, many, str, proc, load}
 
 /* Macros for various objects to go in the configuration file.
  * This section is for global variables */
It's not quite obvious how this corrupted m2. The depot fields in m2 are almost all wrong while the rest of the game seems OK.
The guy on the picture is not me, it's Alonso.
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

zde-nek wrote:hi, i have one question: how to set link graph setting in order to ensure that most of generated passenger destinations will be near the starting station (regional or even within city in case of big cities (2000+ in my games)). is it somehow possible? it's very hard to transport all passengers by long-distance trains or planes in late years of game. thank you in advance
The effect of distance on demands actually couldn't be increased beyond 100% and the implementation for <100% had some serious bugs, too. A fix is in my git repository. You can have up to 255% now. Higher values create numeric instability if you have a high accuracy, so I didn't allow them. If that's not enough for you, post a savegame and I'll further tune the algorithm.

Also I have fixed the desync by implementing my own multimap which guarantees a deterministic order for elements with the same key. It should now work with any combinations of standard C++ libs.
The guy on the picture is not me, it's Alonso.
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

There is another speed optimization in my git repository. You can see this as a new iteration of FS#3133. I believe the cargo loading is faster than in trunk now. I have tried with a game that took about 4 seconds per game day with trunk and it takes the usual 2.5 seconds with cargodist now.

This is mostly because I've gotten rid of all the looping over cargo lists except for cargo aging and I've found a more intelligent strategy for finding and merging packets from the same source. I have indexed the vehicle cargo lists so that packets can be merged in logarithmic time (thus producing fewer packets in vehicles and speeding up AgeCargo). In vehicles the FIFO principle isn't as important as in stations, so this can be done without causing strange side effects. In turn I have removed the search for mergeable packets in station cargo lists as this is very expensive and actually breaks the FIFO principle. Instead I only check the very last packet in the list of packets with the same destination for merging now. This packet is merged in many cases anyway as often multiple similar packets are generated or unloaded (and appended to the list) in succession. For generated cargo the algorithm in trunk loops over all of the cargo in a station to find the very last packet in this case. In large stations with lots of cargo throughput this is horribly expensive.

I'll happily create an equivalent patch for trunk with these improvements, but first FS#3135 (see branch "cargolist" in my git repository for more recent versions) has to be merged as all this builds on it.

Unfortunately the changes break savegame compatibility with earlier versions of cargodist again. I have removed the "next" field from CargoPacket which is unnecessary as the multimap already holds it. Sorry.
The guy on the picture is not me, it's Alonso.
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

dasy2k1 wrote:Im having problems with the tourist cargo flows,

Tourists will only go to the tourist centers (newgrf) if thats the only destination for their source,
and for some reason cargodist isnt tiggered.

if i were to have 2 possable destinations, one of them another city area all the toursists will travel between the citys totally ingnoring the centre

im not sure how demand is worked out for delivery to an industry with other cargos but surely if the watch tower staton accepts tourists there should be cargo generated
I don't quite know if I understood your question. But the obvious problem with this savegame is that the link between Wehill and Wehill Woods is always breaking down. Either have more vehicles serve it to keep it alive while the cargo distribution is calculated, or increase your moving average (mind the side effects), or live with tourists going to "any station".
KingJ wrote:I'm having a small issue with id10terror's binary. It appears that when passengers interchange at a station (e.g bus -> train, or train -> another train) they simply disappear. For example, at station A there are 10 passengers that want to get to C. To do so, they take a train from A to B, then switch onto another train from B to C. However, when they arrive at B, the train unloads and gets income, no transfer income appears and no passengers appear at the station. Also, at stations where passengers are not accepted, they will not switch, instead they remain on the vehicle.

I'm not sure why this is happening, i've not come across this in any previous builds. I have attached my savegame. If anyone can offer any insight as to why this happens, it would be appreciated.

NewGRFs used in the save game are eGRVTS1.0, UK Renewal Trainset 3.04, UK Renewal Addons 3.04 and Very large ships 0.1.

Many thanks.

Edit: The only vehicles that seems to get transfer income are the planes, i've never seen any trains or buses get transfer income in this build.
I don't quite get that either. I see a lot of transfer income there. Maybe you should name the stations where the problems occur in the savegame. An obvious problem in your game is that you don't use "non-stop" with most of your orders. We have discussed that multiple times here ...
The guy on the picture is not me, it's Alonso.
User avatar
tsjook
Traffic Manager
Traffic Manager
Posts: 197
Joined: 22 Apr 2009 18:33

Re: Cargo Distribution

Post by tsjook »

Thanks for the ongoing work fonso, looking forward to a new release.

I'm experiencing regular crashes in my r17268 cargodist precompiled win32-binary found earlier in this thread. Would it still be helpful to post the crash dump and save?
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

tsjook wrote:Thanks for the ongoing work fonso, looking forward to a new release.

I'm experiencing regular crashes in my r17268 cargodist precompiled win32-binary found earlier in this thread. Would it still be helpful to post the crash dump and save?
That would be nice if you have them. I still cannot reproduce that crash. However, I thought that binary didn't generate crash saves and dumps ...

Has anyone seen crashes in more recent versions? (except for philippabbott's broken savegame)

I'll probably release a new version with patch and updated documentation and the likes on monday.
The guy on the picture is not me, it's Alonso.
User avatar
tsjook
Traffic Manager
Traffic Manager
Posts: 197
Joined: 22 Apr 2009 18:33

Re: Cargo Distribution

Post by tsjook »

Ok, here goes.

(I always wondered why those crash saves are so small compared to normal savegames, because if you load them nothing seems to be missing)
Attachments
Crash r17268-prebuilt-Win32.rar
(257.85 KiB) Downloaded 87 times
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 7 guests