YACD - Yet Another CargoDestinations (v2.3 released)

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

Progman
Engineer
Engineer
Posts: 76
Joined: 15 Jul 2006 12:55
Contact:

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Progman »

Progman wrote:I have found a bug where trains do not pickup the cargo even after they did one delivery turn before. The train in the attached game (DBSet NewGRF used) is waiting in the station, even marked as loading but does not pickup the cargo. Unfortunately I haven't found a way to reproduce this bug, so I'm not sure if it is NewGRF related, train copy related, or something else. I also don't have a save before this situation. And a funny fact in this savegame: If you fast forward the game you see that the station is filled with coal cargo up to about 1000 tons and then suddenly its removed (and the train still try to load cargo).
I found a way to reproduce it and its unrelated to NewGRF and train copy. Its more an issue with intermediate orders which are part of the order list. Steps to reproduce the error:
  1. Build a normal line between supplier and consumer, like coal<->power plant.
  2. Build one train with full load, start the train.
  3. While the train is loading skip the current order so its heading to the power plant.
  4. After the train leaved the station skip the next order again so he is heading to the coal mine (but cannot reach it directly).
  5. Be sure there is no short cut to the coal mine after leaving the coal mine station, this includes depots. This way the train is forced to go through the drop station. If the setting "Hold on intermediate stations" is ON the drop station will added to the order list as an intermediate station (with the attribute "(automatic)" and in gray).
  6. Now simply watch the train until the train do not load any cargo form the pickup station (after one complete round).
Attached is a savegame which will show the bug (after step 4). Check the order list of the train while observing the train. After one complete round the train refuse to pick up any cargo from the coal mine.
Attachments
no load bug.sav
(128.78 KiB) Downloaded 132 times
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Michi_cc »

Progman wrote:Attached is a savegame which will show the bug (after step 4).
I haven't look at the save in detail yet, but that's something that should not fail, even if the automatic order handling of OpenTTD is not quite optimal in this situation.

-- Michael Lutz
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5705
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by andythenorth »

Mondane wrote:Now, when cargo appears at an industry, the game chooses randomly between method a and c
I'm not sure this would not make for good gameplay. imo, there should be just one cargo distribution method active in a game.
Cadde
Transport Coordinator
Transport Coordinator
Posts: 290
Joined: 07 Oct 2004 12:51

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Cadde »

I think this patch sounds way more interesting than the earlier attempts. Mainly because i want my cargo to decide where it wants to go and it's up to me to fill the demand.

So let's say 100 passengers from town A want to go to town B per month... The distance between these 2 towns is 40 tiles which is far enough for a medium speed / medium capacity train.
Then alternatively, 50 passengers from town A want to go to town C per month... The distance between these 2 towns is 120 tiles which is good for a high speed train.

If i pick the route A <-> B i don't have to spend as much money on building the route but the route will not pay as much either.
However, if i pick the route A <-> C i have to invest a lot more but the income will be greater too.
The danger then is that these variables might change later on. Maybe the people going from A to C decreases due to some "outside the box" event. Maybe it's just a temporary demand.
Or if you should make a route A <-> B <-> C which is slower but less expensive for the customer. In other words, as a transport manager you always have to consider where the cargo want's to go. You don't get to decide the demand, only the means of how the cargo gets there.

That is what i dislike about the other cargo distribution solutions out there. I make the links and they are automatically filled to capacity as if cargo just wants to go anywhere like normal TTD.

There should be a prognosis in the cargo generating town/factory that tells you what amount of cargo is expected to be produced and where it would want to go. Then it's up to you to decide if you want to fill that demand and ensure that it's popular enough (no breakdowns, fast enough) to grow.
rini17
Engineer
Engineer
Posts: 19
Joined: 28 Apr 2004 10:54
Contact:

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by rini17 »

There is IMHO a bug related to industry production changes. I like to play large sparsely populated maps and I can't deliver coal or similar cargo to more than 1-2 destinations in the start of game (other dests are too far). Thus I get low transported percentage and all serviced coal mines quickly decrease production or close. :?

The output to given destination wildly varies every month - what was the reason to do this? It should have some correlation to how well player services given path, instead. Is there some knob for this?

