1) NoAI AIs that I've tested so far lag heavily. I have to create the save in 0.6.3 and play in nightly to get rid of that awful lag.
2) Not every average player is interested in scripting.

Moderator: OpenTTD Developers
1) You can change the setting "Competitors" > "Computer Players" > "#opcodes before AI is suspended" to improve performancemaxorator wrote:I think there should be an option to use built-in AI (nightlies) for two reasons:
1) NoAI AIs that I've tested so far lag heavily. I have to create the save in 0.6.3 and play in nightly to get rid of that awful lag.
2) Not every average player is interested in scripting.
How does it handle my 0.6.3 saves properly then?Yexo wrote:3) There is no built-in AI anymore.
If AI fails to update once per frame and needs to be halted, then the system is a no-no in my opinion.Zutty wrote:1) You can change the setting "Competitors" > "Computer Players" > "#opcodes before AI is suspended" to improve performancemaxorator wrote: 1) NoAI AIs that I've tested so far lag heavily. I have to create the save in 0.6.3 and play in nightly to get rid of that awful lag.
I guess the AI does nothing, it just runs what was build before.maxorator wrote:How does it handle my 0.6.3 saves properly then?Yexo wrote:3) There is no built-in AI anymore.
A random AI is loadedto take the place of the original AI.maxorator wrote:How does it handle my 0.6.3 saves properly then?Yexo wrote:3) There is no built-in AI anymore.
Are you sure you know what you're talking about?Why should the AI call some suspend function eveytime if it can be halted by openttd instead? It makes sure an AI can't cause openttd to halt and it takes away the difficulty of deciding when to stop from the AIs.If AI fails to update once per frame and needs to be halted, then the system is a no-no in my opinion.Zutty wrote:1) You can change the setting "Competitors" > "Computer Players" > "#opcodes before AI is suspended" to improve performancemaxorator wrote: 1) NoAI AIs that I've tested so far lag heavily. I have to create the save in 0.6.3 and play in nightly to get rid of that awful lag.
If AI cycle is infinite, that means there is an infinite loop. In that case, the loop part of it can simply be removed to get one frame's code. You see, there's actually LESS code involved (unless AI runs in many threads).Yexo wrote:Are you sure you know what you're talking about?Why should the AI call some suspend function eveytime if it can be halted by openttd instead? It makes sure an AI can't cause openttd to halt and it takes away the difficulty of deciding when to stop from the AIs.If AI fails to update once per frame and needs to be halted, then the system is a no-no in my opinion.Zutty wrote:1) You can change the setting "Competitors" > "Computer Players" > "#opcodes before AI is suspended" to improve performance
Yes, the AIs run in an infinite loop. That does not mean that you can simply remove the outer loop to just run one "frame". Actually, you could, but you don't want that, because "frame" can sometimes take as long as one in-game year. Now image you want to do the same in one tick, see why it doesn't work?maxorator wrote:If AI cycle is infinite, that means there is an infinite loop. In that case, the loop part of it can simply be removed to get one frame's code. You see, there's actually LESS code involved (unless AI runs in many threads).
What built-in AI? There is none anymore.And why can't there be an option to use built-in AI?
In that case it either uses sleep functions (which are less efficient than timer checks) or is very badly written.Yexo wrote:Yes, the AIs run in an infinite loop. That does not mean that you can simply remove the outer loop to just run one "frame". Actually, you could, but you don't want that, because "frame" can sometimes take as long as one in-game year. Now image you want to do the same in one tick, see why it doesn't work?maxorator wrote:If AI cycle is infinite, that means there is an infinite loop. In that case, the loop part of it can simply be removed to get one frame's code. You see, there's actually LESS code involved (unless AI runs in many threads).
The one that can be easily copied back in.Yexo wrote:What built-in AI? There is none anymore.And why can't there be an option to use built-in AI?
Am I right you're saying "Sleep functions are less efficient than timer checks"? If so, the current code should be kept.maxorator wrote:In that case it either uses sleep functions (which are less efficient than timer checks) or is very badly written.Yexo wrote:...
Yes, the AIs run in an infinite loop. That does not mean that you can simply remove the outer loop to just run one "frame". Actually, you could, but you don't want that, because "frame" can sometimes take as long as one in-game year. Now image you want to do the same in one tick, see why it doesn't work?
1) It can't be "easily" copied back in.The one that can be easily copied back in.Yexo wrote:What built-in AI? There is none anymore.And why can't there be an option to use built-in AI?
By timer checks I mean something like this:Yexo wrote:Am I right you're saying "Sleep functions are less efficient than timer checks"? If so, the current code should be kept.
Code: Select all
if(dwLastThing1Check+THING1_FREQUENCY < dwTimer){
dwLastThing1Check=dwTimer;
/* something here */
}
if(dwLastThing2Check+THING2_FREQUENCY < dwTimer){
dwLastThing2Check=dwTimer;
/* something here */
}
/* etc, note that this is one frame and frames of this type
are supposed to execute in microseconds (rather than a game-year) */
Thanks for an idea. You just reminded me I can take a scripting AI, rewrite it in C, add it to the code and compile. Problem solved... almost - I have to do this every time I download the new nightly code.Yexo wrote:1) It can't be "easily" copied back in.
2) Why should the old, stupid AI be integrated in the code when there is a working framework with several AIs that are a lot better then the old AI?
I'm telling you it would be nice to be able to choose between them. NoAI is great, but I like hardcoded AI more. Why not just add a "Original" to the list of AIs and if that is used, then it uses built-in AI?Roujin wrote:...eh?
Are you trying to tell us that you think the NoAI framework is done in a bad way and it would be faster to just hardcode the AI into the C(++) code than like how it's done currently?
Sorry to be blunt: Are you're aware that you don't talk much sense? If you really want to make improvement proposals I strongly suggest to make yourself familiar with the current implementation, the previous implementation, their pros and cons and the arguments for the change you see. But then you won't see the need for the old AI anymore, I guess...maxorator wrote:If AI cycle is infinite, that means there is an infinite loop. In that case, the loop part of it can simply be removed to get one frame's code. You see, there's actually LESS code involved (unless AI runs in many threads).
What's the difference to getting one AI from the content download and use that? They're far superior to the old AI - and there's nothing which a PC cannot handle (no, I don't have gaming PCs, I only have usual office PCs with average CPUs). Have you actually tested it?!And why can't there be an option to use built-in AI? Tell me at least one downside (let's assume the AI is well coded).
You clearly have no idea how OpenTTD works and behaves, let alone how NoAI is implemented and how it is operated, let alone how the AI worked, and how it was hooked into the system. So before you start saying any other wrong (read: stupid) things, I suggest you first make yourself known with OpenTTD inner works. After that, I strongly suggest that you start asking things in a nice way, like we all do, and not just open that big mouth and start shouting all kinds of (strange) things. In general it is better to ask like: how did the old AI work? How does the NoAI framework work? Instead of saying: THIS IS ALL WRONG AND I KNOW HOW IT SHOULD BE DONE BETTER. We have enough of those people around here, and they rarely contribute anything sane to the progress of OpenTTD. So please, for everyones sake, first read up on how things worked, how things work, and how things might be improved, before talking any more. Also it might be a good idea to read up on the developement of NoAI (see wiki), to read why some decisions were made. And please, don't think like: because application A, which I happen to have written, works like plan D, OpenTTD for sure works like that plan too. Please please first make yourself known with the code you are making assumptions on. It is not the first day on the job for us too, and it might suprise you, but we did think about aspects of the game. NoAI is no exception to that.maxorator wrote:(..)
I'm telling you it would be nice to be able to choose between them. NoAI is great, but I like hardcoded AI more. Why not just add a "Original" to the list of AIs and if that is used, then it uses built-in AI?
(..)
It might not be the best stylemaxorator wrote:I agree I don't know really anything about how NoAI operates. All my assumptions were made following the claims of the previous poster. I did not mean to ask in a impolite manner, I am just used to saying what's on my mind and if I am wrong, then someone will correct me (learning by making harmless mistakes). That's just my style.![]()
Feel free; just know that 'ways' around such things break when you talk cross-platform (which OpenTTD does); see below.maxorator wrote: The reason I don't like using NoAI could be either that I've never liked scripting languages or emulated stuff and I always try to find a way around using them.
And in which world do you think using a 'hardcoded' AI solves that problem? I am very sure that if someone would make a stupid AI like the old AI in Squirrel, it wouldn't 'lag' either. Just the new AIs are much more advanced and do much more pre-calculations before building anything. This has a penalty, of course. But I think most of the lag comes from the fact your CPU is a bit out-datedmaxorator wrote: IMO lagging is the one unforgivable thing a game can do - I got a 1sec lag once in every 4-5 seconds when I had 2 NoAI companies on a 256x256 map and the opcode limit was 10000 - assuming a line of code is about 1-5 opcodes and I have to cut that limit down maybe to 800-1000, I'd prefer using a hardcoded AI.
If you would have read the AI:Main_Page you would have seen a topic which states C++ support for the NoAI framework is removed. Clearly we once had C++ support. This was removed for reasons stated in that page, but because you might be lazy, the summary: C++ support was removed because after a few months it turned out that only one person attempted to use the C++ part of the NoAI framework. He also very much failed to share his code with others, as it means that either the person he shared it with had to know how to compile OpenTTD on its own (which 95% of our users don't), or the AI creator had to make a pre-compiled binary for all platforms on every change of his AI. This is undoable. Also, it was very easy to break out of the NoAI framework, and 'cheating' in a way we wanted to prevent with this whole API. This framework is a fair API, which makes AIs only do what humans can do too. Either way, one might say, use libraries. Nice idea, but very much not cross-platform. It would mean every AI author would need to publish his AI in various of types (one for Windows, one for Linux, one for ..). This is undoable, and the reason most AI plugin systems of other game projects fail (for example, read up around the problems with TA Spring AIs, which uses such system). So, the only logic, safe, simple and fair solution is using an embed script. Feel free to dislike that, but so far many more people like it. So I guess you either have to adjust your like or dislike, or not bother using the framework at allmaxorator wrote: Now, correct my mistakes so I could learn what's really going on. I didn't search very much, but after a few quick searches on the wiki, I could only find pages showing how to use NoAI, none which tell how it works exactly.
The fact that you can download AIs, you can thank to the fact they are created in an embed scriptmaxorator wrote: Edit: I realise I may have downloaded a bad AI too.
If only .. it cheated in so many more waysRalph wrote:Maybe someone could take the last revision that contained the original AI and reimplement it in the NoAI framework for this chap. May need another game option 'AIs do not pay for terraforming' though if you don't want it to go bankrupt quickly.
Users browsing this forum: No registered users and 15 guests