Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Dec 10, 2018 9:56 am

All times are UTC




Post new topic  Reply to topic  [ 279 posts ]  Go to page Previous 110 11 12 13 14 Next
Author Message
 Post subject: Re: AIAI
PostPosted: Wed Jul 17, 2013 4:23 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
This one seems to be case of "unexpectedly invalid vehicle_id, right after passing IsValidVehicle check" - result of using autorenew and autoreplace (viewtopic.php?f=65&t=66959). I need to write my own replacements and it should fix this type of bug.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
 Post subject: Re: AIAI
PostPosted: Thu Jul 18, 2013 12:07 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Feb 15, 2003 5:32 pm
Posts: 1139
Location: Paris, France
Hello Kogut,

I found a small "bug".

It's not a real bug, at it doesn't change the AI behaviour not it's performances, but it changes the nice looking of the roads.
And in some situations, it should result in a routing probleme for drive vehicles.

Normally, your AI will create truck station using a pass-througt station on a roundabout road layout :
Attachment:
station_ok.png
station_ok.png [ 27.7 KiB | Viewed 4718 times ]


But in my case, the AI built this :
Attachment:
station_ko.png
station_ko.png [ 17.62 KiB | Viewed 4718 times ]


It will work, but the bridge changes the road layout, so the pass-throught station isn't pass-throught anymore.

Bad looking, but not a real problem for the route, as the trucks still can find a way.


Top
   
 Post subject: Re: AIAI
PostPosted: Thu Jul 18, 2013 1:35 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
This is not a bug (it works as intended) but better looking for a place is a good idea and I created ticket for this feature request (https://github.com/Bulwersator/AIAI/issues/38). Note that it may wait quite a long time, some of my ideas are waiting entire years for a coding time.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
 Post subject: Re: AIAI
PostPosted: Thu Jul 18, 2013 6:49 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Feb 15, 2003 5:32 pm
Posts: 1139
Location: Paris, France
Kogut wrote:
Note that it may wait quite a long time, some of my ideas are waiting entire years for a coding time.

It's not a problem : as you said, it's not a bug, the AI just works fine with this issue, nothing is hasting (hastening ? hmmm "presser" in french :D).


Top
   
 Post subject: Re: AIAI
PostPosted: Thu Jul 18, 2013 7:35 pm 
Offline
Engineer
Engineer

Joined: Tue Feb 23, 2010 3:44 pm
Posts: 103
Hi Kogut :-)

I think I can help you with this:

Kogut wrote:
Wormnest wrote:
AIAI v 89 crashes with Count does not exist.

Thanks for report - I thought that it is fixed. Can you post savegame? I have no idea what happens here, it seems to be case of weird NewGrf or my misinterpretation of API documentation. And with savegame I may check what is happening with industry number 2065.



I could reproduce the bug today:
AIAIv94, OpenTTD 1.3.1

Attachment:
AIAICountBug.png [43.75 KiB]
Downloaded 8 times


And it's as you maybe expected, an industry just had closed when the AI(AI) wanted to get information about it.

Here's the code snippet of crashing function:

Code:
function Builder::ValuateConsumer(industry_id, cargo, score)
{
//check: Industry still valid
   if(!AIIndustry.IsValidIndustry(industry_id)) {
      return -1;
   }
//some code...
   local industry_name = AIIndustry.GetName(industry_id);
   if(AIIndustry.GetStockpiledCargo(industry_id, cargo)==0) {
      score *= 2;
   }
   if(IsConnectedIndustry(industry_id, cargo)) {
      score *= 7;
   }
//industry invalid, industry_type_id=64 (invalid?)
   local industry_type_id = AIIndustry.GetIndustryType(industry_id);
//industry_type_name= NULL
   local industry_type_name = AIIndustryType.GetName(industry_type_id);
//list=NULL, NULL.Count()=Crash
   local list = AIIndustryType.GetProducedCargo(industry_type_id);
//CRASH!!!    if(list.Count() == 0) {
      score /= 2;
   }
   return score;
}


Maybe it would be better to just get a empty list then NULL. But in the NOAI documentation is written, that the industry type you want to get the list of has to be valid. I don't know if there are similar cases where the behavior is the same.

A save before the crash happens is attached.

Bye, good luck with your AI.


Attachments:
File comment: almost forgot the save
CountBug.sav [690.59 KiB]
Downloaded 87 times
Top
   
 Post subject: Re: AIAI