Otherwise, plaing with yacd is fantastic, especially for passengers!

EDIT: I tried various approaches, but no avail. Then I then noticed that list of destinations changes as well... this makes industries completely unplayable! You have to connect everything, this is not possible when starting game. When transporting passengers, there are only a few big cities, and one can use planes. Not so for coal...
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by fonso »

Michi_cc wrote: Right now you're not duplicating anything, simply because I won't have time for more work till next week. But you're right, I changed that to enable better control (another cargo group) and allow extending later on. The reason for changing that already was simply to avoid a save game break later now that binaries are generated.
In fact I won't have time to work on distyacd this weekend nor next week, either.
The guy on the picture is not me, it's Alonso.
rini17
Engineer
Engineer
Posts: 19
Joined: 28 Apr 2004 10:54
Contact:

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by rini17 »

rini17 wrote:There is IMHO a bug related to industry production changes. I like to play large sparsely populated maps and I can't deliver coal or similar cargo to more than 1-2 destinations in the start of game (other dests are too far). Thus I get low transported percentage and all serviced coal mines quickly decrease production or close. :?
I tried to read the source and found that setting

Code: Select all

cargodest.ind_nearby_dist = 25000
in openttd.cfg helped. Original value was 2407 .

What the code seems to do, it does try to create some routes to "nearby" industries. They have squared distance roughly lower than ind_nearby_dist. As I like to play 1024x1024 map with Very Low industries, almost all industries were outside this value. In that case it picked randomly some industry, usually very far.

This is perhaps not a solution for everyone, I propose to scale ind_nearby_dist according to mean distance between industries - on dense maps it can be lower, on sparse maps higher. Maybe I will be able to code this myself, dunno. But please, I need feedback from you whether this is acceptable.

At least for primary cargo like coal/livestock/water/etc. I have no problem with transporting secondary products like goods/paper/food all across the map. Incidentally this is also the case in real life (except only for oil).
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Michi_cc »

rini17 wrote:This is perhaps not a solution for everyone, I propose to scale ind_nearby_dist according to mean distance between industries
The distance is linearly scaled with the map size (not by the industry distance though, as that could be counter-productive, e.g. FIRS clusters some industries, which makes a mean distance not very accurate). The actual map area is growing quadratically though, but I don't think the distance should be scaled quadratically as well. What's the point of playing larger maps then if everything stays the same.

-- Michael Lutz
rini17
Engineer
Engineer
Posts: 19
Joined: 28 Apr 2004 10:54
Contact:

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by rini17 »

Michi_cc wrote:
rini17 wrote:This is perhaps not a solution for everyone, I propose to scale ind_nearby_dist according to mean distance between industries
The distance is linearly scaled with the map size (not by the industry distance though, as that could be counter-productive, e.g. FIRS clusters some industries, which makes a mean distance not very accurate). The actual map area is growing quadratically though, but I don't think the distance should be scaled quadratically as well. What's the point of playing larger maps then if everything stays the same.

-- Michael Lutz
Yes I play such maps exactly because they are different. But playing with industries on huge map with low density is impossible in unmodified YACD 2.2, not only different. Please try it for yourself.
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Eddi »

Michi_cc wrote:
rini17 wrote:This is perhaps not a solution for everyone, I propose to scale ind_nearby_dist according to mean distance between industries
The distance is linearly scaled with the map size (not by the industry distance though, as that could be counter-productive, e.g. FIRS clusters some industries, which makes a mean distance not very accurate). The actual map area is growing quadratically though, but I don't think the distance should be scaled quadratically as well. What's the point of playing larger maps then if everything stays the same.

-- Michael Lutz
maybe could factor in industry density from the difficulty settings.
User avatar
Tafidis
Traffic Manager
Traffic Manager
Posts: 157
Joined: 19 Oct 2010 19:49

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Tafidis »

Alternate solution to the distribution of cargo destinations (which I have already suggested for pax above):

Instead of cargo going only to intended destinations, it could try to go as close as possible (to a station that accepts it). Example:

