Page 1 of 1
Multiple Java AIs in the same game
Posted: 16 May 2014, 22:20
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
Re: Multiple AIs in the same game
Posted: 16 May 2014, 22:40
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
Re: Multiple AIs in the same game
Posted: 16 May 2014, 22:44
by gajop
Nope, still broken

I suggest you play against other bots, or if you really want to use your own, create two different bots - perhaps even different packages.
Re: Multiple AIs in the same game
Posted: 16 May 2014, 23:05
by Bla
Ah, I see.... welp guess that means I can make all my classes static then
Re: Multiple AIs in the same game
Posted: 17 May 2014, 02:00
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.
Re: Multiple Java AIs in the same game
Posted: 18 May 2014, 05:06
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?)
Re: Multiple Java AIs in the same game
Posted: 18 May 2014, 10:41
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.