PostPosted: Thu Jul 18, 2013 7:59 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
Thanks! Lesson from this: solving potential racial condition by "it is so unlikely that it can not happen" is a poor idea. At least my debug variables worked properly and allowed to debug this problem.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
 Post subject: Re: AIAI
PostPosted: Fri Jul 19, 2013 9:03 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
Version iota95 with bugfixes provided by Steffl and mart3p is now available through BaNaNaS.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
 Post subject: Re: AIAI
PostPosted: Sat Jul 20, 2013 8:37 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Oct 31, 2005 9:00 pm
Posts: 1032
Location: UK
Hi Kogut,

Why has AIAI built all these "a" signs? :? I see they also appear in MagicBuzz's screenshot above.

AIAI iota95, OpenTTD 1.3.2-RC2, FIRS 1.2.0
I have a savegame if needed.

Attachment:
AIAI signs.png
AIAI signs.png [ 63.63 KiB | Viewed 4594 times ]


And I just noticed the AI debug window shows v94 but it's definitely v95 as I just downloaded it and then started a new game.

_________________
Image


Top
   
 Post subject: Re: AIAI
PostPosted: Sun Jul 21, 2013 8:27 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
Short answer: it is a bug that should not appear in version 95 (please report any signs like this appearing - this AI is not supposed to use signs beyond bug report info above HQ without explicit request in settings).

Long answer: There is a library called SuperLib that contains functions usable by any AI. One may be used to delete all signs placed by a company on a selected tile and place there a new sign (to avoid situation with 1000+ signs on screen what is causing a serious lag in OpenTTD). This function is used both directly by AIAI and as debug by some other SuperLib functions. Here it was used by function looking for a place to construct road depot, near selected tile.

In older versions there was a setting in AIAI, disabled by default, hidden without enabling hidden OpenTTD setting. Enabling it allowed all kinds of debug signs to appear. I recently attempted to fully disable SuperLib debug signs and allow AIAI to use this sign function but I made mistake and I failed to block debug signs from SuperLib.

