Java AI Interface broken?

Java AI Interface broken?

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
User avatar
Petah
Posts: 426
Joined: 13 Jan 2008, 19:40

Java AI Interface broken?

Post by Petah »

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?
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Java AI Interface broken?

Post by gajop »

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.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI Interface broken?

Post by hoijui »

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.
User avatar
Petah
Posts: 426
Joined: 13 Jan 2008, 19:40

Re: Java AI Interface broken?

Post by Petah »

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.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI Interface broken?

Post by hoijui »

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.
User avatar
Petah
Posts: 426
Joined: 13 Jan 2008, 19:40

Re: Java AI Interface broken?

Post by Petah »

gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Java AI Interface broken?

Post by gajop »

It was "finally" fixed for the second time.
Post Reply

Return to “AI”