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

Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Cargo Distribution

Post by Wasila »

Thanks a lot fonso - your help is much appreciated. I hope some day you make it into trunk, as this patch deserves ;).

Wasila
noddster
Engineer
Engineer
Posts: 12
Joined: 30 Aug 2010 08:00

Re: Cargo Distribution

Post by noddster »

If i say "i stop the traffic" i mean i stop them dead in the tracks long way before they would reach the station...

The last game the error occured was a multiplayer game on a 2048x2048 map i designed myself.

In the attached "crashpak.rar" is the crash.dmp, crash.sav and crash.png.

The other file, "willcrashsoon.sav" was the regular autosave before the crash occured, you don't need to do anything ingame but wait a few weeks (6th August)

Regards
Attachments
crashpak.rar
(294.15 KiB) Downloaded 28 times
willcrashsoon.sav
(1006.29 KiB) Downloaded 31 times
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Thanks a lot. That's very helpful. You probably can't remember what you did with train 118 before that event, can you? It must have something to do with refitting those SBB standard coaches from first class to second class. Especially the third coach in that consist probably had been first class before and then somehow was refitted and got additional cargo during the journey from Wien to München. I'm wondering how you managed to add cargo to it without having it visit a station.
The guy on the picture is not me, it's Alonso.
noddster
Engineer
Engineer
Posts: 12
Joined: 30 Aug 2010 08:00

Re: Cargo Distribution

Post by noddster »

I did recognize that refetting full waggons to bigger waggons resulted in bigger waggons which were filled up as well.

e.g. I take a standard passenger coach (cap:40) and let the train upgrade to ÖBB CityShuttle Double Decker (cap:100). When a train with 100% usage of passenger space arrives at the depot is getting refitted additional 60 passengers were added instantaneously.

So a train with 400 cap and 400 usage becomes a 1000 cap train with 1000 passengers which materialized in the depot :)


EDIT:
I just reengaged the game and realized that you are right. In the exakt moment 118 arrives in München and wants to unload its cargo the game freezes.

I don't know how you programmed the CD logic into the game but it seems to me, that the problem is that the train arrives with additional passengers which weren't expected before the CD-logic could calculate and take the additional ingame passengers into account...

EDIT2:
I think i found the problem:

a.) for the crash: The overall usage of the train (freight overview / Frachtübersicht) is not being matched by the sum of the individual passengers per coach (after they materialized)
b.) for the beam-in passengers :) : I guess every individual coaches usage is not being measured in absolute but relative numbers. So if a coach with a capacity of 40 passengers and 100% usage is being replaced by a much larger wagon it does not take the absolute number of 40 passengers which were in the car at the time of the refit but 100%... and 100% of 40 != 100% of 80 :)
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Well, I found it. The attached little patch should do. Basically I give up on counting usage accurately in case of auto-replace with subsequent replace-induced auto-refit. usage isn't that important anyway. As I've promised, I'll build a windows binary with that patch applied when I get to my other computer; probably tonight.

The additional passengers don't get magically added. It's just the passengers from the other couches to the back of the train getting redistributed and ending up in the front coaches. As capacity is counted per vehicle and there is an automatic refit from first class to second class on adding the coaches this confuses the algorithm. Check the purchase window and you'll see the couches are advertised as carrying 60 passengers; however, that's only the first two. The others are refit to "second class" and then carry 86 passengers. The algorithm, however, is using the 60 passengers as refit_cap as it should do on auto-refit. If you refit a vehicle on the way from one station to another the minimum of original and new capacity is the actual end-to-end capacity. Fixing that corner case would produce a lot of needless code overhead and so I decided to just ignore the additional passengers.
Attachments
noddster.diff
ignore cargo counts higher than refit_cap
(1.04 KiB) Downloaded 49 times
The guy on the picture is not me, it's Alonso.
noddster
Engineer
Engineer
Posts: 12
Joined: 30 Aug 2010 08:00

Re: Cargo Distribution

Post by noddster »

thxal!

You learn something new every day :)

:bow:
praguzz
Engineer
Engineer
Posts: 39
Joined: 30 Sep 2012 12:26
Location: A Mountain town with no sun and no snow either

Re: Cargo Distribution

Post by praguzz »

Thanks for the patch, It makes the game more fun and challanging. But i encountered some nasty crash today, I don't do anything, just watching my vehicle running and suddenly it's stopped working.

Here's the crash log:

Code: Select all

*** OpenTTD Crash Report ***