Change ( https://github.com/Bulwersator/AIAI/com ... f2c96bb2d6 ) included in iota95 should do it properly.

EDIT:
Quote:
And I just noticed the AI debug window shows v94 but it's definitely v95 as I just downloaded it and then started a new game.
No idea. Maybe try to restart OpenTTD? I just tried on clean OpenTTD install (both trunk and stable) and it downloaded, used and displayed v95.

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
 Post subject: Re: AIAI
PostPosted: Sun Jul 21, 2013 9:02 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Oct 31, 2005 9:00 pm
Posts: 1032
Location: UK
Thanks for your answer.

Having now reloaded the savegame it is showing v95 of AIAI. So for some reason, the new version I downloaded via the ingame content downloader wasn't used when I started a new game immediately afterwards.

_________________
Image


Top
   
 Post subject: Re: AIAI
PostPosted: Sun Jul 21, 2013 9:15 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
mart3p wrote:
for some reason

It may be a bug in OpenTTD. I tried to reproduce it but failed. Is it possible that you run "check online content" from started game?

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
 Post subject: Re: AIAI
PostPosted: Sun Jul 21, 2013 9:52 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Oct 31, 2005 9:00 pm
Posts: 1032
Location: UK
Kogut wrote:
Is it possible that you run "check online content" from started game?

No, I used "check online content" from the AI configuration window, which I opened from "AI/game script settings" from the start screen. I did already have AIAI selected in the AI configuration window.

I will check what happens more carefully next time there is an update. :wink:

_________________
Image


Top
   
 Post subject: Re: AIAI
PostPosted: Sun Dec 15, 2013 1:20 pm 
Offline
Engineer
Engineer

Joined: Thu Dec 12, 2013 9:25 pm
Posts: 6
I made a screen shot of the AI interface;
Attachment:
ttd1.png [1.2 MiB]
Downloaded 8 times


Thanks


Top
   
 Post subject: Re: AIAI
PostPosted: Sun Dec 15, 2013 2:33 pm 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
It seems that problems was caused by combination of weird settings and lack of proper error reporting. Second one is fixed in https://github.com/Bulwersator/AIAI/com ... bf3b2c24a8 and will be included in next version.

Thanks for the report!

In attachment: how error reporting works in dev version.


Attachments:
Przechwytywanie.PNG [67.03 KiB]
Downloaded 8 times

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Top
   
 Post subject: Re: AIAI
PostPosted: Sat Feb 01, 2014 4:17 pm 
Offline
Engineer
Engineer

Joined: Sat Feb 01, 2014 4:12 pm
Posts: 1
Hello, I was advised to post this error message here.

Dunno if it's of any help, but just moments before, I got the in-game announcement that one of the companies was going bankcrupt.


Attachments:
open-ttd.PNG [44.92 KiB]
Downloaded 8 times
Top
   
 Post subject: Re: AIAI
PostPosted: Wed Feb 05, 2014 11:32 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
Thanks for bug report! You are using old version of AIAI, I would advise to update OpenTTD (current stable is 1.3.3) and AIAI. It is likely that this bug was fixed in rewrite of relevant part of code.

As there was no page about updating on OpenTTD wiki I just created one at http://wiki.openttd.org/Updating (corrections, improvements and fixes are welcomed).

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD


Top
   
 Post subject: Re: AIAI
PostPosted: Sat Mar 08, 2014 5:43 pm 
Offline
Engineer
Engineer

Joined: Sun May 12, 2013 10:28 pm
Posts: 89
Location: Argentina
hi kogut...

I found this bug long time ago in version iota 14, but forgot to post it here. I recently came back and found the same in version 95

At railbuilder.nut, lines 593-596 (was 475-478 in v14), there is...

Code:
   //multiplier: for weak locos it may be possible to merge multiple trains ito one (2*loco + 10*wagon, instead of loco+5 wagons)
   //multiplier = how many trains are merged into one
   local multiplier = min(GetAvailableMoney()/costs.GetCosts(), route.station_size*16/AIVehicle.GetLength(engineId))
   multiplier--; //one part of train is already constructed
   for (local x=0; x<multiplier; x++) {

(note the lack of ; at end of line 595)

But it can trig an error when multiplier is not integer because with x being between 0 and 1 makes the for loop enter once, trying to build a multiple train longer than allowed by user setting also crash the AI (you do the checking for a single train, but forgot for multiple).

Here my suggested change:

Code:
    local multiplier = min(GetAvailableMoney()/costs.GetCosts(), route.station_size*16/AIVehicle.GetLength(engineId));
// Patch: Trains should not be longer than max_train_length setting, also check than multiplier is integer
   multiplier = multiplier.tointeger();
   while (multiplier>AIGameSettings.GetValue("max_train_length")*16/AIVehicle.GetLength(engineId))
      multiplier--;
// End of Patch
   multiplier--; //one part of train is already constructed

Regards.


Top
   
 Post subject: Re: AIAI
PostPosted: Thu Apr 03, 2014 5:05 pm 
Offline
Engineer
Engineer

Joined: Sun May 12, 2013 10:28 pm
Posts: 89
Location: Argentina
Hi, here another bug related to trains, AIAI was doing pretty well for about 30 years in the road/ship era, but when first train became available in 1831, it failed to build proper rail vehicles (infrastructure was right, two good connected stations with depots in right place) I was using UKRS2 train grf. You will see in the screenshot that AIAI build successfully a first train and failed at the second. The first one has six (!) engines, the second only one, with a single wagon. As the message says, both are valid consists (but rares, maybe the script tried to build one train and was splitted cause of bad calculation, settings were at 4 tiles long) BTW, I was using original v95, not my patched one (see my earlier post)


Attachments:
File comment: AIAI iota 95 crash
HGus Transport, 1832-03-20#1.png [85.61 KiB]
Downloaded 5 times
Top
   
 Post subject: Re: AIAI
PostPosted: Fri Apr 04, 2014 1:11 am 
Offline
Engineer
Engineer
User avatar

Joined: Sat Dec 03, 2005 2:30 am
Posts: 67
Location: United Kingdom
I think the Planet locomotive is quite bad at climbing hills in certain situations so that could be why it added so many engines. No idea for the other problems though!

_________________
Long time TT addict, long time forum lurker.
Oh, and I run a Star Wars fan site.


Top
   
 Post subject: Re: AIAI
PostPosted: Sat Apr 05, 2014 12:05 am 
Offline
Engineer
Engineer

Joined: Sun May 12, 2013 10:28 pm
Posts: 89
Location: Argentina
Almost flat map. (seed 643564035)

Two stations at same level, no slopes at all in the line. The first engine from UKRS2 is very weak, but it still can pull a full 4-tiles passenger consist by flat terrain. Those trains are freighters, anyway, but if a multiheaded single train was intended, the code could fail to calculate the correct length, and the game created two when the orders went beyond the limit. Maybe the checking routines triggered the error. But that still to be fixed...


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 279 posts ]  Go to page Previous 110 11 12 13 14 Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.