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 got two problems:

1. game crashes when all stations from vehicle's timetable are removed. here is the message:
*** OpenTTD Crash Report ***
Date: 2009-04-19 00:25:33
Build: r16058M (2) built on Apr 15 2009 21:57:11
Language: english.lng
Exception C0000005 at 0049439E
Registers:
EAX: 00000000 EBX: 00000000 ECX: 0012FB5C EDX: 019535D4
ESI: 00000000 EDI: 01978C20 EBP: 0012FB68 ESP: 0012FACC
EIP: 0049439E EFLAGS: 00010246

Bytes at CS:EIP:
8B 76 10 85 F6 75 03 8B 72 08 3B F3 74 38 8A 46 08 24 0F 3C 01 75 E9 0F

Stack trace:
01978C20 0012FBA0 01849B64 0040F32F 019535D4 01978C20 0012FBA0 00000000
01BE9D68 00000038 00000010 00C70000 0012F8F4 0012F8F8 00E1BFA0 00000000
7C9101E0 FFFFFFFF 7C9101DB 0059E16C 00C70000 00000000 00000030 01978C20
00000000 0012FB80 0012FB4C 0059E202 00000030 00000004 005A8640 DC7CCFB8
01849B64 00410C27 00000030 0040F2D6 0012FBAC 005C2947 00000000 0012FBB8
0040F957 01849B64 0012FB80 00694B2C 00000000 0183B1F8 00000200 00000003
0051CC55 00000008 0003E2DB 00D641A8 00000000 01A1C760 019DE9D0 0040F900
0012FFB0 005C296D 00000000 0012FC28 0044253C 7E37A78F 029A48D9 00000000
00000000 00000001 0003E36B 00000000 004A5A68 0003E3FB 004C1BCD 0003E3FB
00000007 00654E4C 004C3D03 004C3D0F 006136A8 0003E3FB 00654E4C 0003E35B
0003E35B 00000008 00000001 0000000F 0000000F 7E37A78F 029A48D9 0012FC54
004337FC 7E37A78F 029A48D9 0012FC54 00000000 0012FC54 00000000 00000000
00429FDD 7E37A837 0012FC64 00433A3D 00000000 0012FC4C 00000000 0053AF14
006BCC5C 0064ED94 0012FD14 00000000 0012FC68 029A48D9 029A48F7 00000000
00000000 006104CC 00000201 00000001 007E01BA 029A48B9 000001BA 00000091
00432F1C 0012FD2C 00000001 00000001 01000001 00000000 00000000 00000000
00000000 00D45B98 FFFFFFFF 00000000 00000000 00000104 00000000 FFFFFFFF
00000000 0012FF30 00000000 00000000 00000000 FFFFFFFF 0012FE34 0065CC00
00000000 00004B3A 0012FF30 0044DD9F 00000001 0012FE30 FFFFFFFE 00000000
5C3A4322 5C797248 6E65706F 5C647474 6474746F 72616320 69646F67 6F5C7473
746E6570 652E6474 20006578 00C70200 0000000D 00000004 00C70178 00C78140
00C70178 00000004 00C78128 00000000 00C70178 00C70178 00000002 00C70178
00C78138 00C70168 00000000 00000000 00C78138 00000020 00C78140 00000001
00C70178 00000020 00000220 00C70000 0012FBB4 00000040 0012FE7C 7C90E920

