NoAI Branch - An AI Framework

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

Locked
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

NoAI Branch - An AI Framework

Post by TrueBrain »

Dear AI freaks,

Today we started out with a new branch: NoAI. In this branch we will develop an AI framework that is available to everyone. We think the main reason why developing AIs is really hard in the current code, because you need to do so much core-stuff yourself. There isn't just a simple command to build roads, or to query this or that. So to make it all a bit easier for an AI creator, we are creating a thin layer in between. This layer supplies easy functions. With those, you should be able to build a good AI rather quick and in a clean way.

Besides that, we will be adding Squirrel support, a very lightweighted language that can be embed into OpenTTD and allows classes. This btw is not open for debate. Just so you know ;)

As we started out today, don't expect anything real for the next few days/weeks. In this thread we will keep you posted with progress. Feel free to give tips/suggestions/ideas, just remember that we already defined the idea pretty well. So please keep you tips/suggestions/ideas strictly to the current code.

When the code is good enough for users to start working on their own AI, we will release binaries via the compile-farm by then.

Till that time, I wish you much fun!

[Update 14 March 2007]

Today we finished up the Squirrel module, the language in which you can also write AIs. It is very similar to C++. It looks very promising so far. The first functions are also added, the AI can now take a loan and give his company a name. The rest of the week we take to add more functionality so it can at least do something. From that point on we will start giving you guys more concrete information like API documentation and more of that. Stay tuned!

[Update 16 March 2007]

After some initial problems and redoing some parts of the code, we are now finally at the stage that it all seems to work. Where we had initial the idea to run the function GameLoop every tick, we now run the function Start one time, and then your AI is just like a stand-alone application. Via Sleep() calls you can give control back to the main OpenTTD application. Any command that does changing (so not querying) does it automatically, to make the AI a bit fair, and allow multiplayer games.

Now this all must sound really interesting to you (not :p), it comes down to: the interface is done, and the API is building up as we speak. So far we are really happy with the design, and we are sure you will be able to create your own AI really soon :)

[Update 18 March 2007]

As progress continues, we wanted to inform you that documentation is getting there. Check http://wiki.openttd.org/index.php/AI:Main_Page if you can't wait. Binaries will be produced as soon as win32 compatibility is restored (currently it aint broken, just not fully done ;)). So... almost there :)

[Update 24 March 2007]

Win32 support is now done. The API for making road AIs is done. Or anyway, the basics are. So, you should be able to start with your first AI. Of course important parts like pathfinders and simple tilelist filters are missing, which will be added in the next few weeks. But, the basics are there. So, if you like, download the upcoming binaries (should be there this week), and start building your AI. Report any problems here. Also if you have function requests feel free to post them. Just remind yourself that we might not agree, or already plan to do that. Have fun!

[Update 26 March 2007]

And finally it is there: binaries! You can get them here:

http://nightly.openttd.org/noai/scoreboard.php

It gives you a pretty nice set of API functions. Although you won't be able to do anything fancy with it, you can at least make primitive bus-routes. Soon more and more functions will be added, but this at least should get your on your way. If you detect any problems/errors/bugs, feel free to tell us about it! Have fun writing your own AI :)

[Update 4 May 2007]

As progress continued on a pretty nice rate, we didn't update this topic that often. If you want to read more about the progress, I suggest to follow http://devs.openttd.org/~truelight/blog/?cat=3

[Update 19 October 2007]

We might seem dead, but for sure we aren't. Because of lack of time and enthusiasm of the community, progress staled. Nevertheless, the current code is stable, and does allow you to make some pretty nice AIs. Lucky enough, slowly we see some enthusiasm coming up, which might just kickstart the progress again ;)

[After 19 October 2007]

We started to use the blog (http://blog.openttd.org) to keep track of NoAI updates, instead of updating this topic. Please go there to check the latest development. The NoAI branch is very much alive.
Last edited by TrueBrain on 04 May 2007 20:32, edited 6 times in total.
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
minime
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 18 Jan 2004 10:02
Skype: dan.masek
Location: Prague, Czech Republic
Contact:

Re: NoAI Branch - An AI Framework

Post by minime »

TrueLight wrote:new branch: NoAI. In this branch we will develop an AI framework that is available to everyone.
Isn't the naming of this branch a little counterintuitive, tho? When I first saw it, I thought the point of this branch was to remove any trace of AI from the game, not to create a toolkit/framework for it as something like "AItk" or "AIFW" would suggest.

Just my 2 cents,
minime
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. --Albert Einstein
Image Image Image
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoAI Branch - An AI Framework

Post by TrueBrain »

minime wrote:
TrueLight wrote:new branch: NoAI. In this branch we will develop an AI framework that is available to everyone.
Isn't the naming of this branch a little counterintuitive, tho? When I first saw it, I thought the point of this branch was to remove any trace of AI from the game, not to create a toolkit/framework for it as something like "AItk" or "AIFW" would suggest.

Just my 2 cents,
minime
A bit of irony is good for the general health :) Finding working names is one of the harder parts of coding :)
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

Finaly somewhere I can continue working on my Leviathan AI after openttd.gpmi kind of died. And the good part is, I was still doubting wether I should grab an extra copy of the OTTD source and start developing a new AI or not, I have now made my decision ;).
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
User avatar
imaginner
Engineer
Engineer
Posts: 62
Joined: 19 Nov 2006 07:38
Location: Poland
Contact:

Post by imaginner »

W00t! Waiting eagerly for first impressions!
How can I contribute?

Do you also plan on developing an mp ai? (one that can play on remote servers?)
Code needs love, like everything else.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

