DictatorAI

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

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: DictatorAI

Post by Zuu »

Krinn, for information the "AI_" prefix has been dropped in the 1.2 API. (if that is why the problem occurs) This happened short after NoGo was merged.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

Zuu: Thank you zuu, will watch that as soon as 1.2 hit the streets

MAG101: You are seeing that because your current open NOAI API doesn't handle that event.
This mean you are playing an openttd version that is older than 1.1.0.

This is actually a bug, thank you for reporting it, i will try to put an update soon, but the fix is just to setup correctly the API version need to handle the AI

If you wish test it more (or avoid this bug), i'm afraid you will need to update openttd to 1.1.0 or better.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: DictatorAI

Post by Zuu »

Krinn, take a look again at his screenshot. He definitely uses 1.2 or at least a version at least from December 2011 when Nogo was merged with trunk. Otherwise, why would he have a Game Scripts button in the AI debug window?

Now taking a look at your AI, I'm a bit puzzeled. I though the cause of this was that you used API version 1.2 which doesn't provide the compatibility layer. However you use 1.0 API. But perhaps the issue is that you have used this constant that is not part of 1.0, but still visible in newer OpenTTD versions. However as it was not part of 1.0, the compat.nut for 1.0 doesn't provide an AI_.. compatibility constant for the renamed constant.
155b wrote:

Code: Select all

   function GetAPIVersion()    { return "1.0"; }
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

That's the issue yep, miss to change the API version, if only all bugs could be as easy !

Here's my current work that should fix it, i'm not quiet sure how the AI state is, full of debug/tweaks i'm trying, but here's the latest version i have (on page 1)

edit: lol just saw 1.2 is out, i should build that one to try it, but it should works still with 1.1 set :)
ReisRyos
Engineer
Engineer
Posts: 11
Joined: 27 Apr 2010 08:50

Re: DictatorAI

Post by ReisRyos »

version: 156a
no newGRF
Attachments
bug.png
bug.png (19.65 KiB) Viewed 9837 times
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

Thank you for the report ReisRyos i will correct it and post a "b" release when i'm back from work tonight.
I'm not working on it currently because of a heavy workload. And even i couldn't make it evolve like i wish, i could still correct bugs in it.
So except the bug correction, sadly don't expect more from that "b" release.
MAG101
Engineer
Engineer
Posts: 28
Joined: 14 Dec 2011 00:55

Re: DictatorAI

Post by MAG101 »

krinn wrote:Zuu: Thank you zuu, will watch that as soon as 1.2 hit the streets

MAG101: You are seeing that because your current open NOAI API doesn't handle that event.
This mean you are playing an openttd version that is older than 1.1.0.

This is actually a bug, thank you for reporting it, i will try to put an update soon, but the fix is just to setup correctly the API version need to handle the AI

If you wish test it more (or avoid this bug), i'm afraid you will need to update openttd to 1.1.0 or better.
I was running 1.2 Openttd. 104 never crashes, 154 crashes lot .
wip and any inprovement planned?
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: DictatorAI

Post by Zuu »

I guess it is a typo, but your manual says that one need OpenTTD 1.5 to run DictatorAI.
You need openttd 1.5 to run this AI.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

yep of course, it was 1.1.5 by that time i think :)

i will fix it and fix the 1.2 API bug soon, my spare time is going back to a less stressful normality. I'm just using the few i have right now to fix other things i couldn't do while spring work (lol mostly getting out for a beer with my friends)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: DictatorAI

Post by Zuu »

Your AI crashed with last nightly of OpenTTD (r24526). This error probably exist since december 2012 when NoGo was merged and the constants that start with 'AI_' or 'AI' had the 'AI_' part removed.

The EVENT flag that you use was introduced in API version 1.1, and for that compatibility layer there exist code do handle backward compatibility with the AI_ET_TOWN_FOUNDED constant. However your info.nut set API version to 1.0 for your AI, and since the constant didn't exist in the 1.0 API, no compatibility for that constant exist in compat_1.0.nut.
Attachments
Tynspång Transport, 14th Mar 1982.png
Tynspång Transport, 14th Mar 1982.png (14.25 KiB) Viewed 1755 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

