Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Apr 24, 2017 5:14 pm

All times are UTC




Post new topic  Reply to topic  [ 25 posts ]  Go to page 1 2 Next
Author Message
 Post subject: WormAI
PostPosted: Sun Jul 28, 2013 3:23 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
WormAI is an ai that tries to be competitive. It currently supports pax air transport and since version 5 also train support for all cargos.
In the tests I have done it usually performs fairly well as long as you haven't turned on infrastructure maintenance.
Trains currently require that 90 degree turns are allowed.

Minimum OpenTTD version 1.4.

WormAI is available on Bananas.

Current version: 7
Released: 2017-04-16

Changelog

Version 7, 2017-04-16
  • Fix: Not checking air route range at startup under certain conditions.
  • Change: Adjust maximum distance for air routes when we have limited money.
  • Change: Adjust aircraft selection when we have limited funds and high prices of longer range aircraft.

Version 6, 2016-05-28
  • Fix: Crash when loading a savegame saved when building a rail route or when replacing trains.
  • Fix: Crash when we get loaded into a savegame without getting any saved data.
  • Fix: We need to make sure we have at least some money to build a rail route.
  • Fix: Make sure that the vehicle we share orders with is valid.
  • Fix: 90 degree turns near a passing lane.
  • Fix: border of map starts at 1,1 not 0,0. (We were not building airports in towns near the left and upper borders.)
  • Change: more checks before building a passing lane, we should see less land is sloped wrong messages.
  • Change: Improved airport upgrading.
  • Change: Better handling of airplane NewGRF's that have high prices.
  • Change: Rail pathfinding tweaks.
  • Change: Don't cancel and remove routes just because we don't have money for vehicles. Just add them later when we do have the money.
  • Change: Don't use airplanes that are hardly profitable.
  • Change: Blacklist airports that we failed to upgrade for a while.

Version 5, 2016-05-14
  • Add: Train support. Based on SimpleAI but with changes and more to come.
  • Change: Take inflation into account.
  • Change: blacklist towns where we failed to build an airport for a while.
  • Change: Don't remove airports we just built if we don't have money to buy the airplanes. We build them later when we have the money.
  • Change: Don't waste time trying to upgrade airport if there's too much noise.

Version 4, 2016-04-30
  • Fix: Airplanes could get stuck when an airport upgrade failed.
  • Fix: After loading a savegame that had airplanes stopped in depot to be sold WormAI didn't know about them being in depot and tried to send them to depot again which failed causing them to not be sold.
  • Add: Build HeadQuarters (normal or fast setting).
  • Add: Build Statues in towns with an airport (fast setting only).
  • Change: Updated SuperLib to latest version (39).

Version 3, 2015-06-12
  • Add basic support for upgrading airports.
  • Fix: Don't use large aircraft on small airports.
  • Fix: Don't crash when there isn't a best engine at all.
  • Change: Don't add more airplanes to a route when there are too many planes waiting in the landing queue.
  • Change how we are starting tasks. Do it monthly/yearly instead of based on a tick count.
  • Some changes in the min/max and default values of some settings.
  • Increased required OpenTTD version to 1.4.

Version 2, 2013-08-02
  • Add support for vehicle breakdowns by adding depot maintenance orders.
  • Add vehicle management: send old vehicles to depot and sell once a month.
  • Fix: Incorrect tile rectangle near map borders.

Comments and bug reports are welcome :)


Last edited by Wormnest on Sun Apr 16, 2017 2:42 pm, edited 7 times in total.

Top
   
 Post subject: Re: WormAI
PostPosted: Thu Aug 01, 2013 11:01 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
It may be a good idea to publish it on BaNaNaS - see http://bananas.openttd.org/en/ai/

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


Top
   
 Post subject: Re: WormAI
PostPosted: Thu Aug 01, 2013 11:11 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9006
Location: Sol d
Kogut wrote:
It may be a good idea to publish it on BaNaNaS - see http://bananas.openttd.org/en/ai/


Quite so. During NewGRF testing I usually have a handful of random AIs active in the test game and I'm happy to share any problems they encounter. But I'm usually too lazy to pick them from other places than the convenient ingame download :-)

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
 Post subject: Re: WormAI
PostPosted: Thu Aug 01, 2013 1:28 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
It certainly was (and is) my intention to post it on bananas.
My main reason for not having done that yet was the problem I had in signing up for an account as posted in this thread.