Module information:
C:\Hry\openttd\ottd cargodist\openttd.exe handle: 00400000 size: 2802176 crc: 4898D82F date: 2009-04-15 19:58:58
C:\WINDOWS\system32\ntdll.dll handle: 7C900000 size: 709632 crc: BAF97B9A date: 2009-02-09 10:56:06
C:\WINDOWS\system32\kernel32.dll handle: 7C800000 size: 988160 crc: 7F6413F3 date: 2009-03-21 14:09:02
C:\WINDOWS\system32\WINMM.dll handle: 76B30000 size: 174592 crc: 97C69A23 date: 2008-04-14 03:22:06
C:\WINDOWS\system32\ADVAPI32.dll handle: 77DC0000 size: 684032 crc: 27DFA0E8 date: 2009-02-09 10:56:06
C:\WINDOWS\system32\RPCRT4.dll handle: 77E70000 size: 584704 crc: E8278DD0 date: 2008-04-14 03:21:54
C:\WINDOWS\system32\Secur32.dll handle: 77FE0000 size: 56832 crc: 89138FBE date: 2009-02-03 19:58:42
C:\WINDOWS\system32\GDI32.dll handle: 77F10000 size: 286720 crc: 558CB163 date: 2008-10-23 12:42:52
C:\WINDOWS\system32\USER32.dll handle: 7E360000 size: 578560 crc: 810EA445 date: 2008-04-14 03:22:04
C:\WINDOWS\system32\WS2_32.dll handle: 71A90000 size: 82432 crc: 54E7139D date: 2008-04-14 03:22:06
C:\WINDOWS\system32\msvcrt.dll handle: 77C00000 size: 343040 crc: 82A18593 date: 2008-04-14 03:21:50
C:\WINDOWS\system32\WS2HELP.dll handle: 71A80000 size: 19968 crc: 16A4F56E date: 2008-04-14 03:22:06
C:\WINDOWS\system32\SHELL32.dll handle: 7C9C0000 size: 8465408 crc: 832DFB9B date: 2008-06-17 19:02:56
C:\WINDOWS\system32\SHLWAPI.dll handle: 77F60000 size: 474112 crc: A5A650CE date: 2008-04-14 03:21:56
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll handle: 773C0000 size: 1054208 crc: CE734765 date: 2008-04-14 03:07:06
C:\WINDOWS\system32\comctl32.dll handle: 5D5A0000 size: 617472 crc: EF37BB95 date: 2008-04-14 03:21:38
C:\WINDOWS\system32\SHFolder.dll handle: 76770000 size: 25088 crc: C487B370 date: 2008-04-14 03:21:56
C:\WINDOWS\system32\wdmaud.drv handle: 72CE0000 size: 23552 crc: D4EA0544 date: 2008-04-14 03:22:58
C:\WINDOWS\system32\WINTRUST.dll handle: 76C20000 size: 176640 crc: 6AB4DBF4 date: 2008-04-14 03:22:06
C:\WINDOWS\system32\CRYPT32.dll handle: 77A70000 size: 602112 crc: 8BA8D385 date: 2008-04-14 03:21:38
C:\WINDOWS\system32\MSASN1.dll handle: 77B10000 size: 57344 crc: EAFD178F date: 2008-04-14 03:21:48
C:\WINDOWS\system32\IMAGEHLP.dll handle: 76C80000 size: 144384 crc: 77B067D2 date: 2008-04-14 03:21:44
C:\WINDOWS\system32\msacm32.drv handle: 72CD0000 size: 20480 crc: D2823952 date: 2004-08-18 12:00:00
C:\WINDOWS\system32\MSACM32.dll handle: 77BD0000 size: 71680 crc: 0F11E98F date: 2008-04-14 03:21:46
C:\WINDOWS\system32\midimap.dll handle: 77BC0000 size: 18944 crc: 6C0FE179 date: 2008-04-14 03:21:46
C:\WINDOWS\system32\MSCTF.dll handle: 746F0000 size: 297984 crc: 7E4D8B79 date: 2008-04-14 03:21:48
C:\WINDOWS\system32\mswsock.dll handle: 71A30000 size: 247296 crc: AA868B0C date: 2008-06-20 17:49:26
C:\WINDOWS\system32\hnetcfg.dll handle: 698B0000 size: 345088 crc: 8D58532C date: 2008-04-14 03:21:42
C:\WINDOWS\System32\wshtcpip.dll handle: 71A70000 size: 19456 crc: 3807F96C date: 2008-04-14 03:22:06
C:\WINDOWS\system32\psapi.dll handle: 76BE0000 size: 23040 crc: E668331A date: 2008-04-14 03:21:54

System information:
Windows version 5.1 2600 Service Pack 3
2. map of connections is quite unreadable when connected stations are close to each other, as u can see on attached screeshot
Die Bahn, 10th Aug 1924.png
Die Bahn, 10th Aug 1924.png (67.64 KiB) Viewed 748 times
anyway, great job! i especially appreciate symmetric demand function for passengers and mail
jungle
Engineer
Engineer
Posts: 76
Joined: 17 Dec 2004 23:40
Location: UK

Re: Cargo Distribution

Post by jungle »

OK, I have a crash - this is right on starting a game, build first route, set off the first two trains and... crash.

My guess is that it's because I hit start on the first two trains (built at opposite ends of the route) on pause mode, and then let them go - being in identical layouts they would have arrived at opposite ends of the new route absolutely at the exact same moment, causing some confusion...

Savegame etc attached...
Attachments
crash_190409.sav
(399.93 KiB) Downloaded 83 times
crash_190409.txt
(7.41 KiB) Downloaded 79 times
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