Crash at: Sat Dec 29 13:35:25 2012
In game date: 1943-01-13 (44)

Crash reason:
 Exception: E1212012
 Location:  753E4B32
 Message:   Assertion failed at line 169 of ..\src\window.cpp: widget_index < this->nested_array_size

OpenTTD version:
 Version:    gbc6b29cd-cd (0)
 NewGRF ver: 130060c7
 Bits:       32
 Endian:     little
 Dedicated:  no
 Build date: Dec  1 2012 03:36:29

Registers:
 EAX: 0018F3D0 EBX: 00000016 ECX: 00000000 EDX: 00000000
 ESI: 00C6D09C EDI: 00000000 EBP: 0018F42C ESP: 0018F3D0
 EIP: 753E4B32 EFLAGS: 00200246

 Bytes at instruction pointer:
 8B 4C 24 54 33 CC E8 07 72 FF FF 8B E5 5D C2 10 00 8B 45 10 83 F8 0F 0F

Stack trace:
 E1212012 00000000 00000000 753E4B32 00000000 00000200 75EC6071 0000005A
 00000028 00080236 00000000 00CD3358 00C234D0 00000010 00000000 00000000
 00000000 00000000 00000000 77C60EF8 77C77830 304D51D3 00000016 0018F48C
 005EFEC5 E1212012 00000000 00000000 00000000 006C418C 00000016 A9D3072E
 0018F4A4 00000200 000000FF 75EC5FA6 00080236 00000000 77C60EF8 005EFEB5
 00000001 0018F44C 0018EE00 0018F83C 006C9710 A9087D12 FFFFFFFE 0018F6A4
 006C3755 00000016 0043DC7D 0458BEA0 0458BEA0 65737341 6F697472 6166206E
 64656C69 20746120 656E696C 39363120 20666F20 735C2E2E 775C6372 6F646E69
 70632E77 77203A70 65676469 6E695F74 20786564 6874203C 3E2D7369 7473656E
 615F6465 79617272 7A69735F 00000065 00000000 02635A38 75E68FC0 0018F5D4
 00010000 00020001 000000A0 0000001C 00000011 00000004 00000003 00000000
 00000000 00000004 00000003 00000000 00000000 00000008 00000004 00000006
 00000000 00000000 00000000 00000000 00000000 00000001 00000017 00000000
 00000000 0000001C 00000011 0000000D 0000000D 75E675DE 75E6A14B 00080236
 00000020 00080236 02010001 00000000 0000029E 00000000 00000001 00000020
 75E68F0F 02010001 00080236 00000000 02635A38 0018F5E4 7421284A 00000001
 00000084 7421247F 00000001 00000084 00000000 00080236 00000084 00000000
 00000020 0126BE80 000004B0 75E68FC0 00000000 00000001 00000001 00000000
 00000000 00000000 75E68FC0 30E5F424 0018F640 75E68FED 0126BE80 00000000
 00000020 00080236 02010001 00000000 0018F688 00466126 000000F2 000000CA
 02783430 00466126 000000F2 000000CA 02783220 00466126 000000F2 000000CA
 02783170 00466126 000000F2 000000CA 24DF0E50 004676FE 000000F2 000000CA
 24DF0E50 00466126 000000F2 000000CA 027836F0 0018F6DC 00469F15 00BB4BFC
 000000A9 00BFB258 00BFA69C 0046A685 000000F2 0458BEA0 000000CA FFFFFFFF

Operating system:
 Name:     Windows
 Release:  6.2.9200 ()
 Compiler: MSVC 1600

Configuration:
 Blitter:      32bpp-optimized
 Graphics set: OpenGFX (1004)
 Language:     G:\Games\OpenTTD Patched with Cargo Dist Newer\lang\english.lng
 Music driver: dmusic
 Music set:    OpenMSX (96)
 Network:      no
 Sound driver: win32
 Sound set:    OpenSFX (87)
 Video driver: win32

AI Configuration (local: 0):
  0: Human

Libraries:
 FreeType:   2.4.5
 ICU:        4.4.2
 LZMA:       5.0.3
 LZO:        2.05
 PNG:        1.5.4
 Zlib:       1.2.5

