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 (v8 out)

Post by Yexo »

SirkoZ wrote:I just ran a 256x256 map with v8 of the AI with the afore-mentioned build and there are 3 things:
1.) it's not building anymore (in only 2009),
2.) it's not autorenewing or replacing its trucks/buses,
3.) look at truck number 123 - a food lorry at rubber plantation... and there was another such example where it built oil lorries near the diamond mine, but sold those off.
Thanks for testing :).
2) You disabled breakdowns, so the AI decided there is no point in autorenewing. Autoreplace for busses is not yet implemented. It should autoreplace trucks, I'll look into this.
3) Another bug, again, I'll look into this.

As you can see in the savegame, there are several road vehicles waiting in the depot. They have been waiting in the depot since 1980, while all vehicles in depots are sold off every 20 days or so (sometimes less, when the AI is busy pathfinding a new route). Because of this I assume the AI has crashed already in 1980, and if so, that's the reason it's not autoreplacing. Can you confirm it hasn't build anything after 1980 or 1981 or so?

If you encounter this another time (seemingly stopped building), I am very interested in the output in the AI debug panel, as that can help me solve those bugs. You can find the debug panel under the question mark in game. If the AI crashed, there'll be a lot of red lines. I'm only interest in the lower lines in the window (those stating file names + lines numbers, and the line thereunder with the actual error message).
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: AdmiralAI (v8 out)

Post by SirkoZ »

I see.

Well - I'd really appreciate it if you made it to autorenew even with breakdowns off as it's not realistic that it doesn't. I only have breakdowns off because if I build a rail system there are immense stalls with breakdowns enabled...

I think it may have crashed around '80 but I'm not sure either - have see those buses in depot (even from '74). Interesting is that it started building again when I loaded that (002) game.

I'll run through another game just to see and better report if/when it crashes.


BTW - you're welcome. Nice to see better AI's being done and with your experience now you'll perhaps be able to make a great rail AI too. ;-)


P.S.: I have PM-ed you the crash screenshot of v8.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v9 out)

Post by Yexo »

It took quite some time, but here is v10. As usual the tar is in the first post.

New features:
  • Save / Load functionality. AdmiralAI is now able to resume a game. Note that not all information, like pathfinding is saved, but all routes can be restored and managed.
  • If building a route fails for some reason (a town was expanded between pathfinding and building), retry pathfinding it a few times
  • Sell some road vehicles when there are too many for one stations (could only happen when autoreplacing vehicles with a faster model)
Bug fixes:
  • Don't build routes for deleted stations. This could result crashes or building the wrong type of trucks (if a new industry with the same industryid was created)
  • Use AITile.IsStationTile instead of AIRoad.IsRoadStationTile to not try to built next to airports and train stations.
There are no known bugs at the moment, but if you encounter any, please report them.
Last edited by Yexo on 05 Aug 2008 19:25, edited 1 time in total.
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: AdmiralAI (v9 out)

Post by SirkoZ »

Nice. Thanks.

Here's a small suggestion for AI handling stations with increasing number of road vehicles. It's a simple arrow shaped condensed lorry station with distances to each station of the same length although pathfinder sometimes doesn't route vehicles to all the bays right away. Stations can of course be expanded/contracted on demand (number of road vehs on them).
Attachments
Arrow_stations.
Arrow_stations.
Fuerte Olimpio Transport, 7th Mar 1950.png (34.68 KiB) Viewed 6950 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v10 out)

Post by Yexo »

It took quite some time, but here is v10. As usual the tar is in the first post.

New features:
  • Save / Load functionality. AdmiralAI is now able to resume a game. Note that not all information, like pathfinding is saved, but all routes can be restored and managed.
  • If building a route fails for some reason (a town was expanded between pathfinding and building), retry pathfinding it a few times
  • Sell some road vehicles when there are too many for one stations (could only happen when autoreplacing vehicles with a faster model)
Bug fixes:
  • Don't build routes for deleted stations. This could result crashes or building the wrong type of trucks (if a new industry with the same industryid was created)
  • Use AITile.IsStationTile instead of AIRoad.IsRoadStationTile to not try to built next to airports and train stations.