I'll soon have a look at all the crash reports. But first I have another problem: My MCF solver builds path cycles. This is not good. And I have a mostly-finished station GUI for you. As soon as I'm done with those two items I'll release a new version and then I'll debug those crashes. Bear with me a little ...
The guy on the picture is not me, it's Alonso.
el koeno
Route Supervisor
Route Supervisor
Posts: 454
Joined: 24 Sep 2004 15:47

Re: Cargo Distribution

Post by el koeno »

I've been playing for a while, and here are my observations:
  • -I haven't had any large bugs or crashes 8)
  • -The map screen is pretty cool. The numbers are quite useless IMHO, but when I see a lot of red in the "icon" map, I know there's work to be done.
  • -Food seems to be routed to towns that are very close. It seems impossible to have a long range food network. Not sure why this is, but I thought I'd mention it.
reylas
Engineer
Engineer
Posts: 52
Joined: 22 Dec 2007 01:04

Re: Cargo Distribution

Post by reylas »

Ok. So now I am confused. Maybe it just is me and I am not doing this right, but the patch never created routes for me except for one route that I do not know how it appeared.

So for clarification, this patch only builds demand if *you* have a *vehicle/train* that goes from point A to point B correct? So if I have 4 locations A B C and D, and I have a train going from A to B, I will have demand created for the A->B route but the patch will never create demand from A -> C or A -> D (assuming C and D accepts that cargo) unless I first send a vehicle/train from A -> C or A -> D. Correct? If not, then my savegame never had any *new* demand created.

Either I am assuming wrong (great possiblity) or others are not understanding what this patch does. If I am wrong, then maybe I do not have a Bug, maybe the demand generator is trying to build demand between two routes and I am not responding by servicing them. Or, I do have a Bug that the routes are not dropping off like they should.

I think if I am right, people are expecting it to work like I wanted to believe it did, and that If you have a station at a coal mine, and you have a station at a power plant, the demand generator would *create* demand between those two. Then if you added another power plant, it would create cargo at the coal plant waiting to be taken to the new power plant *before* a train went between them. But I do not believe that is how it works.

Either way, I am having fun playing with this patch, I find myself tweaking the train schedules way more than I used to. .

Thanks for all the hard work.

Reylas
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

reylas wrote:So for clarification, this patch only builds demand if *you* have a *vehicle/train* that goes from point A to point B correct? So if I have 4 locations A B C and D, and I have a train going from A to B, I will have demand created for the A->B route but the patch will never create demand from A -> C or A -> D (assuming C and D accepts that cargo) unless I first send a vehicle/train from A -> C or A -> D. Correct? If not, then my savegame never had any *new* demand created.
That's right. Or in other words: cargo will only try to go to places where it can eventually arrive. I think this is a good thing. You don't want to have cargo for every possible destination on the map piling up at some bus stop in a remote village.
The guy on the picture is not me, it's Alonso.
reylas
Engineer
Engineer
Posts: 52
Joined: 22 Dec 2007 01:04

Re: Cargo Distribution

Post by reylas »

fonso wrote:That's right. Or in other words: cargo will only try to go to places where it can eventually arrive. I think this is a good thing. You don't want to have cargo for every possible destination on the map piling up at some bus stop in a remote village.
Ok, so let me ask this question. Say I have a coal mine (C1) that is serving a power plant (P1). Then I add another Coal Mine (C2) that is serving P1 as well. Then say I add another Power Plant (P2) to the network and C2 starts serving it with a train as well. So I have C1 -> train -> P1 <- train - C2 - train -> P2.

Will your patch see a route and *create* cargo for C1 -> P2. The reason I ask is this. Even though no train directly went from C1 -> P2, in that save game you will see cargo bound for P2 from C1 that is dropped of at P1, picked up by the train going to C2 and then fed to P2. I had no trains with a defined route that way.

If that is the case, great I like that. But if it is the case, then my bug (route would not die) is different since it wanted a direct route only instead of using trains going to a drop off point.

Thanks,
Reylas
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

reylas wrote: Ok, so let me ask this question. Say I have a coal mine (C1) that is serving a power plant (P1). Then I add another Coal Mine (C2) that is serving P1 as well. Then say I add another Power Plant (P2) to the network and C2 starts serving it with a train as well. So I have C1 -> train -> P1 <- train - C2 - train -> P2.

Will your patch see a route and *create* cargo for C1 -> P2. The reason I ask is this. Even though no train directly went from C1 -> P2, in that save game you will see cargo bound for P2 from C1 that is dropped of at P1, picked up by the train going to C2 and then fed to P2. I had no trains with a defined route that way.
Yes it will see there is a route from C1 to P2 via P1 and C2. There is no reason it shouldn't see it. If you didn't set explicit noload (or unload) orders at the power plants coal will be loaded at C1 by your first train, transferred at P1, picked up by the second train, transferred again at C2 and finally delivered to P2 by your third train. If you don't like that and want to specify the routes manually instead you should turn off cargo distribution for coal. You can also set explicit unload orders at stations to force delivery or transfer orders to force transfer. Those override the cargo distribution. Be aware that this might confuse the flow mapping and lead to results you didn't expect.
The guy on the picture is not me, it's Alonso.
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: Cargo Distribution