Top
   
 Post subject: Re: WormAI
PostPosted: Fri Aug 02, 2013 8:01 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
Version 2 is now available from the first post and also on Bananas.

Changelog

Version 2, 2013-08-02
---------------------
+ Add support for vehicle breakdowns by adding depot maintenance orders.
+ Add vehicle management: send old vehicles to depot and sell once a month.
+ Fix: Incorrect tile rectangle near map borders.


Top
   
 Post subject: Re: WormAI
PostPosted: Sun Oct 06, 2013 7:03 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4528
Location: /home/sweden
While testing your AI, I noticed that you have large planes scheduled to transport passengers between small airports. This give a significant increased risk of aircraft crashes. I would recommend against using large airplanes on small airports (Small & Commuter).

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: WormAI
PostPosted: Sat Oct 12, 2013 9:18 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
Thanks for reporting this.
I added it to my list of things that need looking at. However I currently don't have time so it might be a while.


Top
   
 Post subject: Re: WormAI
PostPosted: Wed Aug 27, 2014 5:21 pm 
Offline
Engineer
Engineer

Joined: Wed Aug 27, 2014 5:11 pm
Posts: 1
error script
Attachment:
error script.jpg [652.17 KiB]
Downloaded 2 times


Top
   
 Post subject: Re: WormAI
PostPosted: Wed Aug 27, 2014 8:34 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
Jabbo wrote:
error script


Thanks for the report. I think I know what went wrong.
As soon as I can find some time I will have a look at it but there are some other unfinished changes I need to work on too so it might be a while before I can release a new version.


Top
   
 Post subject: Re: WormAI
PostPosted: Fri Jun 12, 2015 7:34 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
A new version that fixes the reported bugs is now available from Bananas and the first topic in this thread.

Changes:

Version 3, 2015-06-12
  • Add basic support for upgrading airports.
  • Fix: Don't use large aircraft on small airports.
  • Fix: Don't crash when there isn't a best engine at all.
  • Change: Don't add more airplanes to a route when there are too many planes waiting in the landing queue.
  • Change how we are starting tasks. Do it monthly/yearly instead of based on a tick count.
  • Some changes in the min/max and default values of some settings.
  • Increased required OpenTTD version to 1.4.

Still some things left that could be improved but I haven't had a crash in 50 years of running it.


Top
   
 Post subject: Re: WormAI
PostPosted: Sat Apr 30, 2016 3:32 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
A small update with mostly minor fixes and improvements.

Changelog

Version 4, 2016-04-30
  • Fix: Airplanes could get stuck when an airport upgrade failed.
  • Fix: After loading a savegame that had airplanes stopped in depot to be sold WormAI didn't know about them being in depot and tried to send them to depot again which failed causing them to not be sold.
  • Add: Build HeadQuarters (normal or fast setting).
  • Add: Build Statues in towns with an airport (fast setting only).
  • Change: Updated SuperLib to latest version (39).


Top
   
 Post subject: Re: WormAI
PostPosted: Sat May 14, 2016 9:35 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
Finally WormAI can do more than just airplanes. With this release I have added train support. It is based on SimpleAI but with several changes and more planned.
Trains currently require that 90 degree turns are allowed I will work on fixing that in a future version.

It was doing pretty well in a test game started in 1940. By 1975 WormAI was in second place on operating profit after Terron.


Changelog

Version 5, 2016-05-14
  • Add: Train support. Based on SimpleAI but with changes and more to come.
  • Change: Take inflation into account.
  • Change: blacklist towns where we failed to build an airport for a while.
  • Change: Don't remove airports we just built if we don't have money to buy the airplanes. We build them later when we have the money.
  • Change: Don't waste time trying to upgrade airport if there's too much noise.


Attachments:
AI Test 1940 start inflation on, 1975-01-01.png [473.84 KiB]
Not downloaded yet
Top
   
 Post subject: Re: WormAI
PostPosted: Sun May 15, 2016 12:01 pm 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 850
Cool, it's exciting to see code from my AI getting forked :) Although my code is quite a mess, I wrote SimpleAI before I actually started studying programming :P

I'm giving it a test run now, so far it's going really steady.

