LoidThanead wrote:What does the phase, "[wrappers] are compiled directly into the AI library" mean? I suppose it means that the additional functionality is a seperate library that will need to be included/imported into the AI library?
That is actually up to the Interface/Wrapper Dev, or to the AI dev.
For the LegacyCpp Wrapper, the Wrapper files are handled as if they were source files of the AI itsself, and compiled like the AI specific files to .o files, and then to a .so or .dll. So they are comiled once for each legacy Cpp AI. But it would also be possible to compile them just once, into a static library (.a) and then link this library into each legacy Cpp AI .dll (would save some compile time). As it is now, we would need two versions of the .a, one with, and one without creg support.
in Java, a wrapper would possibly be shipped as a jar to each AI that uses it, or as lots of class files into the individual ai.jar's.
does not make a difference, really.
But this made me think about a possible problem:
If we have two (Java) AIs using the same library, lets say apache-commons. And one of the AIs needs version 3, the otherone needs version 4 to run properly. As it works now, The Java interface uses only a single JVM instance, with a single global classpath, where it collects all the libraries of the interface and all AIs used in the current game (thier ai.jar and jlib/*.jar files). Therefore, either the classes of apache-commons v3 or v4 are loaded, and one of the AIs is doomed to fail.
I guess this is solvable by having a hirarchical classpath -> one child ClassLoader for each AI. I put it on my todo list.
LoidThanead wrote:
... the Java Interface log file was a big help while searching. It said it could not find the appropriate classes, even though I'm quite sure that I included them in the jar file.
Have you checked if your jar was included in the classpath?
the Java Interface log file should contian the classpath.
LoidThanead wrote:Could it be the thrown exception is lost somewhere?
I guess the exception cuases the current event (eg Update or UnitDied) to return an error code to spring (any value != 0). Spring does not yet do anything special when this happens, so yeah.. could well be that it does not get logged anywhere. Though.. i don´t think it would be good if spring would log that.. you know, the infolog containing an update event log entry for each frame...
But.. it is not really optimal as it is now, of course. Maybe i could catch the exception in Java, print it to the Java AI Interface log if logging is set to fine (the default with a debug build), and just throw the same exception again? then again, it would possibly be better to have a solution in spring itsself. Maybe only log an error once for each event per AI (eg, log only the first fail of event Update on AI-X in infolog.txt). Suggestions welcome.
LoidThanead wrote:This might even make an interesting wrapper for the Java AI?
Yeah, sounds like a good candidate for a wrapper. Cool stuff that!
LoidThanead wrote:
Though I suppose any discussion about further work on my AI shouldn't go in this thread, though I can still give feedback on the interface itself, should I run into anything that's worth mentioning.
Yeah, do it.
As i just saw, the Wrappers do not yet have their own pages, like the AI Interfaces and the Skirmish AIs. I will do the one for the legacy Cpp wrapper, and then you can do the one for your wrapper aswell if you want.
(one more thing on my todo list)
as it looks right now, i may not have much time the next few days to work on spring (yeah, real life, finally!!!!). but that should not be more then a week.
LoidThanead, i want to stress this again:
you are the first, and possibly only one that works with this system right now. The class diagram of the callback is kind of a fast hack of mine, and now is the best time to change it. And as you work with exactly this, you will soon have a better overview of it then i have, and see where it should be changed. So please report back thigns you would want changed, like:
- methods moved from one class to an other
- methods renamed
- classes renamed
- classes splitt into multiple classes or merged together
- changing certain things to make it possibe to implement a common interface (eg. Resources of UnitDef and Resources of WeaponDef)
If you miss some functionality, this is not as urgent right now. Adding functionality will always need change anyway, so it does not matter if this change occurs now or later, when the interface is more widely used already.