Say I am playing with small number of industries, so there is only 2 coal mines/2 power plants. Now both coal mines generate cargo for both plants, but in the beginning of a hard game I can only make a single point-to-point route. So, assuming that the power plants are close to each other, then all cargo from either coal mine goes to a single power station. You get a payment penalty (or bonus) for cargo going to its alternative/actual destination.
The rule is: cargo tries to go to its intended destination first. If that is currently unreachable, then it goes to a destination as close as possible. The distance between this alternate destination and the intended destination can never be greater than the distance between the cargo origin and the intended destination, thus connecting to a very remote destination will still generate zero/very little cargo.

This would give a boost when you start your network by having more cargo to carry on your first route. Over time, the network is optimized by connecting more destinations, and the incentive for optimizations is the added bonus for cargo being delivered where it actually wants to go. Conceptually, this makes more sense for pax, but for raw materials/goods it could also mean that the industry is forced to take alternative contracts due to lack of transportation options, resulting in less financial reward for the transporting company.
Citizens Celebrate! First train arrives in <insert your favourite town/station name here>!
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4766
Joined: 09 Sep 2007 05:03
Location: home

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Alberth »

Tafidis wrote:The rule is: cargo tries to go to its intended destination first. If that is currently unreachable, then it goes to a destination as close as possible. The distance between this alternate destination and the intended destination can never be greater than the distance between the cargo origin and the intended destination, thus connecting to a very remote destination will still generate zero/very little cargo.
Huh?
Your rule means that I only have to move the cargo 1 tile in the right direction to get it.

I think that makes the idea of destinations pretty much useless, eg for an industry near the edge, just move it 1 tile away from the edge, and you have many destinations already.


I would welcome a different concept though. In my 4 attempts at a yacd game, I did not manage to make any useful profit, so it is definitely much more difficult to get going.
On the other hand, it makes a nice challenge for those people that think OpenTTD is too simple :)
User avatar
Dimme
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 30 Jul 2008 12:42
Location: Trondheim, Norway

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Dimme »

Eddi wrote:
Michi_cc wrote:
rini17 wrote:This is perhaps not a solution for everyone, I propose to scale ind_nearby_dist according to mean distance between industries
The distance is linearly scaled with the map size (not by the industry distance though, as that could be counter-productive, e.g. FIRS clusters some industries, which makes a mean distance not very accurate). The actual map area is growing quadratically though, but I don't think the distance should be scaled quadratically as well. What's the point of playing larger maps then if everything stays the same.

-- Michael Lutz
maybe could factor in industry density from the difficulty settings.
I just finished a game in a 2048*2048 map, with 100 towns and no city growth. The distance between towns then mostly got above the limit, giving completely random connections, so I had to use mostly aircraft to get a decent income. Aircraft is much better here than in the normal game, since they are so easy to put up. I got a network with a few hub airports, which is not easy to do with trains.

It was great fun, and I guess I could make more cities if I wanted to use trains more. (Or change the setting)
Try my modular airports minigame!

Image
User avatar
Tafidis
Traffic Manager
Traffic Manager
Posts: 157
Joined: 19 Oct 2010 19:49

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Tafidis »

@Alberth: Moving cargo one tile won't cut it, because (a) the alternative destination HAS to be a station that ACCEPTS the cargo, and (b) 1 tile transportation distance won't yield too much profit. You are right though, in that the idea needs to be a bit more fleshed out to see if it can be exploited in a way similar to what you suggest
Citizens Celebrate! First train arrives in <insert your favourite town/station name here>!
User avatar
Expresso
Tycoon
Tycoon
Posts: 1760
Joined: 09 Aug 2004 00:14
Location: Gouda, the Netherlands

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Expresso »

Perhaps the distance difference could be used to compute a price reduction? That should give some incentive to connect the destination.

Say that 100tons of coal needs to travel 1000 tiles, but the player only transports it for 100 tiles, to a station next to a power plant. This would reduce the price the coal would fetch by 90%.

To give the player further incentive to actually deliver to the correct industry, the industry that actually produced the cargo could favor the player less, or (even better) its chance to increase production could be lowered and if the distance difference is large enough the chance the production of the industry drops could even be raised... but this is imho left to a patch on top of YACD.
User avatar
Gord
Chairman
Chairman
Posts: 775
Joined: 15 Aug 2007 10:14
Location: Upper Gornal, Dudley

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Gord »

