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

Arie-
Director
Director
Posts: 593
Joined: 20 Jan 2009 16:07

Re: Cargo Distribution

Post by Arie- »

Well I am no expert either, but have your read:
saturation: http://wiki.openttd.org/Passenger_and_c ... ow_problem
effect of distance on demand: http://wiki.openttd.org/Passenger_and_c ... ric_demand

What you could do to reduce passenger numbers, is to prevent the cities from growing fast by changing that setting in the advanced settings. Another option is reduce the number of towns that are cities.
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Cargo Distribution

Post by Eddi »

there is a separate patch to reduce amount of passengers generated, it's included in the "cargodist with sprinkles" patch pack.
bokkie
Transport Coordinator
Transport Coordinator
Posts: 327
Joined: 19 Jan 2007 19:26

Re: Cargo Distribution

Post by bokkie »

Or try this NewGRF, probably the easiest: http://www.tt-forums.net/viewtopic.php? ... 21&start=0 . Haven't tried this version yet so I can't comment on it.
dimon22_g
Engineer
Engineer
Posts: 38
Joined: 17 Aug 2007 05:42
Location: Moscow

Re: Cargo Distribution

Post by dimon22_g »

OK, thank you for the linkls, will read once again with more attention.

About passenger reduction - I am actually using Chill's Patchpak, probably this is what cargo town generation is about. Will have to read another forum topic as well.

Will test the newgrf anyway, seems to be great idea.
comp615
Engineer
Engineer
Posts: 7
Joined: 11 Jan 2010 19:58

Re: Cargo Distribution

Post by comp615 »

Fonso, I'm interested in how you tried to reduce the number of passengers generated. I say this having no knowledge of the inner-workings of the passenger generating code and I'm sure you've thought of this, but I'd recommend something like the following.

Take a minimum cargo percent (0-100 with 100 being no alteration), and then use the formula:
(100 - base_pct) * log(n) / log(total) + base_pct
where n is the number of towns (or sinks) the current town (faucet) is connected to in the connected component and total is the total number of connections possible. Then you'd reduce whatever the currently computed cargo generation number is by this percent. (Obviously only for PAX and maybe mail)

Again, while the formula is simple and should yield ideal results, it might be very hard to restrict the generation of cargo in the code. But I just thought I'd try to help in ase you hadn't already thought of that. Lemmie know!
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

comp615 wrote:Fonso, I'm interested in how you tried to reduce the number of passengers generated. I say this having no knowledge of the inner-workings of the passenger generating code and I'm sure you've thought of this, but I'd recommend something like the following. [...]
This is a variation on what I had with supply scaling. There are some problems with this idea:

1. Multiple stations close to each other with overlapping coverage area are easy to build and give you an unfair advantage (for every sane definition of "total"). I demonstrated that by building extensive bus networks in every town I connected during the first test game. I got max ratings of about 80% even though I was only entitled to maybe 50%. To resolve that you'd have to track the overlapping coverage areas and that'd be very complicated.

2. The place to influence cargo generation in OpenTTD is the station rating. I stuck to that as anything else would be kind of dirty. Then I got two more problems:
a, Primary industries closing down due to low rating or (if you keep the minimum cap high enough to avoid that) barely any effect at all.
b, Insanely low ratings in the early game and basically the same as without supply scaling in the late game. This is bad because in the early game you have problems anyway and in the late game there is a lack of incentive anyway.

This is why I decided to drop supply scaling. In order to reduce passenger numbers I implemented "external ratings" instead. This makes station ratings drop not only for the amount of cargo waiting at the same station but also for the amounts of cargo from that station waiting at any other. So if insane amounts of cargo are piling up at a transfer station those stations where it's from will generate less. This will make the stream of new cargo arriving there dry up. I have the impression that it works fairly OK. Please try it and post saves of where it doesn't.
The guy on the picture is not me, it's Alonso.
dimon22_g
Engineer
Engineer
Posts: 38
Joined: 17 Aug 2007 05:42
Location: Moscow

Re: Cargo Distribution

Post by dimon22_g »

Is the raiting shown on the station in the station window this "external rating"?
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Yes, it's the station rating. As you might have noticed the rating at some station, let's call it A, drops if you have a lot of cargo waiting at A. With the "external rating" feature this is extended so that the rating at A also drops if a lot of cargo from A is waiting at another station. So this is not a new kind of rating, but only a new feature for the existing station rating.
The guy on the picture is not me, it's Alonso.
audigex
Tycoon
Tycoon
Posts: 2056
Joined: 09 Dec 2007 21:28
Contact:

