Page 1 of 15

AIAI

Posted: 19 Feb 2010 19:35
by Kogut
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

Re: AIAI pre-alpha 0 version

Posted: 19 Feb 2010 19:36
by Kogut
...

Re: AIAI pre-alpha 0 version

Posted: 19 Feb 2010 19:47
by planetmaker
Nice view. I tried to give it a shot (no newgrfs, temperate climate):

Re: AIAI pre-alpha 0 version

Posted: 19 Feb 2010 19:49
by Kogut
I uploaded incorrect version. :cry:
Now it should works.
Thanks for bug report!

Re: AIAI pre-alpha 0 version

Posted: 21 Feb 2010 19:04
by Brumi
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!

Re: AIAI alpha version

Posted: 22 Feb 2010 19:23
by Kogut
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

Re: AIAI alpha version

Posted: 27 Feb 2010 08:41
by Steffl
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)+" ";

Re: AIAI alpha version

Posted: 27 Feb 2010 10:09
by Kogut
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

Re: AIAI alpha version

Posted: 16 Mar 2010 14:02
by Kogut
New version of AIAI!

- Planes (support for air newgrfs)
- Kind of support for ECS
- Bugfixes (thx Steffl)
- Better menagement
- Now ai (should) replace vehicles

Re: AIAI alpha version

Posted: 16 Mar 2010 15:09
by Brumi
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.

Re: AIAI alpha version

Posted: 16 Mar 2010 15:24
by Kogut
Airport capacity still have flaws to find (sometimes capacity control is ignored). I am working on it.

Re: AIAI beta version

Posted: 16 Mar 2010 18:12
by Kogut
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

Re: AIAI beta4 version

Posted: 27 Mar 2010 14:25
by Kogut
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

Re: AIAI beta4 version

Posted: 03 Apr 2010 12:53
by Steffl
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.

Re: AIAI beta4 version

Posted: 03 Apr 2010 13:07
by Kogut
Thanks! It happens when industry is closed during looping over industry list.

............................................................

Posted: 03 Apr 2010 15:39
by Kogut
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?

Re: AIAI beta4 version

Posted: 03 Apr 2010 15:46
by Zuu
<openttd dir>/ai/AIAI/info.nut

Where the openttd dir can be either the installation dir or OpenTTD in your documents etc.

Re: AIAI gamma version

Posted: 03 Apr 2010 17:32
by Kogut
Aaargh
Know problem - factory servised both by truck and plane

Bugfix - plane connection to industry without production.

Re: AIAI gamma1 version

Posted: 08 Apr 2010 17:45
by Morloth
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

Re: AIAI gamma1 version

Posted: 08 Apr 2010 17:55
by Lord Aro
Whoa!
An AI that beats NoCAB? (i've never tried Rondje OK?)
This is going to be some fearsome AI...
Good Luck! :mrgreen: