AIAI
Moderator: OpenTTD Developers
AIAI
Here is my attempt to write an AI. It is intended to be both challenging and produce nice looking infrastructure. I also plan to make it working with all possible settings and add support for all "normal" newgrfs - for now it should work with all newgrfs from bananas.
Done:
full save load support
support for eGRVTS, HEQS, NARS, 2cc etc
support for FIRS, ECS etc
full RV support
freight train support
plane support
uses all cargoes (except mail, tourists)
newtrack support
code and bug tracker resides at https://github.com/matkoniecz/AIAI
Done:
full save load support
support for eGRVTS, HEQS, NARS, 2cc etc
support for FIRS, ECS etc
full RV support
freight train support
plane support
uses all cargoes (except mail, tourists)
newtrack support
code and bug tracker resides at https://github.com/matkoniecz/AIAI
- Attachments
-
- support for FIRS and eGRVTS.PNG (38.88 KiB) Viewed 70791 times
-
- Now with trains!.png (140.29 KiB) Viewed 64909 times
Last edited by Kogut on 21 Sep 2016 19:08, edited 72 times in total.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI pre-alpha 0 version
...
- Attachments
-
- support for HEQS.PNG (21.81 KiB) Viewed 70789 times
-
- av8 support.PNG (56.3 KiB) Viewed 70377 times
-
- basic ECS vectors support.PNG (71.87 KiB) Viewed 70377 times
Last edited by Kogut on 16 Mar 2010 14:04, edited 1 time in total.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: AIAI pre-alpha 0 version
Nice view. I tried to give it a shot (no newgrfs, temperate climate):
- Attachments
-
- AIAI crash
- Neu Hahnmünster Transport, 13-02-1975.png (33.49 KiB) Viewed 70787 times
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
Re: AIAI pre-alpha 0 version
I uploaded incorrect version.
Now it should works.
Thanks for bug report!

Now it should works.
Thanks for bug report!
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI pre-alpha 0 version
Good work!
In my first test, your AI is working fine, it is incredibly fast
Keep it up, it's nice to see a new AI!

In my first test, your AI is working fine, it is incredibly fast

Keep it up, it's nice to see a new AI!
Re: AIAI alpha version
Version alpha uploaded
New
limit of RV in one route
useless vehicles are sold
better error handling
improvement of road pathfinder (from SimpleAI)
fixed crash when no suitable RV are available
fixed bugs
better secondary cargo handlig (conditional orders)
money menagement
New
limit of RV in one route
useless vehicles are sold
better error handling
improvement of road pathfinder (from SimpleAI)
fixed crash when no suitable RV are available
fixed bugs
better secondary cargo handlig (conditional orders)
money menagement
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI alpha version
I'm really liking your AI. It plays really very fast and good, even it is only a alpha version.
It remembers me a little to the Pathzilla AI, which is one of my favourite AI's.
But unfortunenally I have to report a little bug, which I don't know why it happened.
Keep on working. Nice greetings.
Edit:
I have an idea to fix the problem. You just have to change line 352 of main.nut to:
local name=AIVehicle.GetName(car)+" ";
It remembers me a little to the Pathzilla AI, which is one of my favourite AI's.
But unfortunenally I have to report a little bug, which I don't know why it happened.
Keep on working. Nice greetings.
Edit:
I have an idea to fix the problem. You just have to change line 352 of main.nut to:
local name=AIVehicle.GetName(car)+" ";
- Attachments
-
- Baker & Co., 22. Sep 1947.png (10.75 KiB) Viewed 16678 times
Re: AIAI alpha version
Thanks for bug report and good opinion about ai.
The main problem was that vehicleID was valid in RenevRV function (when AI created vehicle list in 413 line) but RV was destroyed before executing of CzyNaSprzedaz function. In result vehicle become invalid and program crashed. I must check what happen when Noai API get it: AIVehicle.Sth(invalid_vehicle).
Edit:
local name=AIVehicle.GetName(car)+" "+" "+" "+" "+" "+" "; //it may work, but i must check what getname return when performed on illegal vehicle
The main problem was that vehicleID was valid in RenevRV function (when AI created vehicle list in 413 line) but RV was destroyed before executing of CzyNaSprzedaz function. In result vehicle become invalid and program crashed. I must check what happen when Noai API get it: AIVehicle.Sth(invalid_vehicle).
Edit:
local name=AIVehicle.GetName(car)+" "+" "+" "+" "+" "+" "; //it may work, but i must check what getname return when performed on illegal vehicle
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI alpha version
New version of AIAI!
- Planes (support for air newgrfs)
- Kind of support for ECS
- Bugfixes (thx Steffl)
- Better menagement
- Now ai (should) replace vehicles
- Planes (support for air newgrfs)
- Kind of support for ECS
- Bugfixes (thx Steffl)
- Better menagement
- Now ai (should) replace vehicles
- Attachments
-
- aiai_beta.tar
- (94 KiB) Downloaded 2825 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI alpha version
Nice work!
It's still one of the fastest AIs of all time, it was working fine in my test, it reached the vehicle limits in a matter of years...
I have one little problem: airports are sometimes overworked, there were 14 planes using one small airport, for example. Apart from that, it was doing very well.

