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

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

Re: Cargo Distribution

Post by fonso »

I've posted a new version with all the improvements mentioned above in the first post.

I've also tried to debug tsjook's dump, but I've learned that this is impossible without the debugging symbols from the original build. Those debugging symbols are automatically generated when building the binary, but quite impossible to recreate afterwards. So if you post a binary please look for a file which ends on ".pdb". It would be very nice if you could post it together with the binary then. As no one has reported those crashes in more recent version although I didn't fix them I guess they are due to some bug in trunk which has been fixed by now. However, I didn't find any obvious hints in the revision history.
The guy on the picture is not me, it's Alonso.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Cargo Distribution

Post by 2007Alain2007 »

Hi fonso

hope you dont mind i made you a win32 build
Cargo Distribution R17719.7z
made useing TortoiseSVN and compiled on MSYS
Last edited by 2007Alain2007 on 06 Oct 2009 10:46, edited 1 time in total.
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

2007Alain2007 wrote:hope you dont mind i made you a win32 build
No, certainly not. I'm quite happy about that. Thank you. But you'd make my life easier if you stated how you've made it and, if it was made with Microsoft Tools (Visual C++), provided the debug symbols.
The guy on the picture is not me, it's Alonso.
id10terror
Engineer
Engineer
Posts: 56
Joined: 03 Jul 2009 02:16

Re: Cargo Distribution

Post by id10terror »

Could not compile current source(5188c1ff20dce3e2434b10de6ad1b9985b10a30f) in vc2008:

Code: Select all

error C3848: expression having type 'const PacketCompare' would lose some 
const-volatile qualifiers in order to call 'bool PacketCompare::operator ()
(const CargoPacket *,const CargoPacket *)'
.pdb from 502f4c583bafa9687a0eaac2f08aa814b93dcb96 attached
Attachments
openttd pdb.7z
7Zip Archive
(2.1 MiB) Downloaded 73 times
BuildLog.7z
7Zip Archive
(3.11 KiB) Downloaded 56 times
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

id10terror wrote:Could not compile current source(5188c1ff20dce3e2434b10de6ad1b9985b10a30f) in vc2008:
It seems I forgot a "const" and VC++ pays more attention than GCC. Try the attached patch on top.
id10terror wrote:.pdb from 502f4c583bafa9687a0eaac2f08aa814b93dcb96 attached
That's very nice, thanks. I'll have another try with that crash.
Attachments
const.diff
fix
(944 Bytes) Downloaded 68 times
id10terror
Engineer
Engineer
Posts: 56
Joined: 03 Jul 2009 02:16

Re: Cargo Distribution

Post by id10terror »

VC++ Compiles now but openttd crashes on execution

AppName: openttd.exe AppVer: 0.8.0.0 ModName: openttd.exe
ModVer: 0.8.0.0 Offset: 001bbed4

Faulting application openttd.exe, version 0.8.0.0, faulting module openttd.exe, version 0.8.0.0, fault address 0x001bbed4.

I know that this is pretty unhelpful but i'm still recompiling with debugging to see if its somthing simple

Halts at -> _DEBUG_ERROR("list iterators incompatible");
The program '[3180] openttd.exe: Native' has exited with code -1073740777 (0xc0000417).
I'm guessing that this has to do with the vc++ error handlers........ posting executible

the bsc file is somwhere near the size of the pdb file and was in the same output folder, is it necessary/helpful for debugging?
Last edited by id10terror on 10 Oct 2009 05:21, edited 3 times in total.
User avatar
tsjook
Traffic Manager
Traffic Manager
Posts: 197
Joined: 22 Apr 2009 18:33

Re: Cargo Distribution

Post by tsjook »

Could cargodist cause industries to close down because of supply problems, even if they are well supplied? Look at the last message and which industry it is about.. I am using FIRS so it might be a newgrf problem.

This game is from the r17641-precompiled-win32.
Attachments
incinerator closedown.sav
(228.5 KiB) Downloaded 54 times
zde-nek
Engineer
Engineer
Posts: 57
Joined: 15 Jun 2008 20:34
Location: Prague

