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

Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

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

Post by Michi_cc »

Lupin III wrote:
nuffsed wrote:I have noticed a small issue where I have n number of trucks going to 1 industry for a Load and out to different towns for unload. If I have a check after each unload to return to beginning if empty no cargo is being generated at the industry.
I have the same problem. And I think it will never work with this version of YACD. Consider this: pre-filling is disabled, so no cargo is generated until a truck did one full trip. But it can't do a full trip, because it will immediately turn around because it has no cargo... What I didn't try though and just came to mind: what happens if you have one truck to do the full trip without conditional orders and the rest with the "shortcut" orders? I fear the second fleet wont get loaded though.
Indeterministic orders are conceptually impossible to support for a deterministic cargo routing algorithm. Cargo can only be routed when the destinations of a vehicle are known before loading the cargo, but conditional orders based on load percentage make that impossible (as it's not only about what would be loaded at the current station, but about what would be loaded at the next stations in the future).
Lupin III wrote:
TERdON wrote:I don't think that is included in the save game as of now, I simply changed the network instead. The example I had was where I had a train route A-B-C-D, and a bus route A-C-E-F, and passengers took the route A-C-D, which indeed has fewer jumps.
I've seen the same with a plane link as a shortcut to a long distance train service. Except in my case no passenger wanted to go by plane. On a line A-....-Z (airports A_ap and Y_ap connected in resp. city by local metro) with trains only having the endpoints as orders all passenger take the train from A to Z. For the plane they would have had to go to A-A_ap-Y_ap-Y-Z. Sure the second one would have more hops, but it would still be way faster, while trains are filling up.
It's quite likely that the one or other routing penalty can still be improved, but you can help our here by experimenting with the various penalties (list_settings pf.yapf.route in the in-game console gives the list) or by providing a save game that shows such an issue in an isolated setting.

-- Michael Lutz
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

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

Post by fonso »

Michi_cc wrote: Indeterministic orders are conceptually impossible to support for a deterministic cargo routing algorithm. Cargo can only be routed when the destinations of a vehicle are known before loading the cargo, but conditional orders based on load percentage make that impossible (as it's not only about what would be loaded at the current station, but about what would be loaded at the next stations in the future).
That's true on the one hand. You cannot know where the vehicle is going. On the other hand, usually can make an educated guess and that's good enough most of the time. In cargodist I just evaluate the conditional orders when deciding about the next hop. It's not guaranteed that things like "needs service" or "age" are still the same when the condition is reevaluated for deciding about the next order, but those things change so slowly that the probabilty is high enough. I have implemented a special case for conditions about load percentage as that would be really undecidable. There I just pick the next hop for which the vehicle can load the most cargo in each loading cycle. So in the end this mimics a behaviour like "load for all possible next hops".

Of course this means that occasionally cargo is sent in the wrong direction but I haven't heard any complaints, yet.
The guy on the picture is not me, it's Alonso.
nuffsed
Engineer
Engineer
Posts: 6
Joined: 13 Dec 2009 15:05

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

Post by nuffsed »

Michi_cc wrote:
Lupin III wrote:
nuffsed wrote:I have noticed a small issue where I have n number of trucks going to 1 industry for a Load and out to different towns for unload. If I have a check after each unload to return to beginning if empty no cargo is being generated at the industry.
I have the same problem. And I think it will never work with this version of YACD. Consider this: pre-filling is disabled, so no cargo is generated until a truck did one full trip. But it can't do a full trip, because it will immediately turn around because it has no cargo... What I didn't try though and just came to mind: what happens if you have one truck to do the full trip without conditional orders and the rest with the "shortcut" orders? I fear the second fleet wont get loaded though.
Indeterministic orders are conceptually impossible to support for a deterministic cargo routing algorithm. Cargo can only be routed when the destinations of a vehicle are known before loading the cargo, but conditional orders based on load percentage make that impossible (as it's not only about what would be loaded at the current station, but about what would be loaded at the next stations in the future).
I assume that the following "side effect" is because of this aswell then.

A= load
B,C,D = unload

order looks like
1 A Full load any cargo
2 B
3 A Full load any cargo
4 C
5 A Full load any cargo
6 D

In this the trucks will only load for their next unload (ie if C is next unload then no mather how much B and D there is in the station it is waiting for C)


Feature request: It would be nice to able to see which transport in a station certain cargo is waiting for. If I for example have 100 passengers waiting in a station that is served both by boat and train it would be nice to see how many on each.
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

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

Post by FooBar »

nuffsed wrote:Feature request: It would be nice to able to see which transport in a station certain cargo is waiting for. If I for example have 100 passengers waiting in a station that is served both by boat and train it would be nice to see how many on each.
Select the "next hop" view. This will tell you which cargo is heading for (or via) the stations directly connected to this station. That doesn't help in case the boat and the train have the same destination (but how often does that happen?).
nuffsed
Engineer
Engineer
Posts: 6
Joined: 13 Dec 2009 15:05

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

Post by nuffsed »

FooBar wrote:(but how often does that happen?).
Always? ;) I usually try to have as few stations as possible (merging transport types and so on) and if I have for example a bussline that I am going to replace with train/air then I merge those two so that cargo dont have to change station.
User avatar
Lupin III
Engineer
Engineer
Posts: 66
Joined: 11 Jul 2007 16:36

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

Post by Lupin III »

FooBar wrote:(but how often does that happen?).
Actually i'm trying the same. Since there are so many passengers waiting with YACD enabled (all larger passenger stations have around 40% ratings :( ), I sometimes connect two cities - if they are close - with another slow, but high capacity line (only two stops) in parallel to the high speed main line. They use the same stations (but different plattforms) and both trains get filled in this case. Although I think I sometime have the "back and forth" problem with this setup. Passengers take the slow line to get to the other station, where they may or may not get picked up by a high speed train in the opposite direction.
TERdON
Engineer
Engineer
Posts: 90
Joined: 09 Nov 2010 15:30

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

Post by TERdON »

Michi_cc wrote: Indeterministic orders are conceptually impossible to support for a deterministic cargo routing algorithm. Cargo can only be routed when the destinations of a vehicle are known before loading the cargo, but conditional orders based on load percentage make that impossible (as it's not only about what would be loaded at the current station, but about what would be loaded at the next stations in the future).
Indeterministic orders are however not exactly the same ones as orders with conditional jumps in them. In my specific case, the conditional jump is just to stop a specific trip to happen if the vehicle is not yet loaded. The next "real" link will be the same. Same thing for the refit orders (which are actually completely deterministic...).

Btw, does yacd handle no loading/no unloading orders well? I have had some thought of possible solutions to that issue (as seen in the cargodist patch). If that problem is still unsolved, I might (given some time) have a nice contribution...
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

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

Post by Michi_cc »

TERdON wrote:Indeterministic orders are however not exactly the same ones as orders with conditional jumps in them. In my specific case, the conditional jump is just to stop a specific trip to happen if the vehicle is not yet loaded. The next "real" link will be the same. Same thing for the refit orders (which are actually completely deterministic...).
I didn't say that all conditional orders are automatically indeterministic. The thing that YACD 2.3 doesn't do is route pre-filling for refit and conditional orders. If the orders are at least somewhat deterministic, simply letting the vehicle travel the full order list a few times will result in proper route links. I do realise that this poses a problem if the conditional orders depend on loading cargo. Full load is also a problem, but you can just change the orders to non-full load for the first few runs.
TERdON wrote:Btw, does yacd handle no loading/no unloading orders well? I have had some thought of possible solutions to that issue (as seen in the cargodist patch). If that problem is still unsolved, I might (given some time) have a nice contribution...
No (un-)loading orders are fully supported.

-- Michael Lutz
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

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

Post by Michi_cc »

Doing some topic digging here.
Lupin III wrote:
Jim Starluck wrote:It might be better if industries periodically re-evaluate their targets, to take account of new industries being founded, shifting production and population, and the players' actions.
Yes, after playing a longer game with YACD, this is what should IMHO be enhanced first (I can live with the non loading/go empty bug, because they mostly occur after a train being newly built and I nanny them after that ;) ).

Some points:

* Industries shouldn't have to have at least one supplier <snip ...>
* The number of destinations should be dependent on production: <snip ...>
* Links could be more static. <snip ...>
I've snipped some stuff for brevity. Somehow your list (links more static, no change on new industry etc) is the exact opposite of "take account of new industries being founded, shifting production and population, and the players' actions". I'm confused to what you are actually agreeing here. Please note that the number of destinations is already dependant on production, even if the scaling divisor (economy.cargodest.cargo_scale_ind) is quite high right now as otherwise each link would have not enough cargo.
Lupin III wrote:Btw. I altered the parameters base_ind_links, base_town_links, city_town_links in the config file (increased them for testing) and started a game. I like the map but the many destinations makes it even harder. If I change the paramters back to default, load the game and reinitialize YACD (it seems to be possible by setting destinations to "original" and back to "fixed destinations" again; at least industries have different destinations after that), I still get the previous higher number of destinations, not the number I set in the config file. Any way to get this to a lower number without starting a completely new game?
Settings are stored in the save and thus editing openttd.cfg never changes settings in an existing game. The specific problem here is that those settings are list settings, which the set console command can't handle right now, so there's no way to change them after the fact.

-- Michael Lutz
User avatar
Lupin III
Engineer
Engineer
Posts: 66
Joined: 11 Jul 2007 16:36

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

Post by Lupin III »

Michi_cc wrote:I'm confused to what you are actually agreeing here.
This seems to have gotten across in the wrong way. I meant to say that production "shifts" and destination selection should be enhanced (before fixing bugs), but not in the way that Jim described (I don't like too much randomness or events that "break" a working route).
Michi_cc wrote:Settings are stored in the save and thus editing openttd.cfg never changes settings in an existing game. The specific problem here is that those settings are list settings, which the set console command can't handle right now, so there's no way to change them after the fact.
Yes, I found that out sometime after that. Bummer... but I started a new game eventually.
taeivon
Engineer
Engineer
Posts: 1
Joined: 23 Aug 2011 20:57

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

Post by taeivon »

Is there a readme file for YACD? I would like to know what each of the economy.cargodest. lines do in the openttd.cfg file, so I can tune them to my own games.
Thanks for any help you can offer!
User avatar
Lupin III
Engineer
Engineer
Posts: 66
Joined: 11 Jul 2007 16:36

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

Post by Lupin III »

taeivon wrote:Is there a readme file for YACD? I would like to know what each of the economy.cargodest. lines do in the openttd.cfg file, so I can tune them to my own games.
Thanks for any help you can offer!
I couldn't find one. I had to have a look at the source code. There's at least a little bit more description.
kotssmurf
Traffic Manager
Traffic Manager
Posts: 158
Joined: 27 May 2008 20:33

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

Post by kotssmurf »

Hi all!

I finally took the time to learn how to compile, after many (many many :-) ) failed attempts.
I used MinGW, applied the patch to the source and compiled.

However this is what I get when I try to start the newly compiled version:
'No available language packs (Invalid version?)'

Could it be I have the incorrect source files? What version should be used?

Many thanks!
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

the languages should be compiled at the same time. how did you compile and how do you try to start the game, and what did you do inbetween?
kotssmurf
Traffic Manager
Traffic Manager
Posts: 158
Joined: 27 May 2008 20:33

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

Post by kotssmurf »

Eddi wrote:the languages should be compiled at the same time. how did you compile and how do you try to start the game, and what did you do inbetween?
Well since I'm very new to the whole concept I will explain step by step.

Fristly I followed instructions exactly as noted on the wiki page here http://wiki.openttd.org/Compiling_on_MinGW
(I downloaded source using 'svn checkout svn://svn.openttd.org/trunk' in MSYS shell)

Then when I had a working version (tested) I applied the patch using following commands.

Code: Select all

svn update
patch -p1 -i yacd_v2_3_r22532.patch
And then compiled the game again. I try to open the game from ./trunk/bin/openttd which generated said error message.
MinGW is installed in default directory btw (C:\MinGW)

EDIT: While I was checking this post for spelling errors I noticed I forgot to use a version number for the SVN update command. :)
This can be disregarded and is fixed! Thanks anyway!
Auge
Chief Executive
Chief Executive
Posts: 661
Joined: 23 Oct 2006 02:07
Location: Berlin

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

Post by Auge »

kotssmurf wrote:... Fristly I followed instructions exactly as noted on the wiki page here http://wiki.openttd.org/Compiling_on_MinGW
(I downloaded source using 'svn checkout svn://svn.openttd.org/trunk' in MSYS shell)

Then when I had a working version (tested) I applied the patch ...

... And then compiled the game again. I try to open the game from ./trunk/bin/openttd which generated said error message. ...

EDIT: While I was checking this post for spelling errors I noticed I forgot to use a version number for the SVN update command. :)
Alternatively you can use a farm compiled binary for your OS or you can compile the source of YACD without patching the trunk. You'll find all the stuff on bundles.openttdcoop.org.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

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

