AdmiralAI v25

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI v25

Post by Yexo »

If you can reproduce that problem I'd like to see that savegame very much. It's something that is definitely not fixed between version 22 and 25, I suspect you have been changing newgrfs, but I'm not sure that is the cause of the problem. Even in that case I'd like to try and fix it in my AI.
iNVERTED
Route Supervisor
Route Supervisor
Posts: 387
Joined: 24 Apr 2005 21:21
Location: Torquay, England
Contact:

Re: AdmiralAI v25

Post by iNVERTED »

After updating to v25, I got a more serious crash:

http://www.tt-forums.net/viewtopic.php? ... 56#p896556
Flaggerdagger
Engineer
Engineer
Posts: 6
Joined: 17 Aug 2010 12:18

Re: AdmiralAI v25

Post by Flaggerdagger »

Hi all,

I just got an error in a game where I played against seven Admiral AI's (v25).
I think the problem occured when Electric loc's were introduced and the (only) AI having trains tried to change his tracks into wired tracks.


Regards
Attachments
screencap1.JPG
(353.9 KiB) Downloaded 2 times
Yisc
Engineer
Engineer
Posts: 55
Joined: 09 Apr 2004 21:14
Location: Leiden
Contact:

Re: AdmiralAI v25

Post by Yisc »

Hi, I'm playing a game against 3 AdmiralAI's and just ran into a crash of it.
I've attached a screenshot of the crash, a savegame which I made just after the crash and the last autosave before the crash.
Attachments
Admiral_AI_crash.png
Screenshot of the crash
(473.75 KiB) Downloaded 2 times
United movers, 12th Jan 1967.sav
Savegame made just after the crash
(1.17 MiB) Downloaded 183 times
autosave4.sav
Last autosave before the crash
(1.16 MiB) Downloaded 179 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI v25

Post by Yexo »

Flaggerdagger and Yisc thanks for your reports. I suspect that the save/load code is still not working correctly, I'm currently trying to fix this bug.
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: AdmiralAI v25

Post by Steffl »

It's a little bit offtopic, but it would be interesting for me: Is it really better to initialise variables with 'null'? Why not just set new variables to digital '0'?
I often read this error with the 'invalid type null' in bug reports.
I think you're really a good programer and you know what you are doing. So, what is the advantage of using null?
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI v25

Post by Yexo »

This way I get a much better bug report. If I initialized the value to 0 I could get a "divide by zero" error a few lines later, which would then leave me wondering whether I forgot to initialize the value completely or whether the value was incorrectly initialized to 0. With null when I see the bug report I know immediately that I forgot to initialize this variable somewhere. Where exactly that is I still need to find out, but at least the cause of the bug is clear.

In this particular case when the value was initialized to 0 instead of null the AI would not crash but would instead build stations incorrectly. That would give other (much more obscure) bug reports, which are much harder to trace. In general I prefer a crash of the AI above unexpected behavior, because a crash if a lot easier to trace and fix.
Yisc
Engineer
Engineer
Posts: 55
Joined: 09 Apr 2004 21:14
Location: Leiden
Contact:

Re: AdmiralAI v25

Post by Yisc »

I've investigated a little more and started playing tonight with the already supplied autosave.
At the 1st of january 1967 the SH30 electric train is introduced and then again the AI crashed at the 12th of januari 1967. (which happened at the same date yesterday)
Hopefully this will give you some extra information to determine where it's going wrong.
Flaggerdagger
Engineer
Engineer
Posts: 6
Joined: 17 Aug 2010 12:18

Re: AdmiralAI v25

Post by Flaggerdagger »

Lol! That was exactly the same with my game. When E-locs (SH30) were introduced, error came up.
Good luck with the fix! If you need any other info / files, just say so :)
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: AdmiralAI v25

Post by SirkoZ »

Another null/integer crash - in year 1974...
Screenie:
Attachments
Valencia Transport r20676, 13th Jan 1974.png
(200.54 KiB) Downloaded 2 times
Yisc
Engineer
Engineer
Posts: 55
Joined: 09 Apr 2004 21:14
Location: Leiden
Contact:

Re: AdmiralAI v25

Post by Yisc »

I don't want to sound impatient, but any chance this problem will be fixed soon?
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AdmiralAI v25

Post by Lord Aro »

not a bug as such, but while running the AI trains only i got this train jam:
Attachments
admiralai train jam.png
admiralai train jam.png (268 KiB) Viewed 3995 times
admiralai train jam.sav
can't remember what version but it was definitely <r20600
(198.53 KiB) Downloaded 174 times
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Moriarty
Tycoon
Tycoon
Posts: 1395
Joined: 12 Jun 2004 00:37
Location: United Kingdom of Great Britain and Northern Ireland
Contact:

Re: AdmiralAI v25

Post by Moriarty »

Running v25 with FIRS and the Japanese trainset. The AI builds a valid route between unserved stations, it builds a train, it gives the train orders, but it doesn't start the train. The reason is because the particular wagons it's using for that train require a brake-van but the AI doesn't build one. Is there a way for Admiral to discover this requirement without it having to be hard-coded for each GRF?
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI v25

Post by Yexo »

Unfortunately not, because there is no way for the newgrf to specify that requirement to OpenTTD other than by disallowing to start the vehicle (which can be for a number of reasons). What AdmiralAI can do is detect the failure to start the vehicle and not build that combination of engine+wagons again. It'll have to rediscover that ever game, so it's not a very good solution but better than nothing.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AdmiralAI v25

Post by Lord Aro »

hmm.

i could swear that i saw SimpleAI add a brake van to one of its trains...
I'd confirm it now but my computer is out of action :(
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: AdmiralAI v25

Post by Brumi »

Lord Aro wrote:i could swear that i saw SimpleAI add a brake van to one of its trains...
??? Really? :D
SimpleAI doesn't have support for NewGRF trainsets. It may work in some cases, but the term 'brake van' is unknown for SimpleAI.
I think you saw a mail wagon attached to a passenger train instead... :wink:
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AdmiralAI v25

Post by Lord Aro »

nope, was definately a brake van, i checked on the train info :?
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI v25

Post by Yexo »

Can you provide a savegame where simpleai does that?
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AdmiralAI v25

Post by Lord Aro »

ok, i take that back.
I can't find the savegame a originally noticed it in, but testing shows that it was probably UKRS2 with it adding a lookalike on the end of the train

Sorry for wasting your time :lol:

However, perhaps this is something to add to the NewGRF/AI spec? Whether the wagon needs a brake van or not, and defining a brake wagon. Perhaps?
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Yisc
Engineer
Engineer
Posts: 55
Joined: 09 Apr 2004 21:14
Location: Leiden
Contact:

Re: AdmiralAI v25

Post by Yisc »

Any news about a possible new version of this AI?
I would really like to play on with it, but am still stuck with this crash when SH30 is introduced.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 11 guests