Re: Cargo Distribution

Post by zde-nek »

thank you for new version. i just tried short game and effect of distance on demands 200% seems perfect for me
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

tsjook wrote:Could cargodist cause industries to close down because of supply problems, even if they are well supplied? Look at the last message and which industry it is about.. I am using FIRS so it might be a newgrf problem.
I don't think cargodist is the case here. At least I can't think of any way it might make the industry close down.
id10terror wrote:VC++ Compiles now but openttd crashes on execution
There have been some bugs in my multimap implementation. They're fixed in git and it doesn't crash anymore (for me, testing with VC++ Express 2008).
The guy on the picture is not me, it's Alonso.
id10terror
Engineer
Engineer
Posts: 56
Joined: 03 Jul 2009 02:16

Re: Cargo Distribution

Post by id10terror »

Cool Thanx heaps fonso :bow:

VC++ 2008 Express + DXSDK
Commit: 252e88d358e994a250573f8bbdc0a17b08a44163
Date: Fri Oct 9 13:12:09 2009 +0200

Is the bsc useful/necessary/irrelevent?
Attachments
OpenTTD CargoDist.7z
7Zip Archive
(2.52 MiB) Downloaded 133 times
OpenTTD CargoDist PDB.7z
7Zip Archive
(2.14 MiB) Downloaded 78 times
OpenTTD CargoDist BSC.7z
7Zip Archive
(3.4 MiB) Downloaded 84 times
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

id10terror wrote:Is the bsc useful/necessary/irrelevent?
I don't know what it is, but maybe it'll be useful for something. I didn't know about the problem with .pdb either before I ran into it. Thanks for posting the binary.
The guy on the picture is not me, it's Alonso.
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 710
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Cargo Distribution

Post by JacobD88 »

tsjook wrote:Could cargodist cause industries to close down because of supply problems, even if they are well supplied?
...
I am using FIRS so it might be a newgrf problem
I've had a similar problem with PBI and the Brick Chain, i would post a savegame but i've upgraded my cargo dist from an old revision to the one posted by id10terror on the 9th/10 and it's broke my save (which is kind of expected)

I think it may be a newgrf error, as others have mentioned, as other industry sets like ECS seem to work OK for me without hitting any of the supply-closure incidents that i've had with FIRS or PBI, as to what the problem is i cannot be sure but will post anything i find if it occurs again here

One thing that may be a cause, but i failed to check before i broke the save was to see if the industry closing had met the following criteria that may cause it to close (Maybe someone else can look for this if they get the problem too):

1) It had materials that it would accept, but were destined for elsewhere being dumped or waiting at its station, i suppose this could lead to closure as the industry may not be getting as much material as i thought

2) If the industry had material being lost to another, different, industry that was taking the material first; for example a power station next to a steel mill... Is the coal going to the power station first leaving the steel mill with nothing but iron and maybe just an occasional coal shipment???
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

JacobD88 wrote: 1) It had materials that it would accept, but were destined for elsewhere being dumped or waiting at its station, i suppose this could lead to closure as the industry may not be getting as much material as i thought
Those are indeed not delivered to the station and if supply is scarce the industry may close. You can see this if cargo is waiting at the destination station and if you get transfer credit (yellow) instead of cargo payment (green, red) for vehicles unloading there. Cargo is not delivered twice. If it's waiting in a station it wants to go somewhere else. But in tsjook's game all waste is taken to the same incinerator and delivered there, so this is not the case.
JacobD88 wrote: 2) If the industry had material being lost to another, different, industry that was taking the material first; for example a power station next to a steel mill... Is the coal going to the power station first leaving the steel mill with nothing but iron and maybe just an occasional coal shipment???
This is a general problem, but not related to cargodist. If you have two industries near a station with both accepting the same cargo only one of them actually receives it. You have to build seperate stations for each industry then. In tsjook's case there is only one industry accepting waste at the station in question, so this isn't the problem either.
The guy on the picture is not me, it's Alonso.
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