Post by cmoiromain »

Hi

Although I have not yet tested your patch, I have a little question about destination picking. Apparently the cargo is dispatched between the possible destinations allowed by your network. Could it be made, that before it is connected, any industry will have a destination picked randomly on the map? To each primary industry there would be one target industry associated at the map generation, so to have access to an industry's production you must at least transport it to its associated industry, and then some of its cargo will also be routed towards other destinations.
That would add some constraints to the game. ATM, you can chose where you want to bring the cargo, with this system it would look more like the subsidies system, where you only deliver stuff, you don't chose exacly where.
I am little, ugly, and nasty. How do you do?
reylas
Engineer
Engineer
Posts: 52
Joined: 22 Dec 2007 01:04

Re: Cargo Distribution

Post by reylas »

Yes it will see there is a route from C1 to P2 via P1 and C2. There is no reason it shouldn't see it. If you didn't set explicit noload (or unload) orders at the power plants coal will be loaded at C1 by your first train, transferred at P1, picked up by the second train, transferred again at C2 and finally delivered to P2 by your third train. If you don't like that and want to specify the routes manually instead you should turn off cargo distribution for coal. You can also set explicit unload orders at stations to force delivery or transfer orders to force transfer. Those override the cargo distribution. Be aware that this might confuse the flow mapping and lead to results you didn't expect.
No no. That is good, I like that. I guess my issue comes into play then in that save game. One of the routes I was trying to get to die but never would ( the bug save game I posted a while back) was like this.

I am using a Coal mines (C1) as a drop point for other Coal mines farther away (4 mines total) So I was building trains at those other 4 mines to drop coal (transfer and noload) at C1. Suddenly, one of my coals mines (I think the third one) wanted a direct route to the powerplant itself. It built 390 tonnes of coal destined for the power plant that used to be dropped off at C1 then taken to the same powerplant. So my issue is two fold. I could never get the route to die so the coal continued to build, and the patch would never see that I had a train going to C1 that would eventually get the Coal to the same power plant it was requesting.

So in the case of my earlier pathing question, it seemed to find a way to get the coal there on it's own which was great, but refused to see an easier path using C1 and allowed coal just to build there. Make sense?

I hope what I am trying to describe helps you out. If not, let me know and I will help anyway possible. The save game is the same that I uploaded.

Thanks,
Reylas
ftk
Engineer
Engineer
Posts: 9
Joined: 20 Mar 2009 16:07
Location: USA

Re: Cargo Distribution

Post by ftk »

Hi Fonso,
first of kudos to you for doing this patch. I have been playing with the latest for about 10 hours and have not run into any major bug, though I have only used it in a passenger only game. (Only thing I noticed is that the tool tip for "Real/Planned Cargo" in the station window always reads Real Cargo, no matter what is selected)

I am really looking forward to your station GUI overhaul. I am hoping to see an option to display totals of cargo going to a certain destination, no matter what the origin is, it would greatly simplify planning capacity on the routes. I like what you have done with the bar graphs on the mini map. Would you be able to go into a bit more detail of what all the different colors and dimensions of the rectangular bars mean? At times the plain numbers are a little more informative, though they get hard to read once there are too many stations close to each other (inner city bus routes, for example). May I suggest a list window in which you can see all currently active routes and their corresponding information?

Again, thanks for your efforts and I am looking forward to its further improvement.

Cheers
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

OK, there it is:
  • No more routing cycles. The MCF solver has two passes now. One with strictly increasing path lengths and one that only assigns additional flow to existing paths.
  • All demands are assigned now. The MCF solver is allowed to overplan links in the second pass now. This makes sure that cargo is actually routed according to the demands calculated before and not just to the place with the most convenient path.
  • Shiny Station GUI. With 6 grouping and 4 sorting options, destination estimation and an option to display the sent cargo instead of planned or waiting.
  • Cargo is properly rerouted if the link to its next hop disappears. Before it was sent "anywhere" and thus handled traditionally.
  • Link graph related source files get their own folder.
I'm only providing the all-in-one patch. You can pull the individual milestones from my git repository. I'll add a screenshot of the station GUI instead of the package. Tomorrow ...

