robotAI (v1.1 released)

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

Post Reply
User avatar
yorg
Engineer
Engineer
Posts: 18
Joined: 19 May 2008 21:48
Location: Peterborough, Ontario

robotAI (v1.1 released)

Post by yorg »

Hi all

I've been working on an AI for a little while now. It's nothing amazing but it's functional enough that I thought I'd post it, to see how it does in a tournament and just for the sake of sharing it.

robotAI is a freight-only AI at least for the time being. It attempts to connect every industry on the map by road, except those that go to towns. I ran it for 10 years on a 256x256 map, it achieved a company value of 4.3 million GBP, (image attached) although I think the game was on easy difficulty and I increased the number of road vehicles allowed.

There's nothing all that fancy going on under the hood at the moment.
Planned for version 1.1:
- improved station site-finding, including checking for existing stations
- adding new station buildings to existing stations that are backlogged
- improved financial management, ie something beyond just maxing out the loan and spending it all
- improved cargo selection method
- improved error handling, if neccessary
- handling of unprofitable vehicles

In version 1.2 I plan to add the ability to ship cargos that go to towns, plus whatever comes to mind while I'm working on the changes outlined above.

robotAI is released under the GNU GPL; feel free to do whatever you want with it or any part of it as long as you give proper credit. For my own part I used some of the code from the wiki. I also looked at the code of Convoy and WrightAI to get my bearings in this project. I don't think I used any code from either AI, but thanks to GeekToo and the NoAI development team is due - and if you see anything of yours in my code that I forgot I used, let me know and I'll add the proper acknowledgment.

Please let me know what you think of robotAI - any comments or suggestions, be it about coding style, the strategy the AI uses, bug reports, or anything else, are more than welcome.

Cheers,
yorg
Attachments
robotAI.png
robotAI.png (28.73 KiB) Viewed 568 times
robotAI.tar
robotAI v1
(30 KiB) Downloaded 198 times
Last edited by yorg on 27 Jul 2008 01:18, edited 1 time in total.
User avatar
Zhall
Tycoon
Tycoon
Posts: 1237
Joined: 17 Jul 2007 01:36
Skype: moonray_zdo
Location: Teh matrix, duh.
Contact:

Re: robotAI

Post by Zhall »

Does it create anti terrorist roads to protect its 742 vechicles?
User avatar
yorg
Engineer
Engineer
Posts: 18
Joined: 19 May 2008 21:48
Location: Peterborough, Ontario

Re: robotAI (v1.1 released)

Post by yorg »

announcing the release of robotAI v1.1.

the main reason for this release is to reflect the API change regarding adjecent stations in r13751. i would've taken more time to get this version polished up, that change was a good kick in the rear to finish the changes i had started.

changes from v1:

- lots of changes to how stations are built - now expands existing stations instead of building new ones when possible, and it will build new station buildings to deal with routes with lots of vehicles
- also will demolish the station buildings for a route that is not build successfully, which seems to be the difference between life and death on the 'i am a b**** 2' map
- checks for unprofitable vehicles, which are sold if found
- loan management - now repays loans whenever it spends money
- maintains groups for its vehicles, mostly for the benefit of figuring out what it's talking about in the debug window
- a couple o' bug fixes

planned for v1.2:
- ability to ship goods, passengers, main, and other town-destined cargos.
- support for the new Save() and Load() functions, in some capacity
- support for GetSettings() and all the fun stuff that allows

as always any comments are welcome, especially bug reports and the like.

one bug i have not been able to squash and would be very grateful for: in main.nut somewhere after line 200 something is going wrong with the process to chose a destination for cargo... on occasion it is choosing industries that don't exist, which is of course not desirable. Anyone who can point me in the direction of a solution to that problem will have my gratitude.

a bit of perversity: because this version is far more effective at preventing backlogged vehicles (but still by no means perfect) it often requires fewer vehicles to maintain a decent station rating. this means that its performance measured company value may be worse than version 1's, even though by other standards is doing better. i thought that was kinda funny

anyways, hope you enjoy
cheers,
yorg
Attachments
robotAI.tar
robotAI v1.1
(60 KiB) Downloaded 142 times
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: Google [Bot] and 19 guests