I have fix it zuu it's in bananas, it was fixed in the testing version but i have forget the released one.
Funny but if none tell me this is thing i cannot see as i only own the testing version in my openttd :P
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

A new stable release 1.60 should be available thru bananas.

- Many bugfixes
- Add handling of subsidy
- Add support for SCP
- Add handing of NoCargoal . See source here to if you want add it to your AI easy, or as sample on howto implement it.
- No trains yet (sorry, a real lot of more work to do to add that).
- Now blacklisting aircraft with limited range, in my tests it show only av8 newGRF set use it, but sadly all the aircrafts in it use that, so the AI won't play with aircrafts from that newGRF at all.

This AI is made for openttd API 1.2, but you will need a newer API to play with it and nocargoal as nocargoal need a newer API (see its thread for requierements).

I will upload here another test version with trains when i get one ready, so, even lacking trains, this version is the newest.
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: DictatorAI

Post by Hyronymus »

Your dictator was extradicted in my current game, see attached image.
Attachments
End of a dictator.png
(590.69 KiB) Downloaded 9 times
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

It wasn't a good period for dictators.

I will fix that tonight, i've work hard to fix a lot of stuff for the road and air parts, and forget totally the train part, as this is not finished. This bug is from the train part, something i will work on soon as my todo list is now smaller.

Thank you for your report.
For your information, the latest version is 1.68, and this bug is in it too. Look for 1.69 for the fixed version.
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: DictatorAI

Post by Hyronymus »

krinn wrote:It wasn't a good period for dictators.

I will fix that tonight, i've work hard to fix a lot of stuff for the road and air parts, and forget totally the train part, as this is not finished. This bug is from the train part, something i will work on soon as my todo list is now smaller.

Thank you for your report.
For your information, the latest version is 1.68, and this bug is in it too. Look for 1.69 for the fixed version.
Your welcome and I'll have a look for 1.69 :).
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

Ok bugfixes, look for 1.69 in bananas.

Do you have a savegame to provide, as the bug came out when AI fail to select a train engine, and as your screenshot prove, some trains exists in that game, It's not the bug by itself : that was a real one in the code ; and not even a real bug, as for many reasons the AI may not select an engine, not because none exists to work with, but none matching its selection critera exists (per example, a too huge cost train engine...).
So i'm curious to see why it couldn't pickup one.
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: DictatorAI

Post by Hyronymus »

krinn wrote:Ok bugfixes, look for 1.69 in bananas.

Do you have a savegame to provide, as the bug came out when AI fail to select a train engine, and as your screenshot prove, some trains exists in that game, It's not the bug by itself : that was a real one in the code ; and not even a real bug, as for many reasons the AI may not select an engine, not because none exists to work with, but none matching its selection critera exists (per example, a too huge cost train engine...).
So i'm curious to see why it couldn't pickup one.
Sure, but it's not from the exact date as my report see http://tinyurl.com/b6d4wtk.
Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: DictatorAI

Post by Samu »

Hi. Reporting a crash

the index 'GetRoadStationEntry' does not exist.
Attachments
Unnamed, 2016-11-07.sav
(4.36 MiB) Downloaded 242 times
screenshot#4.png
(50.72 KiB) Downloaded 4 times
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

Thank you for your report Samu. I will work on it.
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: DictatorAI

Post by krinn »

I have put my current work on dictatorai with trains as i have convert it to use cEngineLib, it will gave a good playground for anyone.

The ai nearly handle trains, i have still plenty stuff to do to finish that. But it works more or less ;)
This include bugfixes and changes for other aspect of the AI too.

It should works for everyone if you disable trains ("should") because many debug and testing are in it, that may impact it even without using trains.
But as some love to test things, and as this could provide me feedback, you can download it from the first post.

The big change : AI savegame for older versions has been drop (except 168 & 169), a new savegame is use (that save nearly nothing).
So if you want load old savegame to play with it, better load it with dictatorai 168 or 169 and resave them.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: xarick and 9 guests