Multiple Java AIs in the same game

Multiple Java AIs in the same game

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

Moderators: hoijui, Moderators

Post Reply
Bla
Posts: 79
Joined: 25 Feb 2013, 14:44

Multiple Java AIs in the same game

Post by Bla »

I've been experimenting with making the classes in my AI static to make the code neater, but when I have 2 or more of the same instances of my AI, only the 2nd one acts, the 1st one is idle. I think I read somewhere in the forums that spring has a problem where if many AIs are added, they all think they are the same or something.

Has that bug been fixed? Or is it all my fault?

Edit: I'm talking about AIs in java
Last edited by abma on 17 May 2014, 03:02, edited 1 time in total.
Reason: adjusted topic
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Multiple AIs in the same game

Post by SinbadEV »

Known-ish issue in Java AIs... you should probably wait for someone who knows better than me but I think this is the relevant bug http://springrts.com/mantis/view.php?id=2162
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Multiple AIs in the same game

Post by gajop »

Nope, still broken :P
I suggest you play against other bots, or if you really want to use your own, create two different bots - perhaps even different packages.
Bla
Posts: 79
Joined: 25 Feb 2013, 14:44

Re: Multiple AIs in the same game

Post by Bla »

Ah, I see.... welp guess that means I can make all my classes static then
User avatar
PepeAmpere
Posts: 589
Joined: 03 Jun 2010, 01:28

Re: Multiple AIs in the same game

Post by PepeAmpere »

Change title of thread pls, this is not general AI question, its limited only for subset of AI creation ways. Lua AIs are not affected by this issue, for example.
Bla
Posts: 79
Joined: 25 Feb 2013, 14:44

Re: Multiple Java AIs in the same game

Post by Bla »

Hm, while I'm at it, are there any potential downsides for static classes? (Ex. if and when the bug is fixed, my AI will still act like one if I have many instances in the same game right?)
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Multiple Java AIs in the same game

Post by gajop »

Yes, it will work. The reason you shouldn't have "static classes" all over the places is because it's bad design. If you really need a few stuff to be static, use singleton or service locator, but in as few places as possible.
Post Reply

Return to “AI”