Page 1 of 1
Costum AI's
Posted: 14 Feb 2010 16:03
by nWkobi
hi
is there a way to create costum AI's of my own in OpenTTD?
havent seen a thing abput it, so sorry if it already exists(the topic).
Re: Costum AI's
Posted: 14 Feb 2010 16:07
by Zuu
Please check our FAQ:
http://wiki.openttd.org/NoAI_Forum_FAQ
It is linked to as a sticky in this forum.
Re: Costum AI's
Posted: 14 Feb 2010 16:33
by nWkobi
i have read that, but it didnt answer my question...
Re: Costum AI's
Posted: 14 Feb 2010 16:36
by Alberth
What about question 1.6?
I think it answers your question, since to have your own custom AI, you have to write one.
If that is not what you mean with "create costum AI's of my own", then please explain what you do mean with that phrase?
Re: Costum AI's
Posted: 14 Feb 2010 16:43
by nWkobi
ok i'll try.
what i meant was - is there and add-on that makes it possible to edit /create an AI for the game? something like the scenario editor,maybe.
Re: Costum AI's
Posted: 14 Feb 2010 16:53
by planetmaker
Yes: any text editor of your choice. But I guess that doesn't really qualify as 'add-on'.
Re: Costum AI's
Posted: 14 Feb 2010 17:04
by nWkobi
what do u mean by 'text editor'?
Re: Costum AI's
Posted: 14 Feb 2010 17:09
by CommanderZ
You are obviously missing the fact, that you must program the AI, its not like there is some nice graphical drag and drop editor. The AI is just a piece of program code.
Text editor is any program that can edit text - for example notepad or word.
Re: Costum AI's
Posted: 14 Feb 2010 17:54
by Brumi
I'm developing my AI using plain notepad...
EDIT: corrected ugly grammar mistake
Re: Costum AI's
Posted: 14 Feb 2010 19:22
by Zuu
There is editors like eclipse or vim that can help you a little bit by completing words/code. Though it still comes down to the fact that you need to know programming fairly well (or be very motivated beginner programmer) in order to make an AI. The tools can't help you understand programming, just make programming a bit faster and more convenient.
To take an example, PAXLink is about 5 000 lines of code. Compared to OpenTTD that is not much, but it is still not something you write in an afternoon or two.
Re: Costum AI's
Posted: 15 Feb 2010 10:11
by SummerBulb
Zuu wrote:There is editors like eclipse... that can help you a little bit by completing words/code.
Sorry to intrude, but does anyone knoe why my Eclipse doesn't complete any words and/or indent my code.
Yes, i am using the squirrel plugin.
Thanks,
SummerBulb
Re: Costum AI's
Posted: 15 Feb 2010 11:28
by Zutty
SummerBulb wrote:Zuu wrote:There is editors like eclipse... that can help you a little bit by completing words/code.
Sorry to intrude, but does anyone knoe why my Eclipse doesn't complete any words and/or indent my code.
Yes, i am using the squirrel plugin.
Thanks,
SummerBulb
SQDEV cant complete members from the NoAI API, or from object instances (since Squirrel is not stringly typed).
The only way to have something autocompleted (Ctrl-Space) is if it is a static member of a class defined in your AI, from a static context.
Code: Select all
class Foo {
static memberA = "This is static"
memberB = null
function bar(b) {
this.memberB = b
}
}
local x = Foo()
x.<CTRL-SPACE> <-- Nothing happens
Foo.<CTRL-SPACE> <-- Autocomplete window shows [ memberA, bar() ]
Re: Costum AI's
Posted: 15 Feb 2010 11:59
by SummerBulb
Wow, looks like you know it all.
Thanks.

Re: Costum AI's
Posted: 15 Feb 2010 12:53
by Blustuff
Zutty wrote:SQDEV cant complete members from the NoAI API, or from object instances (since Squirrel is not stringly typed).
The only way to have something autocompleted (Ctrl-Space) is if it is a static member of a class defined in your AI, from a static context.
Even with dynamically typed language, you can do static analysis to discover types and enable auto completion. What you said about static methods is true so you can use some trick to fool SQDev : create some file defining the AI* classes with their static methods and constants. SQDev believe the file is included in the project and then use it to autocomplete.
Re: Costum AI's
Posted: 15 Feb 2010 14:10
by SummerBulb
Blustuff wrote:Zutty wrote:SQDEV cant complete members from the NoAI API, or from object instances (since Squirrel is not stringly typed).
The only way to have something autocompleted (Ctrl-Space) is if it is a static member of a class defined in your AI, from a static context.
Even with dynamically typed language, you can do static analysis to discover types and enable auto completion. What you said about static methods is true so you can use some trick to fool SQDev : create some file defining the AI* classes with their static methods and constants. SQDev believe the file is included in the project and then use it to autocomplete.
That sounds great, but also sounds like A LOT of work.
|wish|i wonder if i could find a file like that somewhere |endwish|
I just might go ahead and do that, in the end...
SummerBulb
Re: Costum AI's
Posted: 15 Feb 2010 14:18
by CommanderZ
If it is has done it yet, you can do it quite easily by copying the vertical lists from the doxygen html help. It still needs some manual cleaning, but it simplifies the work a lot.
Re: Costum AI's
Posted: 15 Feb 2010 14:19
by Blustuff
I did it for some classes, I could upload it. There is still a lot of work to do to complete this file.