It's still one of the fastest AIs of all time, it was working fine in my test, it reached the vehicle limits in a matter of years...
I have one little problem: airports are sometimes overworked, there were 14 planes using one small airport, for example. Apart from that, it was doing very well.
Re: AIAI alpha version
Airport capacity still have flaws to find (sometimes capacity control is ignored). I am working on it.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI beta version
Fixed:
EDIT Another bug fixed, new version uploaded
EDIT
known problems
- stupid plane behaviour on very large maps (too big distances between airports)
- sometimes ai try to build aircrafts when limit is reached
EDIT Another bug fixed, new version uploaded
EDIT
known problems
- stupid plane behaviour on very large maps (too big distances between airports)
- sometimes ai try to build aircrafts when limit is reached
- Attachments
-
- aiai_beta3.tar
- (96.5 KiB) Downloaded 2540 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI beta4 version
New feature: shameless copy - paste from cluelessplus (replacing level crossing with bridge)
Fixed known probles, new problems are known:
n^2 is bad idea when n may be 5k (n = AIIndustryList().Count() ) In other words - searching for best industry on large maps is very, very slow.
solution: change to amortized contant time (200)
long bridges sometimes are unavailable!
very high rotation of vehicles
Fixed known probles, new problems are known:
n^2 is bad idea when n may be 5k (n = AIIndustryList().Count() ) In other words - searching for best industry on large maps is very, very slow.
solution: change to amortized contant time (200)
long bridges sometimes are unavailable!
very high rotation of vehicles
- Attachments
-
- aiai_beta4.tar
- (113.5 KiB) Downloaded 3056 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI beta4 version
I found some little bug again in your AI again. But I'm sure you can handle it easily 
PS.: I try to make a AI too (ok, it's not really mine), but it can hardly compete with your AI. Only sometimes it is a little bit better. But in most cases your AI wins.

PS.: I try to make a AI too (ok, it's not really mine), but it can hardly compete with your AI. Only sometimes it is a little bit better. But in most cases your AI wins.
Re: AIAI beta4 version
Thanks! It happens when industry is closed during looping over industry list.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
............................................................
All known problems fixed (including bug reported by Steffl)!
This is gamma version/first bananas candidate.
So I wait for next bug reports.
The biggest new feature: industry to city routes.
And one small question. I keep aiai in content_download folder. Where it should be to avoid overwrittion by Bananas?
This is gamma version/first bananas candidate.
So I wait for next bug reports.
The biggest new feature: industry to city routes.
And one small question. I keep aiai in content_download folder. Where it should be to avoid overwrittion by Bananas?
- Attachments
-
- Przechwytywanie.PNG (82.16 KiB) Viewed 69996 times
-
- aiai_gamma.tar
- (123.5 KiB) Downloaded 2552 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI beta4 version
<openttd dir>/ai/AIAI/info.nut
Where the openttd dir can be either the installation dir or OpenTTD in your documents etc.
Where the openttd dir can be either the installation dir or OpenTTD in your documents etc.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: AIAI gamma version
Aaargh
Know problem - factory servised both by truck and plane
Bugfix - plane connection to industry without production.
Know problem - factory servised both by truck and plane
Bugfix - plane connection to industry without production.
- Attachments
-
- aiai_gamma1.tar
- (123.5 KiB) Downloaded 3093 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: AIAI gamma1 version
Hey Kogut,
Congratulations with your AI, I just took it for a test run and it performs really well! I did 2 quick runs I did with it it beated NoCAB fair and square
. It was quite a nice match to see, NoCAB took the initiative while your AI was able to catch up after 10-15 years and took the lead after that. Seems that your strategy to look for the best industries and connect those pays off, from what I gleaned from the games played NoCAB spends way too much time planning and thinking while AIAI builds and takes the lead as it is really fast.
Later in the game NoCAB did manage to crawl closer to your AI as better trains became available and it replaced all its small airfields with larger ones, but never close enough to surpass yours (at least not before 1985 after which time I had to quit).
Well done and I'm looking forward to your final AI! In the meantime I'll use this one to benchmark my own
.
- Bram
Congratulations with your AI, I just took it for a test run and it performs really well! I did 2 quick runs I did with it it beated NoCAB fair and square

Later in the game NoCAB did manage to crawl closer to your AI as better trains became available and it replaced all its small airfields with larger ones, but never close enough to surpass yours (at least not before 1985 after which time I had to quit).
Well done and I'm looking forward to your final AI! In the meantime I'll use this one to benchmark my own

- Bram
Re: AIAI gamma1 version
Whoa!
An AI that beats NoCAB? (i've never tried Rondje OK?)
This is going to be some fearsome AI...
Good Luck!
An AI that beats NoCAB? (i've never tried Rondje OK?)
This is going to be some fearsome AI...
Good Luck!

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
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
Who is online
Users browsing this forum: No registered users and 12 guests