imaginner wrote:(..)
Do you also plan on developing an mp ai? (one that can play on remote servers?)
In fact I have a patch for that for the longest time ;) So yes, that will be possible!
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
imaginner
Engineer
Engineer
Posts: 62
Joined: 19 Nov 2006 07:38
Location: Poland
Contact:

Post by imaginner »

Sweet! Seems that some serious work would be going on here!
Code needs love, like everything else.
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7595
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

Will this be coming to trunk with a few default AIs to show off the limits?
Image
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

Born Acorn wrote:Will this be coming to trunk with a few default AIs to show off the limits?
Of course the idea is that in the end it will be merged with the trunk. But, there is a long road ahead of us before it is ready.
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
antichaos
Engineer
Engineer
Posts: 42
Joined: 13 Feb 2007 21:51
Location: UK

Post by antichaos »

Will it be possible to have different companies run by different AIs in the same game? It would be great for people to be able to pit their AIs against each other.
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7595
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

We could place bets on them and make millions! :p
Image
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

antichaos wrote:Will it be possible to have different companies run by different AIs in the same game? It would be great for people to be able to pit their AIs against each other.
It will be possible. Bot-wars will be there.
The only thing necessary for the triumph of evil is for good men to do nothing.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Post by Rubidium »

TrueLight wrote:It will be possible. Bot-wars will be there.
Then we can make a competition for inclusion of the bots into a release, just like the scenarios. The criteria would then contain things like the way the tracks of the AI look, the way amount of damage to the surroundings, profitability etc :)
User avatar
minime
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 18 Jan 2004 10:02
Skype: dan.masek
Location: Prague, Czech Republic
Contact:

Re: NoAI Branch - An AI Framework

Post by minime »

TrueLight wrote:Finding working names is one of the harder parts of coding :)
:? Yeah, tell me about it.

Name aside, it's a good idea to address this long neglected area of development and I think it's bound to open up a lot of new options for the game. I'll definitely keep track of this project.

minime
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. --Albert Einstein
Image Image Image
Slickwik
Engineer
Engineer
Posts: 12
Joined: 12 Mar 2007 06:07

Re: NoAI Branch - An AI Framework

Post by Slickwik »

TrueLight wrote:Dear AI freaks,

Today we started out with a new branch: NoAI. In this branch we will develop an AI framework that is available to everyone. We think the main reason why developing AIs is really hard in the current code, because you need to do so much core-stuff yourself. There isn't just a simple command to build roads, or to query this or that. So to make it all a bit easier for an AI creator, we are creating a thin layer in between. This layer supplies easy functions. With those, you should be able to build a good AI rather quick and in a clean way.

Besides that, we will be adding Squirrel support, a very lightweighted language that can be embed into OpenTTD and allows classes. This btw is not open for debate. Just so you know ;)

As we started out today, don't expect anything real for the next few days/weeks. In this thread we will keep you posted with progress. Feel free to give tips/suggestions/ideas, just remember that we already defined the idea pretty well. So please keep you tips/suggestions/ideas strictly to the current code.

When the code is good enough for users to start working on their own AI, we will release binaries via the compile-farm by then.

Till that time, I wish you much fun!
I buy you beer (if the post man don't drink it)!!!
User avatar
brupje
Transport Coordinator
Transport Coordinator
Posts: 288
Joined: 03 Oct 2006 07:17
Location: The hague, Netherlands

Post by brupje »

I couldn't find anything on the wiki on this subject. But is there a design available for review?
User avatar
PouncingAnt
Transport Coordinator
Transport Coordinator
Posts: 357
Joined: 09 Nov 2004 22:33

Post by PouncingAnt »

Well, if there is going to be more support for AI programming, I'm definately up for doing some! I love AI. I just cant get my head round the code as it stands. Kudos to what you're doing, guys, it's far beyond anything I've attempted so far!
NB: the below challenges are still open for submission, so feel free to perform necromancy on them!
Try the PouncingAnt National Monopoly Challenge
Or even better, the PouncingAnt National Monopoly Challenge 2
Or better still, the PouncingAnt National Monopoly Challenge 3
Or, the PouncingAnt National Monopoly Challenge 4

Or try my scenario instead!

-(A lazy) OpenTTD Japanese Translator-
-(A lazy) PNGcodec user-
"You get what you pay for, so pay attention!"

Patches:
Company Station Stats
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

brupje wrote:I couldn't find anything on the wiki on this subject. But is there a design available for review?
Currently we are in the stage to proof our concept. By the looks of it, that will be done today or tomorrow. When it is done, we will start to publish documentation. So just hold on tight a little bit longer :)
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
imaginner
Engineer
Engineer
Posts: 62
Joined: 19 Nov 2006 07:38
Location: Poland
Contact:

Post by imaginner »

Eagerly waiting, then :)
Code needs love, like everything else.
User avatar
Ailure
Route Supervisor
Route Supervisor
Posts: 435
Joined: 26 Apr 2005 19:06
Location: Sweden

Post by Ailure »

Any reason that it uses Squirrel as scripting though? Not that I mind the decision, I just never heard about that script-language.

Thought from what I see on Wikipedia, it's very C-like and should be quite easy to learn for most people working with C-like language. And it have brackets. (Which is very important for me. ;)

It's exciting, as I always wanted to do my own AI but was kinda afraid to dig into the openTTD source just to get started. I also hope the AI will be developed to be MP safe. (though that might open up a need to have more than eight company slots ;))
Locked

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: CTarana45 and 20 guests