Interface Redesign
Moderators: hoijui, Moderators
Re: Interface Redesign
ahh.. this helps, thanks!
of course, a stupid error of mine, sorry. am fixing.
of course, a stupid error of mine, sorry. am fixing.
Re: Interface Redesign
Im sorry lately I've been ill the last week and Ill have work once Im better so Im not in the best position to compile and test right now
Re: Interface Redesign
hoijui: you should merge the trunk into your branch every now and then, stdafx.h has changed a lot e.g.
Re: Interface Redesign
i did it!! (reintegrate trunk into the C AI branch)
was not so fun, but well.. it had to be done. to some extend, the changes are good: the new files Exceptions.h and Util.h, and StdAfx.h used less. but i saw that GlobalStuff is used more often instead, which i think is not so good, but it is ok (i #ifdefed some things in it, so its not compiled for AIs and iInterface libraries)
soo.. it works here, i hope i included everything in the commit that is needed. test pls, if you have time.
was not so fun, but well.. it had to be done. to some extend, the changes are good: the new files Exceptions.h and Util.h, and StdAfx.h used less. but i saw that GlobalStuff is used more often instead, which i think is not so good, but it is ok (i #ifdefed some things in it, so its not compiled for AIs and iInterface libraries)
soo.. it works here, i hope i included everything in the commit that is needed. test pls, if you have time.
design question
a design question:
logging
the way LogOutput works now, is incompatible with AIs. Meaning, they can not use it. some questions that arise:
logging
the way LogOutput works now, is incompatible with AIs. Meaning, they can not use it. some questions that arise:
- should AIs be able to log to infolog.txt directly?
- should we pass a simple C function pointer for logging to AIs?
something like:Code: Select all
void (*log)(const char* logMessage);
- should each AI use its own logging mechanism?
- should AIs ever use the errorhandler?
- should they use only SendTextMessage() in the AI callback (which ends up in infolog.txt)?
- ... if so, how should they log more basic stuff, not related to an AI instance?
Re: Interface Redesign
As far as I can see NTai OTAI and AAI all have their own logging systems and only use the command line for stuff like debug messages when debug mod is enabled or for commandline commands like the NTai .aicheat
Re: Interface Redesign
scenario:
user plays spring, spring crashes, user sends infolog.txt to forum or bugtracker. if the game crashed because of an AI, and the AI did log to infolog.txt, thne the AI dev could have lots of info why it happend, or even better, the user already saw the problem and fixed it himself (if it is not code related).
also, if AIs were able to log to infolog, this does not mean they have to do it. whether they do it or not, they can still use their own logging system.
.aicheat is a message from the user to the AI, right?
i want to discuss: AI --logging-to--> engine/infolog.txt
user plays spring, spring crashes, user sends infolog.txt to forum or bugtracker. if the game crashed because of an AI, and the AI did log to infolog.txt, thne the AI dev could have lots of info why it happend, or even better, the user already saw the problem and fixed it himself (if it is not code related).
also, if AIs were able to log to infolog, this does not mean they have to do it. whether they do it or not, they can still use their own logging system.
.aicheat is a message from the user to the AI, right?
i want to discuss: AI --logging-to--> engine/infolog.txt
Re: Interface Redesign
Anything outputted to the console is outputted to infolog.txt that is the purpose of infolog.txt. The only exceptions really are when data is put to the console but the console cannot be viewed such as prior tot he game start during loading ro when the engine has crashed.
We already log data to external files and that is arguably safer as infolog.txt is erased and rewritten very game but our AI logs have timestamps in the file names
We already log data to external files and that is arguably safer as infolog.txt is erased and rewritten very game but our AI logs have timestamps in the file names
Re: Interface Redesign
ah.. you mean.. stdout is redirected to infolog, so when i do this in my AI:
it ends up in infolog.txt?
Code: Select all
cout << "Hello World" << endl;
Re: Interface Redesign
no
See ingame theres a little console box? And when you chat or enter commands they appear in that box? That's what I mean by console. (although std::cout is routed to infolog.txt and the message console in the engine (but only in the engine not the AIs and external modules!)).
Whatever appears in the chatbox appears in infolog.txt, that is the purpose of infolog.txt, to log the contents of the chat console .
See ingame theres a little console box? And when you chat or enter commands they appear in that box? That's what I mean by console. (although std::cout is routed to infolog.txt and the message console in the engine (but only in the engine not the AIs and external modules!)).
Whatever appears in the chatbox appears in infolog.txt, that is the purpose of infolog.txt, to log the contents of the chat console .
Re: Interface Redesign
AHHHH.. now i get it...
why didn't you say that in the beginning?
i guess we keep it like this:
when an error happens realy early, during initialization of the AI, before it is possible to send messages to the Spring game console, we currently have two options:
why didn't you say that in the beginning?

i guess we keep it like this:
when an error happens realy early, during initialization of the AI, before it is possible to send messages to the Spring game console, we currently have two options:
- do logging through AI specific log system
- return a number != 0 from the init() function (which the engine writes to infolog)
- do logging through AI specific log system
- send log messages through the AI callback (SendChatMessage() or something like that)
Re: Interface Redesign
Yes keep it so we can log to the chat console with the same behavior as the old interface and we'll just carry on as we always have.
Re: Interface Redesign
+1 for providing a spring_console_log (or whatever) API entry that routes text to the infolog.
Re: Interface Redesign
yeahh.. the thing that always worked already works like this... its just that it is AI instance specific.. but nearly eveyrthing is instance specific, or can be logged by an instance, and the rest. can be reported to spring through function return values (as in "int init()") or to AI specific log files.
soo.. this issue is done for me.
I have updated the Wiki:
soo.. this issue is done for me.
I have updated the Wiki:
- deprecated JAI
- added a section for AI interface libraries
- added a page for the C Interface library
- added a page for the upcomming Java Interface library
- added a page for each NullAI & NullLegacyCppAI
Re: Interface Redesign
There are quite a few 'return to main page' links, can you clean them up to lead to the correct place if you come across them?
Re: Interface Redesign
yeah there are two. links to two AIs that dont exist yet. i have to do one of them first (will be in Java, when the Java interface is ready), and the other one should be done by someone else (maybe zenzike?). it will be a Null/Test C++ AI that uses a new - event and command based - way to interface with the engine (through the C interface). in contrast to the current two test AIs of which one uses the legacy C++ wrapper and one is pure C.
We have quite some links that go to no pages on the main AI Wiki site now.. though i will leave them with no page as long as therr is nothing i can put there. If you want, put an empty page there, i would not.
We have quite some links that go to no pages on the main AI Wiki site now.. though i will leave them with no page as long as therr is nothing i can put there. If you want, put an empty page there, i would not.
Re: Interface Redesign
Links to no page are better than links to incorrect pages
Re: Interface Redesign
@AF
yeah, i think so too. so i leave it till i can put something real on that pages.
Loading AI Libraries
i am a bit confused right now (maybe becuase i slept too little). where exactly should AI libraries be loaded from?
so far, we used the {current working directory}/AI/Bot-libs/. with the new interface, the subfolder will change, but i am thinking about the first part (cwd). should it rather be the data directories? or the library directory? and if we have multiple data-dirs, should i look for AIInfo.lua files in all of them? and if so... should i look for the shared library spoecified by an AIInfo.lua in all data directories or only in the one where the AIInfo.lua resides?
yeah, i think so too. so i leave it till i can put something real on that pages.
Loading AI Libraries
i am a bit confused right now (maybe becuase i slept too little). where exactly should AI libraries be loaded from?
so far, we used the {current working directory}/AI/Bot-libs/. with the new interface, the subfolder will change, but i am thinking about the first part (cwd). should it rather be the data directories? or the library directory? and if we have multiple data-dirs, should i look for AIInfo.lua files in all of them? and if so... should i look for the shared library spoecified by an AIInfo.lua in all data directories or only in the one where the AIInfo.lua resides?
Re: Interface Redesign
gah now Im confused, I think I tried to outline this earlier in the thread so refer back
Re: Interface Redesign
AF, could you give me some more hints to find the post(s) you refer to? (no mood to search through the whole 16 pages by eye).
what i found with the search option (though not in this thread):
for those who do not know (like me, 3 days ago): Spring does a chdir to the only writable data directory. so currently AIs are loaded (only) from there.
An old post of Tobi vaguely related to the subject:
viewtopic.php?f=15&t=6736&p=115699&hilit=current+working+directory#p115699
what i found with the search option (though not in this thread):
for those who do not know (like me, 3 days ago): Spring does a chdir to the only writable data directory. so currently AIs are loaded (only) from there.
An old post of Tobi vaguely related to the subject:
viewtopic.php?f=15&t=6736&p=115699&hilit=current+working+directory#p115699