good night.
The guy on the picture is not me, it's Alonso.
MJS
Director
Director
Posts: 540
Joined: 28 Jul 2005 09:31

Re: Cargo Distribution

Post by MJS »

Nice work! BTW, I won't be able to provide you with a savegame for the problem I posted before - didn't have any. I'll try to reproduce it, though.

One more question: does setting a train to 'no loading' work, now? There was a problem with that in the other (CargoDest) patch; a train would not only take no further passengers (as it should), it would also unload all current passengers (which it shouldn't).
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

MJS wrote:One more question: does setting a train to 'no loading' work, now? There was a problem with that in the other (CargoDest) patch; a train would not only take no further passengers (as it should), it would also unload all current passengers (which it shouldn't).
It should work as specified. That means no cargo will be loaded at the station. However, the link graph doesn't know about loading orders, so you will still get cargo wanting to use that link. If you don't provide any vehicles to load it, it will pile up. Generally using order modifications does work with cargo distribution but will confuse the flow mapping algorithm and you'll get cargo using unexpected routes or piling up somewhere. I suggest you only use them as temporary solutions for emergencies.
The guy on the picture is not me, it's Alonso.
MJS
Director
Director
Posts: 540
Joined: 28 Jul 2005 09:31

Re: Cargo Distribution

Post by MJS »

Thanks for the quick reply. I'll be careful with them. Yet they are supposed to help gameplay: what I want to do is build a link like the London-Watford Junction-Edinburgh trains, where you can travel from the first two stations to Edinburgh, but not between London and Watford; passengers between those stations should use local trains rather than crowd my expensive HSTs :-).
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

small fix posted: 2nd pass of MCF algo was using non-existant edges.
The guy on the picture is not me, it's Alonso.
as
Transport Coordinator
Transport Coordinator
Posts: 281
Joined: 07 Mar 2007 20:13

Re: Cargo Distribution

Post by as »

fonso wrote: The branches correspond to the milestones mentioned above. Master is a clone of the main openttd repository. So if you want the latest version of everything, do:

Code: Select all

git pull http://fickzoo.com/fonsinchen/openttd.git cd-gui
Of course, with git you can also pull the milestones one by one and examine each step independently. This might be nice if you're reviewing the code.

I'm not very familiar with git yet. If something is wrong please tell me.
I don't know much about git myself either, but when checking out the repo for the first time the command is git clone not git pull.

I'm not posting win binary yet, because version detection didn't work for some reason(norev000). Does anyone know if git revision detection works with MSVC builds or am I doing something wrong? I have only used svn and hg before and those work correctly
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Another small update
  • 1st pass of MCF solver is now allowed to overplan a path once if no demand has been routed between its source and destination yet. This makes sure every demand is at least partially met in the first pass. Before some demands couldn't be met which of course means the 2nd pass still cannot meet them and thus they remained completely unassigned.
  • 2nd pass actually looks at the correct flows for determining if there is already a path now. Before it could still build circles.
The guy on the picture is not me, it's Alonso.
el koeno
Route Supervisor
Route Supervisor
Posts: 454
Joined: 24 Sep 2004 15:47

Re: Cargo Distribution

Post by el koeno »

Hmm... I'm not into this whole compiling thing, tried to figure it out but got scared away :(. Anyway, if someone has compiled a working version, I'd be very happy if he/she posted it here.

In the meantime I will read some more on compiling. :) It seems there are many programs to use, I don't even know where to start.......
as
Transport Coordinator
Transport Coordinator
Posts: 281
Joined: 07 Mar 2007 20:13

Re: Cargo Distribution

Post by as »

me wrote: I'm not posting win binary yet, because version detection didn't work for some reason(norev000). Does anyone know if git revision detection works with MSVC builds or am I doing something wrong? I have only used svn and hg before and those work correctly
It was easy problem to solve, just had to add git dir to path, I wonder why installer didn't do it automatically.

So here's the win32 binary: EDIT: oops I uploaded wrong zip :oops:
EDIT part 2:
It wasn't just wrong zip. I was compiling the wrong checkout :oops: :oops:
It would have been nice if one you 5 people who dowloaded my build would have said something.

Now that I tried to compile the correct one I get this error:
c:\cargodist testi\iygiuyg\openttd\src\station_gui.cpp(1112) : error C2440: 'initializing' : cannot convert from 'std::_Tree<_Traits>::const_iterator' to 'std::_Tree<_Traits>::iterator'
with
[
_Traits=std::_Tset_traits<CargoDataEntry *,CargoSorter,std::allocator<CargoDataEntry *>,false>
]
No constructor could take the source type, or constructor overload resolution was ambiguous
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 19 guests