id10terror wrote:.pdb from 502f4c583bafa9687a0eaac2f08aa814b93dcb96 attached
Unfortunately that's not the .pdb from the build in question. The build was r17268 so it should probably be git revision 3e3b93ef309f99e1cf006fe3c838d0dcc4725426
The guy on the picture is not me, it's Alonso.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Cargo Distribution

Post by Kogut »

I started bus company using cargo distribution. But everything is looks like this: bus pickup everything, and consume everything on the next station.

Example:
There are stations A, B, C.

A----B------C

There are busses
(1) from A to B (bare goto)
(2) from B to C (bare goto)

Passengers from city B to both cities are waiting on station.
Bus from group (2) arrives. And pickup ALL people which are waiting on station. Even people traveling to station A.
What I did wrong?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
tsjook
Traffic Manager
Traffic Manager
Posts: 197
Joined: 22 Apr 2009 18:33

Re: Cargo Distribution

Post by tsjook »

Do you use non-stop orders? If not, you should start using them and it will solve your problem. You can actually enable non-stop orders as a default setting in the Advanced Settings.
id10terror
Engineer
Engineer
Posts: 56
Joined: 03 Jul 2009 02:16

Re: Cargo Distribution

Post by id10terror »

Debug info for old version of cargodist
Pdb from VC2008 Express + DXSdk (win32)
commit: 3e3b93ef309f99e1cf006fe3c838d0dcc4725426
Merge: 6c06657... ee99e9a... 999f779...
Date: Sun Aug 23 13:12:43 2009 +0200

The binary is capable of loading tsjook's Crash r17268-prebuilt-Win32.rar (Sat Oct 03, 2009 4:57 am)
When loaded the game displays a message(probably due to me missing some of the newgrfs):
"Train 'Train 19' belonging to 'Ecosse Transport'
has invalid length. It is probably caused by problems
with NEWGrf's. Game may desync or crash."

Game seems to work after unpause. Er, hit the fastforward button and watch the profit sink.
Attachments
OpenTTD CargoDist PDB.7z
7Zip Archive
(2.07 MiB) Downloaded 70 times
Old Version Binary CargoDist.7z
7Zip Archive
(2.48 MiB) Downloaded 64 times
el koeno
Route Supervisor
Route Supervisor
Posts: 454
Joined: 24 Sep 2004 15:47

Re: Cargo Distribution

Post by el koeno »

fonso wrote:
JacobD88 wrote: 2) If the industry had material being lost to another, different, industry that was taking the material first; for example a power station next to a steel mill... Is the coal going to the power station first leaving the steel mill with nothing but iron and maybe just an occasional coal shipment???
This is a general problem, but not related to cargodist. If you have two industries near a station with both accepting the same cargo only one of them actually receives it. You have to build seperate stations for each industry then. In tsjook's case there is only one industry accepting waste at the station in question, so this isn't the problem either.
So cargo is delivered to the station, not the industry? I was just thinking how cool it would be if the supply status of an industry, and how well it's products are transported, could influence the distribution of cargo. So if a food processing plant is located next to its markets (towns) it will get more fruit etc. Of course if it's far from its suppliers (fruit plantations), it will get less, leading to an equilibrium somewhere in between. That would you'd have to sort of manage entire chains. But perhaps that's impossible if the industries themselves are not considered in cargo allocation, but only the stations.
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

As the cargolist cleanup branch has indeed been merged into trunk (thanks Rubidium :bow:), I'll keep my promise and get the second stage of cargolist performance optimization ready for trunk. It will come in three parts:
  • First we need the ability to load and save std::set. This is basically ready, but I'll write some more comments. It's in the branch slset
  • Second the vehicle cargo list is split off from the station cargo list via templates and given a std::set instead of a std::list as base. This is the main part of the optimization. I have already identified and moved all the code involved, but I guess it could use some more cleanup and documentation. You can watch this in the new branch cargoset
  • Third will be the separate reservation lists for vehicles. I haven't started isolating this one, yet. It's still in the cargomap, together with various other things.
The guy on the picture is not me, it's Alonso.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Cargo Distribution

Post by petert »

I don't understand, what has been included into trunk?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 8 guests