Module information:
 G:\Games\OpenTTD Patched with Cargo Dist Newer\openttd.exe handle: 00400000 size: 8860160 crc: 68B8F8CB date: 2012-11-30 20:40:28
 C:\Windows\SYSTEM32\ntdll.dll handle: 77C20000 size: 1409376 crc: A1500B60 date: 2012-09-20 06:26:47
 C:\Windows\SYSTEM32\KERNEL32.DLL handle: 75AE0000 size: 974848 crc: 7F2D52B3 date: 2012-07-26 02:19:21
 C:\Windows\SYSTEM32\KERNELBASE.dll handle: 753D0000 size: 665600 crc: AADAE5BA date: 2012-11-06 03:51:47
 C:\Windows\SYSTEM32\WINMM.dll handle: 74C70000 size: 125440 crc: D3B412A5 date: 2012-07-26 03:20:25
 C:\Windows\SYSTEM32\WS2_32.dll handle: 75680000 size: 310784 crc: 30CBD6AD date: 2012-07-26 03:20:38
 C:\Windows\SYSTEM32\USER32.dll handle: 75E60000 size: 1126912 crc: FF6E06C2 date: 2012-09-20 04:10:09
 C:\Windows\SYSTEM32\GDI32.dll handle: 752D0000 size: 1022464 crc: 7274D18B date: 2012-10-11 03:11:33
 C:\Windows\SYSTEM32\ADVAPI32.dll handle: 75DB0000 size: 702464 crc: 50CE016F date: 2012-07-26 03:17:49
 C:\Windows\SYSTEM32\SHELL32.dll handle: 76370000 size: 17560576 crc: BB115CEA date: 2012-11-06 04:20:00
 C:\Windows\SYSTEM32\WINMMBASE.dll handle: 749D0000 size: 157184 crc: 9D5A7BAE date: 2012-07-26 03:20:25
 C:\Windows\SYSTEM32\msvcrt.dll handle: 76130000 size: 709632 crc: 62B679CC date: 2012-07-26 03:19:17
 C:\Windows\SYSTEM32\RPCRT4.dll handle: 77780000 size: 694272 crc: 1654A288 date: 2012-07-26 00:10:46
 C:\Windows\SYSTEM32\NSI.dll handle: 77580000 size: 12800 crc: AD02B533 date: 2012-07-26 05:26:48
 C:\Windows\SYSTEM32\sechost.dll handle: 760F0000 size: 199168 crc: BB308757 date: 2012-07-26 03:19:53
 C:\Windows\SYSTEM32\combase.dll handle: 757F0000 size: 1247232 crc: C7F68DFC date: 2012-09-20 05:53:38
 C:\Windows\SYSTEM32\SHLWAPI.dll handle: 75640000 size: 246784 crc: 06B713EC date: 2012-07-26 03:19:59
 C:\Windows\SYSTEM32\SspiCli.dll handle: 752B0000 size: 98816 crc: E774C86E date: 2012-09-20 04:13:44
 C:\Windows\SYSTEM32\CRYPTBASE.dll handle: 752A0000 size: 21504 crc: F5EE1C62 date: 2012-07-26 03:18:09
 C:\Windows\SYSTEM32\bcryptPrimitives.dll handle: 75240000 size: 331952 crc: 9BDF533A date: 2012-07-26 05:26:46
 C:\Windows\system32\IMM32.DLL handle: 76270000 size: 121344 crc: FBBA68D2 date: 2012-07-26 02:27:28
 C:\Windows\SYSTEM32\MSCTF.dll handle: 77830000 size: 890880 crc: 6AA05AE3 date: 2012-11-13 04:19:23
 C:\Windows\SYSTEM32\SHFolder.dll handle: 6C700000 size: 7680 crc: C831C47F date: 2012-07-26 03:19:59
 C:\Windows\SYSTEM32\SHCORE.dll handle: 74950000 size: 460800 crc: 73EC9F0C date: 2012-10-11 05:07:27
 C:\Windows\system32\uxtheme.dll handle: 74210000 size: 534528 crc: 8DF0760B date: 2012-11-08 01:56:52
 C:\Windows\SYSTEM32\dwmapi.dll handle: 741B0000 size: 92160 crc: 4B4F1A4E date: 2012-07-26 03:18:23
 C:\Windows\system32\ole32.dll handle: 77590000 size: 1150160 crc: FD39004E date: 2012-11-06 04:48:27
 C:\Windows\system32\mswsock.dll handle: 74870000 size: 289280 crc: 744BCFCF date: 2012-10-11 05:06:45
 C:\Windows\SYSTEM32\MMDevAPI.DLL handle: 74160000 size: 307192 crc: 73E5A0E7 date: 2012-09-20 06:47:27
 C:\Windows\SYSTEM32\DEVOBJ.dll handle: 75AC0000 size: 120200 crc: 8CBE5668 date: 2012-07-26 03:38:10
 C:\Windows\SYSTEM32\cfgmgr32.dll handle: 76290000 size: 284456 crc: BA724786 date: 2012-07-26 03:38:10
 C:\Windows\SYSTEM32\wdmaud.drv handle: 6C6D0000 size: 172032 crc: 01BACC9A date: 2012-07-26 03:17:44
 C:\Windows\SYSTEM32\ksuser.dll handle: 6C6C0000 size: 14336 crc: 77C14FB4 date: 2012-07-26 03:34:26
 C:\Windows\SYSTEM32\AVRT.dll handle: 6E4E0000 size: 23656 crc: DD02BC02 date: 2012-09-20 06:13:32
 C:\Windows\SYSTEM32\AUDIOSES.DLL handle: 74100000 size: 324344 crc: 8666FA1C date: 2012-11-06 05:00:06
 C:\Windows\SYSTEM32\OLEAUT32.dll handle: 756D0000 size: 551936 crc: 75263BEB date: 2012-07-26 03:19:38
 C:\Windows\SYSTEM32\powrprof.dll handle: 740C0000 size: 244736 crc: 9B95BF78 date: 2012-07-26 03:19:43
 C:\Windows\SYSTEM32\msacm32.drv handle: 6C6B0000 size: 21504 crc: 62252195 date: 2012-07-26 03:17:44
 C:\Windows\SYSTEM32\MSACM32.dll handle: 6C690000 size: 71680 crc: F2999170 date: 2012-07-26 03:19:06
 C:\Windows\SYSTEM32\midimap.dll handle: 6C680000 size: 17920 crc: EAA387E1 date: 2012-07-26 03:19:00
 C:\Windows\SYSTEM32\clbcatq.dll handle: 761F0000 size: 454656 crc: 5B4E52BD date: 2012-07-26 03:18:05
 C:\Windows\System32\dmime.dll handle: 6C640000 size: 180736 crc: 8246CD99 date: 2012-07-26 03:18:20
 C:\Windows\System32\DSOUND.dll handle: 718A0000 size: 523776 crc: CF5BEBF2 date: 2012-07-26 03:18:22
 C:\Windows\System32\dmusic.dll handle: 6C620000 size: 95744 crc: 29DCF2B5 date: 2012-07-26 03:18:20
 C:\Windows\System32\dmsynth.dll handle: 6C600000 size: 107008 crc: 649EFACC date: 2012-07-26 03:18:20
 C:\Windows\System32\dmloader.dll handle: 6C5F0000 size: 36352 crc: 5C6B9A4F date: 2012-07-26 03:18:20
 C:\Windows\SYSTEM32\psapi.dll handle: 77440000 size: 7168 crc: B87626B8 date: 2012-07-26 03:19:46