EDIT: There's one thing I've noticed: the log says that the AI is not building more aircraft because of the aircraft limit, despite the fact that it has only 11 aircraft while the limit is 20. Maybe it reached the limit some time in the past?


Top
   
 Post subject: Re: WormAI
PostPosted: Sun May 15, 2016 4:33 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
Thanks for your comments. There's certainly room for improvements in both what I've done to your code so far as well as the original code :) but all in due time.

I thought I saw something similar to the aircraft limit message but I was thinking it might have to do with airplanes being more expensive than it expects. I will have to take a look at that code again sometime. Did you use a NewGRF for aircraft? If so which one. Airport upgrading also needs some improvements which I'm aware off.


Top
   
 Post subject: Re: WormAI
PostPosted: Sun May 15, 2016 5:17 pm 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 850
No, I wasn't using any aircraft NewGRFs. And I'm positive that the AI had more than plenty of money to buy them :)


Top
   
 Post subject: Re: WormAI
PostPosted: Sun May 15, 2016 6:40 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
Are you sure it didn't say it wasn't going to build more airports instead of aircraft. Because I do have a similar message about not building more airports which it decides based on the max allowed airplanes.


Top
   
 Post subject: Re: WormAI
PostPosted: Mon May 16, 2016 10:19 am 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 850
Uhm, now that you bring it up, I think you're right. I can also confirm it by loading the last autosave, it's not building more airports. It even has 13 aircraft compared to the 11 when I last reported.


Top
   
 Post subject: Re: WormAI
PostPosted: Mon May 16, 2016 1:07 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
Ah good that part is working as expected then.


Top
   
 Post subject: Re: WormAI
PostPosted: Fri May 27, 2016 1:19 am 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Feb 26, 2015 12:52 am
Posts: 149
I finally finished that 1st testing with 15 WormAIs we talked about at IRC. My prediction was that Pink was going to win in profits, but I was wrong. Pink is Company 1. Here are the parameters I used:

WormAI = min_town_size=2000,start_date=1
WormAI = start_date=1
WormAI = max_airport_distance=250,min_airport_distance=25,min_town_size=100,start_date=1
WormAI = max_airport_distance=4000,min_airport_distance=500,min_town_size=10000,start_date=1
WormAI = start_date=1,use_planes=0
WormAI = start_date=1,use_trains=0
WormAI = ai_speed=2,start_date=1
WormAI = ai_speed=1,start_date=1
WormAI = max_airport_distance=400,min_airport_distance=300,start_date=1
WormAI = max_airport_distance=450,min_airport_distance=350,start_date=1
WormAI = max_airport_distance=500,min_airport_distance=400,start_date=1
WormAI = max_airport_distance=600,min_airport_distance=500,start_date=1
WormAI = min_town_size=100,start_date=1
WormAI = min_town_size=1000,start_date=1
WormAI = min_town_size=1500,start_date=1

'openttd.cfg' lists 'none = start_date=1' for the first company, but I started this game in multiplayer, moved myself to spectator, killed my company, configured the 15th WormAI in the free'ed slot with min_town_size of 2000, then went to console and typed 'startai'.

Beware of the savegame, it has over 16000 vehicles, AIs with 250k #ops each, and a map size of 4096x4096!


Attachments:
screenshot#19.png [200.33 KiB]
Not downloaded yet
WormAI #15, 2051-01-01.sav [21.34 MiB]
Downloaded 20 times
openttd.cfg [11.19 KiB]
Downloaded 16 times

_________________
Formerly known as Samu
Top
   
 Post subject: Re: WormAI
PostPosted: Fri May 27, 2016 7:22 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 14, 2013 12:33 pm
Posts: 75
Location: Netherlands
Thanks for the extensive test :)

I think that the min/max distances for WormAI 8-11 were probably chosen a little close together, they perform pretty similar. A larger distance between minimum and maximum might show a bigger difference possibly.

The train only one not doing anything was a bug that I had already fixed. Hopefully I can release a new version soon.
Another bug that's also fixed in the development version is the crash that happened for 2 of the WormAI's when I tried loading the savegame.
For the rest it's nice to see that they managed to reach 2051 without crashing.

Remarkable also that #5 has the highest company value but is only subtop in Operating Profit. Probably related to only using airplanes.
There's ofcourse different ways to look at who's performing best but still an interesting test.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 25 posts ]  Go to page 1 2 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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-2017 phpBB Limited

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