I've had a good play around with this patch now....and like it a lot.

I like the way that when you create a city, the long distance destinations are usually other towns that have been classified as cities. I assume this is intentional. Even if it isn't..i like it! It gives a purpose for choosing 'city' when putting towns into a scenario.

Would be good if smaller towns looked for their nearest city and used that as the most popular destination. For example, one city may be top of the list of destinations for it's satelite towns within a certain distance. This does happen with some towns already.
ChoHag
Engineer
Engineer
Posts: 10
Joined: 12 May 2011 16:05

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by ChoHag »

Passengers seem to want to travel back to where they started.

There are only 4 stations in the whole map, all 3 connecting directly and only to Cairo.

Edit: I should add - money is still being made. Do I just misunderstand the station view? My passenger services in a previous game are haemorrhaging money which is why I started looking into it.

Edit: Changed screenshot and savegame to be compatible with stock YACD 2.2 binary.
Attachments
McAlpine & Co., 1975-11-30.png
McAlpine & Co., 1975-11-30.png (57.26 KiB) Viewed 3617 times
McAlpine & Co., 1975-11-29.sav
(98.17 KiB) Downloaded 132 times
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4766
Joined: 09 Sep 2007 05:03
Location: home

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Alberth »

Conditional order bug? Presence of a conditional order prevents delivery of grain.
version YACD 2.2, r22439

A setup where several farms supply a number of factories.
Trains from the farms all drop at the first factory. Other trains then serve the second and third factory.

This works nicely with cattle.
Train 10 is the first grain train. Its farm can supply the first and the third factory. Train 9 is waiting to serve the third factory.
Despite, train 10 only gets grain for the first factory.

The culprit seems to be the conditional order in the orders of train 9. It short-circuits the train back to the first factory when it is empty after unloading at the second factory.
If you remove the order, the minimap adds a grain link to the third factory.

The same order is also part of the cattle transports to the second and third factory (trains 2 and 8 ). However, that route was set up without the order, it was added later.
Attachments
condorder.sav
(29.59 KiB) Downloaded 163 times
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4766
Joined: 09 Sep 2007 05:03
Location: home

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by Alberth »

Seemingly, I found a link balance problem.
version YACD 2.2, r22439

Another feeder system. Plastic arrives from the south at 2 in the overview. Together with the production of the local fountain, it is brought to 3.
This nicely works.

To extend the service (I thought at the time), I want to bring plastic from 1 to 3 too. (That is not working, as no plastic wants to go there. See also below.)
Thus, I buy a new train at 1, see the picture. The numbers 1..5 are the places that should be visited by the train. DO NOT START THE TRAIN.

The cargo at 2 that must go to 3 is immediately allocated to this train, it seems. The regular trains between 2 and 3 start making losses (see the picture, it is loading at 4% yet there is 2/3 train of plastic waiting to go in the same direction), and the cargo piles up. Even new plastic from the local fountain gets added to the pile rather than being loaded in the empty train.
I stopped watching when it reached 600,000 liter (4 full trains). It still showed no sign that the cargo was moving back to the regular service.


(As for my weird connection, actually, I should have connected it to a factory further to the west. I do want to visit station 2 though so plastic can be brought from 2 to 1 as an intermediate step to serving the Pedston toy factory at the far east.)
Attachments
linkbalance.sav
(163.66 KiB) Downloaded 151 times
overview
overview
link1.png (33.12 KiB) Viewed 3552 times
detailed view
detailed view
link.png (117.62 KiB) Viewed 3552 times
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5705
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: YACD - Yet Another CargoDestinations (v2.2 released)

Post by andythenorth »

My current save. Trains 16 and 20 are big mixed trains running between a small number of big yards. Small feeders then trip stuff to/from the yards.

This is a save from a YACD 1.2 patch and might also need grfs from the coop bundles server: http://bundles.openttdcoop.org/
Attachments
Snoozeweed Transport, 26th Oct 1994.sav
(458.21 KiB) Downloaded 133 times
Last edited by andythenorth on 15 May 2011 14:06, edited 1 time in total.
Post Reply

Return to “OpenTTD Development”

Who is online

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