Re: Cargo Distribution

Post by audigex »

Is there a current-ish build of this anywhere?

The last build of cargodest with improved timetables misses out too many new features I can't live without
The current trunk misses out cargod*st and improved timetables

I need a cargo-packet-distribution fix! And if someone can build me a copy with ITiM and cargodist, I'll give you £50
Jon
Grandmaster
Engineer
Engineer
Posts: 72
Joined: 11 Feb 2007 21:10
Location: Rotterdam, Netherlands

Re: Cargo Distribution

Post by Grandmaster »

audigex wrote:
I need a cargo-packet-distribution fix! And if someone can build me a copy with ITiM and cargodist, I'll give you £50
You might want to look for chill's patch pack.

http://www.tt-forums.net/viewtopic.php?f=33&t=47622
Creat
Traffic Manager
Traffic Manager
Posts: 141
Joined: 26 Oct 2009 16:33

Re: Cargo Distribution

Post by Creat »

If I have a couple of minutes this evening I'll make you a build (if Win32 works for you). I can merge you improved timetables, as that's just one command and usually applies without conflicts...
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: Cargo Distribution

Post by Zephyris »

From the first post in this thread it looks like the coding is nearly complete, is this the case? Are there any significant issues or is it all coming together nicely?
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

There's three things I still have on my to-do-list:
  • documentation and coding style. I'm done with that on roughly half of the code.
  • optimize the smallmap's link graph mode. It's way too slow.
  • provide a way to calculate everything in the main thread and still not hang the main thread for extended periods of time. The main thread will call a function LinkGraph::Step in each tick and the link graph components will tell how many steps they need to complete the calculation. I think the devs absolutely don't like my usage of threads so I have to provide another way of doing it if I want cargodist to be merged.
The guy on the picture is not me, it's Alonso.
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: Cargo Distribution

Post by Zephyris »

Sounds good, but quite a bit of work then? Do the hangs make desynchs at the moment?
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

No, the hangs only occur if you switch off threads and they are most likely not the cause of desyncs. If you have any information about the remaining desyncs - how to trigger them, savegames which have desynced, description of what you were doing when a desync happened, dmp_cmd saves or basically anything that might be interesting - please do post it. I have currently no idea what caused the single desync in the last "wasteland" game and that's bad.

Check what version you are running before posting, though. This one is known to desync a lot and I don't need further reports for it. Most of those desyncs are fixed in this one, but at least one is still there. I'm very much interested in reports about it.

And if you experience hangs while threads are on I'm interested in that, too (but please no Cindini or other games of similarly insane dimensions - those are expected to hang and we have talked about possible solutions earlier).
The guy on the picture is not me, it's Alonso.
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: Cargo Distribution

Post by Zephyris »

Cool, I will let you know if anything turns up!
audigex
Tycoon
Tycoon
Posts: 2056
Joined: 09 Dec 2007 21:28
Contact:

Re: Cargo Distribution

Post by audigex »

Just a thought I had - instead of a fixed "via" for every single passenger, why not allow a "via x OR y" for routes with a similar cost?

ie I have a route where my trains alternate between two similar routes. With the current system it waits until one route is very saturated before using the other, but it would be reasonable for passengers to get the local train for parts of the route, since it only stops at one extra station and barely takes any longer.

I'm presuming it would be extra work, and the patch works fine without it - it might be nice as a wishlist feature though? :)
Jon
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Cargo Distribution

Post by Eddi »

there is a setting how saturated a line should be before considering alternate routes
GoldRush
Engineer
Engineer
Posts: 85
Joined: 27 Oct 2009 16:40

Re: Cargo Distribution

Post by GoldRush »

Would someone PLEASE explain, in Plain English, how the "symmetric" and "asymmetric" modes of CargoDist works?!? So that a common man could easily understand? Maybe a little strategy?
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Cargo Distribution

Post by Eddi »

use "symmetric" for cargo that goes (roughly) balanced in two directions, e.g. passengers, mail, valuables.

use "asymmetric" for cargo that only travels one way. e.g. raw materials to a factory, or goods from factory to town.
Post Reply

Return to “OpenTTD Development”

Who is online

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