I think I have found a bug in the new Java AI interface.
The class specified in the AIInfo.lua (key: className) is only constructed once no matter how many AIs are added to the game.
E.g. if I make a game with 2 of the same AIs, the engine creates one instance of the class and calls each event twice on the same class.
NullJavaAI and NullJavaOOAI also have this behavior. If you add 2 of the same to a game, they both think that they are the same player/team (see the team ID when they message there resource stats every 10 secs), because the team ID is overridden in the init event when its called a second time.
Is this a bug, or am I just missing something?
Java AI Interface broken?
Moderators: hoijui, Moderators
Re: Java AI Interface broken?
As I answered you in the chat, it feels oddly similar to http://springrts.com/mantis/view.php?id=2162. I haven't tested it recently, so I can't confirm if it's still happening for me, but I'll give it a try these days and see what happens.
Re: Java AI Interface broken?
it is this problem:
http://springrts.com/mantis/view.php?id=2840
i tried to fix it last vacation, and when i though i had it.. did multiple instances of a class and all.. it was still the same.. and that after like 1.5 days of unfun coding, so ... motivation left me, as i had much other nicer stuff to do. i hope to get at it next vacation again.
http://springrts.com/mantis/view.php?id=2840
i tried to fix it last vacation, and when i though i had it.. did multiple instances of a class and all.. it was still the same.. and that after like 1.5 days of unfun coding, so ... motivation left me, as i had much other nicer stuff to do. i hope to get at it next vacation again.
Re: Java AI Interface broken?
Too bad I suck at C, otherwise I would help.
I remember it used to work when the Java side used a factory class to return a new instance of the AI, if that's any help.
I remember it used to work when the Java side used a factory class to return a new instance of the AI, if that's any help.
Re: Java AI Interface broken?
i wanted to do sort of a "quick" fix, but that failed, and i dont know why
thing is, as you probably gfuessed... one little change of how it works in java needs lots of ugly coding/changes on hte C side.
the propper fix in my eyes, which is probably what i will try to go for next time right away, is to do even less on the C side. currently, setup of one class-path per AI impl. is done from the C side too, for example. and i would like to instantiate AIs as OSGi modules. The OSGi stuff would (by default) be compleetly hidden by the AI Interface already. the main donwside of this is of course, the additional dependency on OSGi and at least one implementation of it. again, this may sound like no big deal for a java guy, but integrating this in spring is quite some pain, especially for linux.
thing is, as you probably gfuessed... one little change of how it works in java needs lots of ugly coding/changes on hte C side.
the propper fix in my eyes, which is probably what i will try to go for next time right away, is to do even less on the C side. currently, setup of one class-path per AI impl. is done from the C side too, for example. and i would like to instantiate AIs as OSGi modules. The OSGi stuff would (by default) be compleetly hidden by the AI Interface already. the main donwside of this is of course, the additional dependency on OSGi and at least one implementation of it. again, this may sound like no big deal for a java guy, but integrating this in spring is quite some pain, especially for linux.
Re: Java AI Interface broken?
It was "finally" fixed for the second time.