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

dasy2k1
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 20 Sep 2006 23:43
Location: UK
Contact:

Re: Cargo Distribution

Post by dasy2k1 »

yeh, my normal non cargodest orders for somthing like coal go somthing like

mine -- full load
glass works
conditional jump to 1 when empty
steel mill
conditional jump to 1 when empty
power station
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Version 026d234b (which will hopefully be compiled as g026d234b-cd soon) is somewhat experimental. I've changed a lot of the internals in order to comply with the suggestions that arose from the code review. However, I've done some testing, too, and I haven't found any problems. If you encounter any bugs please let me know by either posting here or opening issues at https://github.com/fonsinchen/openttd-cargodist/issues .
The guy on the picture is not me, it's Alonso.
zooks
Transport Coordinator
Transport Coordinator
Posts: 262
Joined: 29 Jun 2006 08:36

Re: Cargo Distribution

Post by zooks »

fonso wrote:Version 026d234b (which will hopefully be compiled as g026d234b-cd soon) is somewhat experimental. I've changed a lot of the internals in order to comply with the suggestions that arose from the code review. However, I've done some testing, too, and I haven't found any problems. If you encounter any bugs please let me know by either posting here or opening issues at https://github.com/fonsinchen/openttd-cargodist/issues .
IT crashed on my save game made with a previous cd.. but in my new game IT works so far. Not sure this is helpful:)
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Cargo Distribution

Post by Eddi »

it was never supposed to load old savegames
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

The compile farm's windows build failed and I've found a bug myself. The new version is postponed until I've fixed that.
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 »

OK, I've fixed it. The new version will be gb6087430-cd. I've also changed the station GUI to show cargo reserved for some vehicle as an extra line (so that the counts properly add up) and to not show so much useless information when cargodist is disabled.
The guy on the picture is not me, it's Alonso.
Suicyder
Engineer
Engineer
Posts: 7
Joined: 26 Dec 2012 15:02

Re: Cargo Distribution

Post by Suicyder »

I was running the latest version of cargodist on a server. But it keeps crashing.

I added a screenshot, the crash.log and the crash.dmp->
crash.zip
(147.21 KiB) Downloaded 26 times

Since I do not know what the issue is.

edit:
Here is the savegame as well ->
crash.sav
(3.81 MiB) Downloaded 27 times
Suicyder
Engineer
Engineer
Posts: 7
Joined: 26 Dec 2012 15:02

Re: Cargo Distribution

Post by Suicyder »

It shows I have the last post here.

There is a bugpost there actually, but I uploaded an savegame after posting, which most likely exceeded the maximum size for a file. Therefore I need a moderator to approve that post now.

Just posting this so you don't search for a 'hidden' post.
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: Cargo Distribution

Post by Hyronymus »

Suicyder wrote:It shows I have the last post here.

There is a bugpost there actually, but I uploaded an savegame after posting, which most likely exceeded the maximum size for a file. Therefore I need a moderator to approve that post now.

Just posting this so you don't search for a 'hidden' post.
Patience fixed it, again!
Suicyder
Engineer
Engineer
Posts: 7
Joined: 26 Dec 2012 15:02

Re: Cargo Distribution

Post by Suicyder »

I have been looking at the issue a little. It seems that the loading algorithm overloads a train and that crashes the game.
Arie-
Director
Director
Posts: 593
Joined: 20 Jan 2009 16:07

Re: Cargo Distribution

Post by Arie- »

I think I've seen this bug pass by on a Dutch tech board where a cargodist game had been played. I'll ask whether anyone has a save game over there.Bug was submitted a few posts above this one.
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Thanks for the report. I'll investigate that.
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 »

Suicyder: Can I get a savegame from before the crash, please? Unfortunately I can't open the crash.dmp as I don't have a 64bit Windows. Do you maybe have some hints on how to recreate the crash or did you find out any more details when looking at it? Obviously there must be some way to overload the vehicle (and that is real overload, measured with OnboardCount, not "reservation overload"). However so far I haven't found out how that can happen.
The guy on the picture is not me, it's Alonso.
Suicyder
Engineer
Engineer
Posts: 7
Joined: 26 Dec 2012 15:02

Re: Cargo Distribution

Post by Suicyder »

Unfortunately I do not have another savegame, at least not much longer before the crash. The server didn't autosave, I only found that out once the game crashed the first time. I brought over a savegame from my pc to the server and loaded it, I was capable of playing a couple of minutes everytime I tried to load it.

What did we do to get this crash:
We had a full PAX game, no industry at all. 378 trains. I had a bit of logic trains too. We had 3 people playing till then. 1024x2048 map and every player got a 512x512 sized plot. We all connected a series of cities in different ways. Mainly transfer stations where we brought them and picked them up, we didn't connect our plots yet.
Attachments
autosave12.sav
(3.8 MiB) Downloaded 26 times
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

OK, I've found it:

Code: Select all

diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp
index 0b60c99..e99a3d5 100644
--- a/src/cargopacket.cpp
+++ b/src/cargopacket.cpp
@@ -527,7 +527,7 @@ uint VehicleCargoList::Return(uint max_move, StationCargoList *dest, StationID n
  */
 uint VehicleCargoList::Shift(uint max_move, VehicleCargoList *dest)
 {
-       max_move = max(this->count, max_move);
+       max_move = min(this->count, max_move);
        this->PopCargo(CargoShift(this, dest, max_move));
        return max_move;
 }
Silly mistake ... better don't use g630a2d6d-cd and gb6087430-cd but wait for the next version instead. The compile farm should build it tonight. Thanks for your help, Suicyder.
The guy on the picture is not me, it's Alonso.
Suicyder
Engineer
Engineer
Posts: 7
Joined: 26 Dec 2012 15:02

Re: Cargo Distribution

Post by Suicyder »

Well glad it isn't some ridiculously rough bug to find.

Thanks for the fix, from all the dutch folks around the other forum :mrgreen:
TinyMusic
Tycoon
Tycoon
Posts: 1422
Joined: 02 Feb 2013 02:03

Re: Cargo Distribution

Post by TinyMusic »

Hi guys, I'm new to the forum but I have been playing Open TTD for a few months and last weekend I finally got this patch on. I was wondering how the patch picks which station the passenger goes to and how it calculates how many passengers go to each station.
Formerly known as UseYourIllusion.
Java Scenario Found Here - Version 2 out
[tweɪ̂ pû tɕʰì wɔ̀ mǐlɤ lû tɕʰìŋ nì pɑ́ŋmɑ̌ŋ]
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

The algorithm picks destinations for passengers based on the destination stations' distance and "size". The further away a destination station is the less passengers will want to travel there. The more passengers spawn at the destination the more passengers will want to travel there, too. You can influence that mechanism with the advanced settings.
The guy on the picture is not me, it's Alonso.
TinyMusic
Tycoon
Tycoon
Posts: 1422
Joined: 02 Feb 2013 02:03

Re: Cargo Distribution

Post by TinyMusic »

Is there an equation that works out how it picks it destination?
Formerly known as UseYourIllusion.
Java Scenario Found Here - Version 2 out
[tweɪ̂ pû tɕʰì wɔ̀ mǐlɤ lû tɕʰìŋ nì pɑ́ŋmɑ̌ŋ]
Arie-
Director
Director
Posts: 593
Joined: 20 Jan 2009 16:07

Re: Cargo Distribution

Post by Arie- »

Yes, you can find that algorithm in the source code.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 18 guests