There are no known bugs at the moment, but if you encounter any, please report them.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AdmiralAI (v10 out)

Post by Zutty »

Save/load support! Well done Yexo. :bow:

I'm intrigued by the method you have used. It seems you are trying to save as little data as possible and infer the rest when the AI is started. How much are you able to get from the state that the game saves anyway?

Plus may I ask, have you done anything to prevent data from different AI's or different versions of AdmiralAI causing problems?
PathZilla - A networking AI - Now with tram support.
dbkblk
Traffic Manager
Traffic Manager
Posts: 154
Joined: 29 Mar 2008 18:38

Re: AdmiralAI (v10 out)

Post by dbkblk »

Ouf, this is an awesome "monster" AI. It has fulled my map and beated me ! (I played 1 pathzilla with 2 admiral).
Sorry Zutty but pathzilla has built only 26 vehicles whereas admirals has built 700 !

You developpers are awesome :D
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AdmiralAI (v10 out)

Post by Zutty »

dbkblk wrote:Ouf, this is an awesome "monster" AI. It has fulled my map and beated me ! (I played 1 pathzilla with 2 admiral).
Sorry Zutty but pathzilla has built only 26 vehicles whereas admirals has built 700 !

You developpers are awesome :D
DAMN! I really need to make PZ expand faster!! :roll:
PathZilla - A networking AI - Now with tram support.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v10 out)

Post by Yexo »

Zutty wrote:Save/load support! Well done Yexo. :bow:

I'm intrigued by the method you have used. It seems you are trying to save as little data as possible and infer the rest when the AI is started. How much are you able to get from the state that the game saves anyway?
For save/load I've taken a different approach for bus routes and truck routes. I don't store buslines at all, I restore them from AIStationList and AIVehicleList. That means that it can also resume bus routes created by other AIs, as long as they have the same format (every station is used in only one route, and all routes are station1, station2, depot). It can handle some variations (depot, station, station for example), but not all. This has more to do with the internal route manager code than with the load code.

For truck routes this approach doesn't always work, since if two forests are next to eachother I can't detect where the station belongs to. So for truck routes I store pretty much everything (station_from, industry_from, station_to, industry_to). Loading truck routes has the same problem, so in effect it doesn't detect anything yet, it reads it all from the savegame. It still want to redo this properly (like busses), but it's hard to do so correctly, so for now I'll keep it the way it is now (easy and working).
Plus may I ask, have you done anything to prevent data from different AI's or different versions of AdmiralAI causing problems?
Yes, this is fairly simple: before accessing any element from the data table, just check if it really exists. Of course this can still cause problems if other AIs use the same names in there data table, but for now, I take this risk.

The only way to prevent this is storing an additional variable with AI_Name and Save_version in the save data. If every AI that implemented save/load code would do that, and increment Save_version when needed, the AI writer can choose: Just implement loading my own AI, checking for AI_Name="My AI" and Save_version<known_version. However, if there AI is similar enough to another AI, so they can share data, they can also save there data with AI_Name="Other AI" and version=known_version. In such cases it may be better to get in touch and choose a more general name for AI_Name.
I think the data saved by AIs can be the same for a lot of AIs, so we should really discuss making a general format for that, so we can keep compatible.
dbkblk
Traffic Manager
Traffic Manager
Posts: 154
Joined: 29 Mar 2008 18:38

Re: AdmiralAI (v10 out)

Post by dbkblk »

Hu !

I've found a bug, with eGVTRS and a 1880's game !

3 admiralai have built a coal line and after time they want to make a new network. The three AIs show that on the debug screen (Look at the pic).

I can notice that if i press "Reload AI", it won't show this error again !
Attachments
Admiralbug.png
(139.06 KiB) Downloaded 272 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v10 out)

Post by Yexo »

Time to release v11. I have some more features in mind, but as I won't have much time for coding them, I'll release v11 now and put more features off to v12 or later.

New features:
  • Plane support
  • Build multiple goods drop stations per town.
Bug fixes:
  • When loading a game, don't rename the company if it already has AdmiralAI in the name.
  • Some small issues with pathfinding (the crash mentioned by dbkblk was just one case of this bug)
  • Fix rare crash (using 'this' in a function that was called statically)
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AdmiralAI (v10 out)

Post by Zutty »

Yexo wrote:
  • Plane support
Cool! :D

Is this the first multi-modal AI?

Edit: Does it mix usage of buses and planes or do they run independently? I'm thinking of shuttle buses to improve coverage area, and ofcourse cargodest for the distant future!
PathZilla - A networking AI - Now with tram support.
opossum
Engineer
Engineer
Posts: 7
Joined: 30 Aug 2008 13:17

Re: AdmiralAI (v11 out with plane support)

Post by opossum »

How to install the AI ?
dbkblk
Traffic Manager
Traffic Manager
Posts: 154
Joined: 29 Mar 2008 18:38

Re: AdmiralAI (v11 out with plane support)

Post by dbkblk »

Look at the first page

"Where can I get a new AI to play with?
Distributed with the source/binaries is WrightAI. WrightAI only builds airports and planes, but it's pretty good at that. To download other AIs, you'll have to browse this subforum and search for users posting their AI. After you downloaded a tar file, you should put it in {OPENTTD_DIR}/ai and are ready to play."
opossum
Engineer
Engineer
Posts: 7
Joined: 30 Aug 2008 13:17

Re: AdmiralAI (v11 out with plane support)

Post by opossum »

I have did that, I have put AdmiralAI.tar file into the C:\openttd\AI , but the AI is still dum as 7 year old kid.

The file is in the " C:\openttd 062\AI\admiralai.tar ", I think that is correct. The file is not extracted.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AdmiralAI (v11 out with plane support)

Post by Zutty »

opossum wrote:...C:\openttd 062\AI\...
Are you using 0.6.2?

NoAI isn't supported in any releases yet, or even in trunk. You need to use the NoAI branch. The devs normally provide binaries for us, but unfortunately I think either the pages have moved or they haven't quite finished setting them up on the new server.

[Moderator] Please don't supply custom created executables, as if that gives bug reports, we can't handle them. Please can download sources from pointed out places [/Moderator]
PathZilla - A networking AI - Now with tram support.
opossum
Engineer
Engineer
Posts: 7
Joined: 30 Aug 2008 13:17

Re: AdmiralAI (v11 out with plane support)

Post by opossum »

yep I am using 0.6.2.

Thank You.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: AdmiralAI (v11 out with plane support)

Post by TrueBrain »

Zutty wrote:
opossum wrote:...C:\openttd 062\AI\...
Are you using 0.6.2?

NoAI isn't supported in any releases yet, or even in trunk. You need to use the NoAI branch. The devs normally provide binaries for us, but unfortunately I think either the pages have moved or they haven't quite finished setting them up on the new server.

(..)
I don't know where you get those strange ideas from .. the binaries are at the same place are they are for ages, and if you would read the sticky in this forum, you would know.

To quote:
Where can I download the latest version?
You can download binaries from http://nightly.openttd.org/noai/scoreboard.php. These are generated every night (18:00 CEST) from SVN.
(..)
Reading seems to be so hard these days ...
The only thing necessary for the triumph of evil is for good men to do nothing.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: AdmiralAI (v11 out with plane support)

Post by TrueBrain »

opossum wrote:yep I am using 0.6.2.

Thank You.
Same for you: it helps to read stickies in forums, it might give you clues and ideas.
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AdmiralAI (v11 out with plane support)

Post by Zutty »

TrueBrain wrote:I don't know where you get those strange ideas from .. the binaries are at the same place are they are for ages, and if you would read the sticky in this forum, you would know.

...

Reading seems to be so hard these days ...
Yes I DO know where to get these files, however the page was down this morning. :?

I was just trying to be helpful. Perhaps I shouldn't bother in future. :|
PathZilla - A networking AI - Now with tram support.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 19 guests