View topic - Java AI Interface broken?



All times are UTC + 1 hour


Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 15 Jan 2012, 07:31 
User avatar

Joined: 13 Jan 2008, 19:40
Location: New Zealand
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?


Top
 Offline Profile  
 
PostPosted: 15 Jan 2012, 18:55 
Moderator

Joined: 05 Aug 2009, 19:42
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.


Top
 Offline Profile  
 
PostPosted: 16 Jan 2012, 16:55 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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.


Top
 Offline Profile  
 
PostPosted: 19 Jan 2012, 03:57 
User avatar

Joined: 13 Jan 2008, 19:40
Location: New Zealand
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.


Top
 Offline Profile  
 
PostPosted: 19 Jan 2012, 10:50 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.