---- gamelog start ----
Tick 0: new game started
     Revision text changed to gbc6b29cd-cd, savegame version 185, not modified, _openttd_newgrf_version = 0x130060c7
     New game mode: 1 landscape: 0
---- gamelog end ----

*** End of OpenTTD Crash Report ***

Decoded stack trace:
[00] KERNELBASE           0x753E4B32 RaiseException + 73
[01] openttd              0x005EFEC5
[02] openttd              0x006C3755
[03] openttd              0x00469F15
[04] openttd              0x0046CD39
[05] openttd              0x0046CF55
[06] openttd              0x005EE181

*** End of additional info ***
Attachments
crash.sav
Save Game
(817.59 KiB) Downloaded 30 times
crash.dmp
Dump File
(1.48 MiB) Downloaded 36 times
crash.png
(319.89 KiB) Downloaded 5 times
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

praguzz: This is http://bugs.openttd.org/task/5378 . It's been fixed in trunk. Make sure to only click clickable elements until the compile farm starts working again...
The guy on the picture is not me, it's Alonso.
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

So, as promised here is the fixed binary for windows. It has a slightly weird revision number and it doesn't support MIDI, but it fixes the bugs reported by noddster and praguzz. It's http://bundles.openttdcoop.org/cargodis ... 6b29cd-cd/ with http://www.tt-forums.net/download/file.php?id=166977 and http://vcs.openttd.org/svn/changeset?ne ... 4779%40%2F applied.
Attachments
bundle.7z
windows binary
(4.12 MiB) Downloaded 58 times
The guy on the picture is not me, it's Alonso.
noddster
Engineer
Engineer
Posts: 12
Joined: 30 Aug 2010 08:00

Re: Cargo Distribution

Post by noddster »

