NoAI Forum FAQ
NoAI Framework

NoAI Main Page

Development

Development milestones
Suggested API changes

AI Programming

API Documentation
Introduction
info.nut file
main.nut file
Basics
Using the road pathfinder
Using the rail pathfinder
Saving / Loading data
Things you need to know
Squirrel
Home page
Common mistakes
Lists
Coping with OTTD errors
Trams
AI Libraries
Forum
Forum FAQ
AI Behavior
ShortNames in use

AIs

TestAI
WrightAI
Convoy
SimpleAI
Comparison of AIs
See forum
See BaNaNaS
All articles in NoAI category

These are Frequently Asked Questions for the NoAI Forum at http://www.tt-forums.net/viewforum.php?f=65

Contents

NoAI FAQ

(Q) How can I get the old AI back?

(A) You can't in OpenTTD. There are a lot of AIs that work in different ways. You should shop around and see if there is one you like.

(A) The nearest match for the old AI's behavior is probably SimpleAI, an effort at reproducing the old AI's strategy in the new AI framework.

(Q) I don't like any of the new AIs. Can I have the old AI back now?

(A) Sorry, no you still can't. The old AI cheated. A lot. It would terraform for free, ignore the town council's attitude towards a player. The new framework doesn't allow the AI to cheat. It can't do anything you can't do. There are many AIs, some with the express purpose of being good replacements for the old AI. Read on if you want to influence them to be more to your liking.

(Q) What should I do if an AI crashes?

(A) If you want to be helpful, a screenshot of the red text is appreciated. Be sure to get the whole line. The numbers on the right hand side are important. Please make every effort to get the whole line. Post the screenshot in the AI thread corresponding to the crashed AI.

(Q) What should I do if I find a bug in an AI?

(A) Please take a good screenshot of the error and post it to the AI's thread. Try to be clear about what you expected and what you saw. Save games can help sometimes, but in a lot of cases the problem is past and a screenshot is just as good.

(Q) What should I do if I think an AI should do something differently, add a feature, support a newgrf or something like that?

(A) Find the thread and respectfully ask the author to include it. It helps if you make your case with some logic. "Newgrf X is very popular and the AI isn't compatible" is a lot more compelling than "I loaded 15 newgrfs in a strange combination and in my custom scenario the AI goes broke half the time." Remember the developers are essentially volunteers. Please treat them with respect.

(Q) How do I start writing my own AI?

(A) The NoAi section of the Wiki should get you going.

(Q) What if I have questions about how to do something in my AI?

(A) Please feel free to ask on the NoAI board. The other authors will almost always try to help you. They will expect you to take a stab at it and maybe post some code showing what you are trying. Try to ask specific questions.

(Q) How do I propose changes to the NoAI API?

(A) There is a thread for that discussion. Please read the entire thread before posting "new" ideas that are already in there.

(Q) My AI needs a math function or something else added to Squirrel in order to work?

(A) Refer to the API Ideas thread. There is quite a bit of discussion in there about that topic.

(Q) Can I add a penalty for level crossings in the library pathfinder?

(A) Yes. Fanioz has a method.

(Q) I have a question not on this list, should I just ask it here?

(A) Please search the forums first. Spend at least 10-15 minutes searching. When you ask your questions include any searches you tried. Otherwise you are likely to get a terse response to search.

(Q) I posted a question and didn't get (a good) answer, what do I do?

(A) Make sure your question is answerable. Broad questions like "Does anyone know how to buy an engine?" don't get as much traction as questions like "Why doesn't this code snippet result in an engine getting purchased?". Make sure your question is in the right thread. Saying "This AI should support passengers," in an AI thread is better than asking "Why don't more AIs support passengers," in a general thread.

(Q) My AI gives the error "couldn't detect real instance of class for non-static call" when I try to extend a list, what did I do wrong?

(A) You forget to call the constructor of the parent class. Add in your constructor a call to it.