Post by Zuu »

kotssmurf wrote:And then compiled the game again. I try to open the game from ./trunk/bin/openttd which generated said error message.
MinGW is installed in default directory btw (C:\MinGW)
Make sure that you stand in the ./trunk/bin directory when you execute openttd:

Code: Select all

cd trunk/bin
./openttd

Some self advertising: If you would use OpenTTD Auto Update to manage your OpenTTD installations, you would just add a new installation and choose "Last YACD" as release target and click "Update & Play" :-) (it would however rely on the YACD binaries provided by openttdcoop)
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Horse
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 10 Sep 2004 20:25

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

Post by Horse »

I have a little question about the way passengers choose their destination.
Is there a difference between the way towns and citties choose their destinations?
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

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

Post by FooBar »

Would anybody care to update YACD to current trunk? I like to be able to use it with recent FIRS, which requires r22780 or higher.

Already tried myself, but now my vehicles don't make a profit when delivering cargo :P Surely I must have done something wrong, but for first time patching and compiling OpenTTD I'm already happen that the self-compiled game actually starts without crashing.
Does anybody per chanse know if the delivery payment is handles by economy.cpp? I had some troubles patching that, so it wouldn't surprise me if that went wrong someplace.

Thanks.


EDIT: I have re-patched economy.cpp and vehicle profit seems to be working now. I'm sharing my patch and build in a separate unofficial topic, to avoid bugreports here that have nothing to do with YACD and all with a novice patcher.
Logital82
Engineer
Engineer
Posts: 58
Joined: 15 Feb 2010 12:03
Location: Germany, Berlin

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

Post by Logital82 »

Anybody here have a binary with 24h clock or better integrated in CPP?
That would be great! :bow:
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 7 guests