thx man!
noddster
Engineer
Engineer
Posts: 12
Joined: 30 Aug 2010 08:00

Re: Cargo Distribution

Post by noddster »

Quick question:

I do understand that & why savegames maybe can't be loaded because of a new revision.

Did i do something wrong if previously created scenarios (not savegames) can't be loaded as well?


On all scenarios i created with GBC6B29CD i get the wrong enviroment and the wrong startdate ( January 5000000 ) in the file description as well as an error message saying
Spielstandsdatei defekt - Invalid chunk size
Is there any possibility for me to get previously created scenario to the newly revised version of OTTD-CD?
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Scenarios are also savegames. The same rules apply to them, sorry. The best idea is to create scenarios using trunk. Then you can load them with any later cargodist. You should be able to play those scenarios from gbc6b29cd-cd with the fixed bundle I posted above, though.
The guy on the picture is not me, it's Alonso.
noddster
Engineer
Engineer
Posts: 12
Joined: 30 Aug 2010 08:00

Re: Cargo Distribution

Post by noddster »

figured as much and started over, no sweat...

as long as i can keep both games open simultaneously no harm is done ;)
dasy2k1
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 20 Sep 2006 23:43
Location: UK
Contact:

Re: Cargo Distribution

Post by dasy2k1 »

im currently struggling at the moment,

I have used cargodist for ages but since i last updated it to the current git version gaf4a24e8-cd im not actually getting any cargos to destinations

If i set a simple A-B-C-D-C-B-A bus route all pax generated are set to any destination. even after a few months.
I have checked the advanced settings and PAX are set to symetric.
If i enable the overlay I can see the lines of my routes but they all stay white rather than changing colour with demand

any ideas of what is up?
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

OK, this is easy. I just pushed that version a few hours ago and there's a typo in that thing. I messed up while working on Rubidium's suggestions. Update again; I've fixed it in the mean time.
The guy on the picture is not me, it's Alonso.
dasy2k1
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 20 Sep 2006 23:43
Location: UK
Contact:

Re: Cargo Distribution

Post by dasy2k1 »

sure


here it is

fair few grfs but they are all bannanasable


and another (test 2 with no newgrfs at all)
Attachments
Campbell & Co., 28-03-1837.png
(85.51 KiB) Downloaded 5 times
test.sav
(582.88 KiB) Downloaded 28 times
test 2.sav
(277.46 KiB) Downloaded 29 times
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

The revisions g65283639-cd and g428143bc-cd are totally broken. There's no need for further testing. Please avoid them. Thanks for the reports and sorry for the inconveniences.
The guy on the picture is not me, it's Alonso.
Creat
Traffic Manager
Traffic Manager
Posts: 141
Joined: 26 Oct 2009 16:33

Re: Cargo Distribution

Post by Creat »

Glad I saw that before starting a new game with my OpenTTD-CD compiled a few days ago (rev 4281...)

Thanks for the heads up :wink:
dasy2k1
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 20 Sep 2006 23:43
Location: UK
Contact:

Re: Cargo Distribution

Post by dasy2k1 »

All well and good now,

one suggestion I can make for playability, not sure if this is possible in code mind, but i would like a seperate distrubution type for cargos that are accepted by towns.

so at the moment you have

PAX
MAIL
Armooured
other.

The reason I would like this is i normally have other set to manual, (as i use ECS with stockpiling and its preatty useless when the industry you are delivering coal too cant take any more, but your mine only has coal destined for that industry)
but would love to have town accepted cargos such as goods and petrol set to Asymmetric keeping PAX and mail as Symetric as they currently are.
ZxBiohazardZx
Tycoon
Tycoon
Posts: 1534
Joined: 14 Mar 2006 12:46
Location: Netherlands

Re: Cargo Distribution

Post by ZxBiohazardZx »

dasy2k1 wrote:All well and good now,

one suggestion I can make for playability, not sure if this is possible in code mind, but i would like a seperate distrubution type for cargos that are accepted by towns.

so at the moment you have

PAX
MAIL
Armooured
other.

The reason I would like this is i normally have other set to manual, (as i use ECS with stockpiling and its preatty useless when the industry you are delivering coal too cant take any more, but your mine only has coal destined for that industry)
but would love to have town accepted cargos such as goods and petrol set to Asymmetric keeping PAX and mail as Symetric as they currently are.
in general, stockpiling + cargo dest == real challenge. i prefer playing with both though, even though station wont accept it due to stockpile limitations, the cargodest imo is still valid for it
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests