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 »

Wasila wrote:split into three parts? Elaborate pls.
It doesn't matter if you either use the patch in the first post or pull from the default branch of my git repository. Instead of one branch for smallmap-zoom there are three now:
1. smallmap-zoom-out
2. zoomlevels
3. smallmap-zoom-in

I'm hoping to get 1 and 2 included in trunk in finite time. 3 seemingly doesn't stand a chance.
The guy on the picture is not me, it's Alonso.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Cargo Distribution

Post by Wasila »

Why does 3 not stand a chance?
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Wasila wrote:Why does 3 not stand a chance?
The devs don't like it. And I have to admit, without cargodist's stats view there isn't much use for it. So maybe in the far future when someone considers merging cargodist into trunk it will stand a chance, but until then, I won't push it.
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 »

Hi Fonso, thanks heaps for all your hard work on the cargodist project, now i'd like to try and give somthing back.

Full Patch Against 17081

The first is normal patch against source, anything that was rejected was hand corrected. The Second fixes changes to string names in english.txt. Was going to change:'STR_TOOLTIP_SORT_CRITERIAP' to 'STR_TOOLTIP_SORT_CRITERIA' but backed out when i realised that it would effect other languages.
I'm not sure if you have to apply them incrementially or independtly(but i'm pretty sure theyre independent), they were made with tortisesvn.

<edit>Added linkgraph stuff i forgot</edit>

Have tried to create smaller incremential update but was unable to combine trunk to cargodist(i'm pretty sure i'm doing somthing moronic). Whats the general overview for that sort of thing, is it:

Code: Select all

chdir 'copy of cargodist'
git svn fetch
git svn rebase
Attachments
cargodist_r17081.patch
Not this one! - See Notes
(189.69 KiB) Downloaded 81 times
cargodist_r17081 B.patch
This One!
(189.77 KiB) Downloaded 93 times
src.7z
Stuff i forgot to add to the patches
(linkgraph stuff)
(9.99 KiB) Downloaded 83 times
Last edited by id10terror on 08 Aug 2009 04:55, edited 1 time in total.
User avatar
JamieLei
Tycoon
Tycoon
Posts: 7432
Joined: 10 Jan 2007 18:42
Location: Stratford, London

Re: Cargo Distribution

Post by JamieLei »

Ah thanks Fonso - I'll be testing it out on multiplayer again when I have the chance, although I'm away for the next 6 days at the TT-forums meet and various other places!

Small suggestion (and sorry if it's already implemented, I haven't been reading all the posts), would you be able to add an option to just display the routes on the minimap without any additional information about the balance in relation to each route?) - sometimes it's nice to see a quick diagram of the network at a glance and atm it's rather cluttered :(
Any opinions expressed are purely mine and not that of any employer, past or present.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Cargo Distribution

Post by Wasila »

I repatched my cargodist game with the same version - just changing that line you gave me to change the infinite loop. I continued playing for a number of years, including a ten year skip from 1925 to 1935. However, the same problem has come back to me. On 5th August 1937, the game freezes. The only major change I've had since then is that I've recently started up two new AIs (ChooChoo and TransAI), however I don't believe that these can freeze the game. Is there another loop somewhere?

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

Re: Cargo Distribution

Post by fonso »

Wasila wrote:I repatched my cargodist game with the same version - just changing that line you gave me to change the infinite loop. I continued playing for a number of years, including a ten year skip from 1925 to 1935. However, the same problem has come back to me. On 5th August 1937, the game freezes. The only major change I've had since then is that I've recently started up two new AIs (ChooChoo and TransAI), however I don't believe that these can freeze the game. Is there another loop somewhere?
There is an AI that selects all of the map in an array at some point, but I don't know which one anymore. On large maps this takes several minutes on my computer, but is still considered a single action by the AI framework. However, it could as well be that there is another infinite loop. Please do post a savegame!
The guy on the picture is not me, it's Alonso.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Cargo Distribution

Post by Wasila »

I tested the game again, each time with one of the two new AIs removed. TransAI did appear to do something on the 5th, however even without it I had problems. If you would be willing to run my custom-built game, here is the link to the download:

http://www.tt-forums.net/viewtopic.php?f=29&t=44238

And here are the newGRFs:

2cc Trainset
Metro Tracks
Transrapid Trainset
eGRVTS
Hover Bus
Aviators Aircraft Set
Stolen Trees
City Stations
Suburban Stations
Rural Stations
Industrial Stations Renewal
Old Bridge
Total Town Replacement Set
Burj Al Arab
NewShips

The game itself is available at http://tinyurl.com/kmjg7p (diverts to mediafire.com).

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

Re: Cargo Distribution

Post by fonso »

Wasila wrote:I tested the game again, each time with one of the two new AIs removed. TransAI did appear to do something on the 5th, however even without it I had problems. If you would be willing to run my custom-built game, here is the link to the download:

http://www.tt-forums.net/viewtopic.php?f=29&t=44238

The game itself is available at http://tinyurl.com/kmjg7p (diverts to mediafire.com).

Thanks.
So, there is two things to note:
1. You are running a patch pack. You could have told me that. Furthermore there is no source for your patch pack. I need the source code to debug things. A patch against some version of trunk or cargodist will do, too.
2. You are playing a very large map. Could it be you have the same problem as Beday on page 25? May I suggest you try the resolution I posted on page 27?
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 »

Updated full patch to 17097

Binary also attached

Would like to make smaller incremental diffs<((cargodist vs newtrunk) - oldcargodist>
but i have no idea(well my previous idea's have failed miserably) any advice?
Attachments
cargodist_r17097.patch
Full patch against 17097
including linkgraph stuff this time
(232.71 KiB) Downloaded 102 times
OpenTTD Cargodist 17097 Bin.7z
Binary of above
(2.51 MiB) Downloaded 163 times
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4766
Joined: 09 Sep 2007 05:03
Location: home

Re: Cargo Distribution

Post by Alberth »

id10terror wrote:Would like to make smaller incremental diffs<((cargodist vs newtrunk) - oldcargodist>
but i have no idea(well my previous idea's have failed miserably) any advice?
Mercurial supports patch queues, mybe that can solve your problem?
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Cargo Distribution

Post by Wasila »

This is the same patchpack that I posted about a few pages ago. The game does not freeze on the first of the month, and it haven't seen it unfreeze yet either. Source code is here: http://tinyurl.com/kmjg7p
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Wasila wrote:I tested the game again, each time with one of the two new AIs removed. TransAI did appear to do something on the 5th, however even without it I had problems. If you would be willing to run my custom-built game, here is the link to the download:
What problems are those? The hang on August 5th is just as I guessed, an AI selecting a large portion of the map in an array. Perhaps I should post a bug report about that:

Code: Select all

(gdb) info thread
  2 Thread 0x424c4950 (LWP 12906)  0x00007f33b6aeeb66 in poll () from /lib/libc.so.6
* 1 Thread 0x7f33b963f6f0 (LWP 12903)  0x0000000000489d35 in std::_Identity<int>::operator() (this=0x26af44c0, __x=@0x7fffc165c064) at /usr/include/c++/4.3/bits/stl_function.h:470
(gdb) bt
#0  0x0000000000489d35 in std::_Identity<int>::operator() (this=0x26af44c0, __x=@0x7fffc165c064) at /usr/include/c++/4.3/bits/stl_function.h:470
#1  0x000000000048d0f3 in std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_insert_unique (this=0x2af5528, __v=@0x7fffc165c064) at /usr/include/c++/4.3/[...]
#2  0x000000000048d2e7 in std::set<int, std::less<int>, std::allocator<int> >::insert (this=0x2af5528, __x=@0x7fffc165c064) at /usr/include/c++/4.3/bits/stl_set.h:381
#3  0x0000000000487c2c in AIAbstractList::AddItem (this=0x2af5470, item=9170950) at /home/alve/projekte/wasila/src/ai/api/ai_abstractlist.cpp:402
#4  0x00000000004aa118 in AITileList::AddRectangle (this=0x2af5470, t1=8193, t2=33546238) at /home/alve/projekte/wasila/src/ai/api/ai_tilelist.cpp:38
#5  0x0000000000463e38 in SQConvert::HelperT<void (AITileList::*)(unsigned int, unsigned int), true>::SQCall (instance=0x2af5470, func=0x4aa074 <AITileList::AddRectangle(unsigned int, [...]
    at /home/alve/projekte/wasila/src/ai/../script/squirrel_helper.hpp:323
#6  0x000000000047b30a in SQConvert::DefSQNonStaticCallback<AITileList, void (AITileList::*)(unsigned int, unsigned int)> (vm=0x2324000) at /home/alve/projekte/wasila/src/ai/../script/[...]
#7  0x0000000000432bd4 in SQVM::CallNative (this=0x2324000, nclosure=0x24475e0, nargs=3, stackbase=11, retval=@0x7fffc165c4b0, suspend=@0x7fffc165c4af) at /home/alve/projekte/[...]
#8  0x000000000043507d in SQVM::Execute (this=0x2324000, closure=@0xaf42e0, target=9, nargs=-1, stackbase=-1, outres=@0x7fffc165c650, raiseerror=1, et=ET_RESUME_OPENTTD) at [...]
#9  0x0000000000407da5 in sq_resumecatch (v=0x2324000, suspend=10000) at /home/alve/projekte/wasila/src/3rdparty/squirrel/squirrel/sqapi.cpp:1010
#10 0x000000000063441d in Squirrel::Resume (this=0x2313af0, suspend=10000) at /home/alve/projekte/wasila/src/script/squirrel.cpp:179
#11 0x0000000000449e47 in AIInstance::GameLoop (this=0x231cd80) at /home/alve/projekte/wasila/src/ai/ai_instance.cpp:334
#12 0x0000000000440198 in AI::GameLoop () at /home/alve/projekte/wasila/src/ai/ai_core.cpp:69
#13 0x00000000005c9c5a in StateGameLoop () at /home/alve/projekte/wasila/src/openttd.cpp:1165
#14 0x00000000005cafa1 in GameLoop () at /home/alve/projekte/wasila/src/openttd.cpp:1244
#15 0x00000000006c8337 in VideoDriver_SDL::MainLoop (this=0x1955f60) at /home/alve/projekte/wasila/src/video/sdl_v.cpp:501
#16 0x00000000005cbcdf in ttd_main (argc=1, argv=0x7fffc165cd08) at /home/alve/projekte/wasila/src/openttd.cpp:715
#17 0x00000000006b29d6 in main (argc=1, argv=0x7fffc165cd08) at /home/alve/projekte/wasila/src/unix.cpp:251
(gdb)
note "AITileList::AddRectangle" and the numbers. It seems that it selects about all of the map except for the first row - about 32 million tiles; that does take a looong time. After killing off all AIs from the in-game console with "stop_ai <n>" I don't see any obvious problems with this game anymore.
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 »

JamieLei wrote:Ah thanks Fonso - I'll be testing it out on multiplayer again when I have the chance, although I'm away for the next 6 days at the TT-forums meet and various other places!

Small suggestion (and sorry if it's already implemented, I haven't been reading all the posts), would you be able to add an option to just display the routes on the minimap without any additional information about the balance in relation to each route?) - sometimes it's nice to see a quick diagram of the network at a glance and atm it's rather cluttered :(
This is already implemented: Open the smallmap and disable everything in the last column of the legend.
The guy on the picture is not me, it's Alonso.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Cargo Distribution

Post by Wasila »

Strange... I did kill of all the new AIs. Do you know which AI it is? Thanks.
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Wasila wrote:Strange... I did kill of all the new AIs. Do you know which AI it is? Thanks.
It's TransAI and it actually happens even earlier - on July 28th, but it probably doesn't matter. I guess the AI framework shouldn't allow an AI to block the game for such a long time. Now what exactly is the problem you experience after killing the AIs and when does it happen? Can I get another savegame of that?

Edit: Actually the newest version of TransAI crashes at that point instead of hanging the game.
Last edited by fonso on 08 Aug 2009 17:46, edited 1 time in total.
The guy on the picture is not me, it's Alonso.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Cargo Distribution

Post by Yexo »

fonso wrote:I guess the AI framework shouldn't allow an AI to block the game for such a long time.
It's a known problem, but we can't suspend AIs at every time.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Cargo Distribution

Post by Wasila »

I killed the AI on the 27th, although the exact same thing happened. Easily replicated, just 'stop_ai 7'.

EDIT: I killed all the AIs immediately but nothing has changed. The game froze on the 5th anyway. Do you not get the same problem?

Below is a savegame with no AIs, right at the beginning of the 5th (obviously I can't get a savegame after it's frozen...)

http://tinyurl.com/kmjg7p

Another EDIT: I repatched the same sourcecode with two new patches - Chunnels and 'Signals at Tunnels and Bridges'. Strangely enough, it works now, even with TransAI.
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Cargo Distribution

Post by fonso »

Wasila wrote:I killed the AI on the 27th, although the exact same thing happened. Easily replicated, just 'stop_ai 7'.

EDIT: I killed all the AIs immediately but nothing has changed. The game froze on the 5th anyway. Do you not get the same problem?

Below is a savegame with no AIs, right at the beginning of the 5th (obviously I can't get a savegame after it's frozen...)

http://tinyurl.com/kmjg7p
I can't reproduce the problem on Windows/MinGW. Did you compile it with Visual Studio or with MinGW (or BuildOTTD) or where did you get the binary from? I'd really like to find out about that problem. No matter if it works with a different binary ...
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 »

Beday wrote: Unfortunately I do not have a save before crash (anymore) I played further with an older autosave. Nevertheless in the same game many year's later there is a fatal error. OpenTTD shuts down around the 14-20th of the loaded game month whatever (auto)save game I load. I post a the game were this first happened. Maybe again it has nothing to do with CargoDist or is it already solved, butt after stopping all vehicles and/or altering CargoDist settings (Link graph) I am only able to get 2 or 3 more days.

Thanks in advance and I'm starting to think that you like crashed savegames :P

http://www.megaupload.com/?d=VGNE25TF
Of course I like bad save games as those allow me to find bugs. However, this one doesn't crash for me. After loading it takes a few minutes to calculate the pending linkgraph job before it really starts, but we already discussed that one. Can you give me more precise instructions on what to do with it to make it crash? Also what kind of binary is that? How did you compile it or where did you get it?
The guy on the picture is not me, it's Alonso.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 6 guests