My bot have lag on internet game. - Page 2

My bot have lag on internet game.

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

Moderators: hoijui, Moderators

What reason for this bug?

Poll ended at 20 Sep 2014, 14:28

Mistmatch AI interface version
1
20%
Bad BOT logic
1
20%
Spring engine have bug
3
60%
It is a Java bug
0
No votes
 
Total votes: 5

abma
Spring Developer
Posts: 3555
Joined: 01 Jun 2009, 00:08

Re: My bot have lag on internet game.

Post by abma » 15 Sep 2014, 06:12

i can reproduce the crash "Failed to allocate memory" now, not sure why it happens atm.
0 x

playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: My bot have lag on internet game.

Post by playerO1 » 03 Oct 2014, 09:33

It may be same "out of bounds" bug in C interface.
What I mean, example: array A from 10 element(0..9), you may write on 10 element A[10]=123; But A[10] may adress on other wariable.

Maybe bug in the next line: https://github.com/abma/spring/blob/dev ... ge.c#L1153 ? I'm not know nice C++/C, but not undestand, what will be doing programm, if it will be using this last element "size_t firstFree = skirmishAiImpl_size;", if bounds on cicle "sai < skirmishAiImpl_size;". Hm... Or whay need do "firstFree = skirmishAiImpl_size;" if this wariable always will be rewrite?
p.s.: AI Interface from Spring 94.0 not have this bug.
0 x

abma
Spring Developer
Posts: 3555
Joined: 01 Jun 2009, 00:08

Re: My bot have lag on internet game.

Post by abma » 04 Oct 2014, 19:07

i've created a bug report about this: http://springrts.com/mantis/view.php?id=4565

but i'm not sure if i / someone else will fix it soon.

when checking code you should use the official source code repository which is here:

https://github.com/spring/spring/blob/d ... ge.c#L1154

this file seems to be different in comparison to the fork of abma.

java ai interface code recently had changed, not sure if related.

i guess this code does reuse existing slots for ais, i don't see a bug there as index is checked for bounds.
0 x

playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: My bot have lag on internet game.

Post by playerO1 » 05 Oct 2014, 09:22

Abma, I today check again cycle (for) on Java, then check on C++. And now I realy see bug on index using.
Example, what you think of result of next code:

Code: Select all

int i;
for (i=0; i<10; i++);
printf("i=%i",i)
You think on terminal you will be see "i=9" or "i=10"?

I see on code at line 1153 variable "sai" using for cycle. After cycle (I see change - no break on spring/spring repository) this variable always will be equals "skirmishAiImpl_size". Then at line 1163 do check on null "if (skirmishAiImpl_className[sai] == NULL)" - it equals as you will be check next index "skirmishAiImpl_className[skirmishAiImpl_size]". I don't read about size "skirmishAiImpl_className", but if array size was limited as skirmishAiImpl_size - then you realy can have problem with out of bounds, and can check other wariables.
The second danger line is 1163, 1191, 1212.
.
0 x

User avatar
hoijui
Former Engine Dev
Posts: 4342
Joined: 22 Sep 2007, 09:51

Re: My bot have lag on internet game.

Post by hoijui » 05 Oct 2014, 10:07

... indeed... good find!
what the heck have i been thinking there? :D
and how can that ever work?
.. much have been someone else coding it! ( dum di dum... :/ )

yeah, both these loops (JavaBridge.c line 1153 and line 1203) seem wrong. they are different, even though they should be doing the same, and neither is correct. should be corrected and moved to a function, i would say.
luckily, i commented the code so one know what the code should be doing. :D
.. me so smart!

.. should i do the commit, or will someone of you do it?
0 x

abma
Spring Developer
Posts: 3555
Joined: 01 Jun 2009, 00:08

Re: My bot have lag on internet game.

Post by abma » 05 Oct 2014, 17:46

hoijui wrote:.. should i do the commit, or will someone of you do it?
if you have still a build env up, it would be great when you do the commit :-)

else i need some hint what needs to be changed. i still don't fully understand what this code should do.
0 x

User avatar
hoijui
Former Engine Dev
Posts: 4342
Joined: 22 Sep 2007, 09:51

Re: My bot have lag on internet game.

Post by hoijui » 10 Oct 2014, 09:50

made 2 small fix commits.
thanks playerO1 and abma!

the commits were not tested, but they are small enough to.. let me think they should work. ;-)
they will be in the develop branch soon, i guess.
0 x

playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: My bot have lag on internet game.

Post by playerO1 » 18 Oct 2014, 20:56

I compile last Engine with AI interface version (17 october from github sources), then paste AI interface into Spring 98 folder (I not see AI interface in Spring 98 Linux 64). And I see 2 bug:
1. Two or more my bot can not work together: one of him have full control, secong do nothink. (Old bug, on Spring 97 it will be fixed, but now...) (See http://springrts.com/mantis/view.php?id=2840 and http://springrts.com/phpbb/viewtopic.ph ... 65#p560565)
2. Spring 98 + Zero-K mod + NullOOJavaAI take crash :(
0 x

playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: My bot have lag on internet game.

Post by playerO1 » 01 Nov 2014, 20:38

I watch that Java AI Interface file on github have 2-3 years old of modify. Only one file have been modifed - it is "JavaBridge.c". Becouse I see, that Java interface from Spring 94.1 work on Spring 96+ZK mod, I copy from github file "JavaBridge.c" from ~Spring 95 version into sources from Spring 98 develop from GitHub.
I modify only one line in old file for compile new AI interface, becouse it was no compiling without it (modify method "void java_establishSpringEnv()").
I test this modifed interface: with TA/BA mod it can work, with ZK it crash again. I think bug can exist on other files, not on "JavaBridge.c". The bug can contain on other Spring files and modules.
0 x

User avatar
hoijui
Former Engine Dev
Posts: 4342
Joined: 22 Sep 2007, 09:51

Re: My bot have lag on internet game.

Post by hoijui » 03 Nov 2014, 21:42

you have a patch for JavaBridge.c?
if so, please make a pull request on github, and it will be checked out. also include a description of what exactly this is supposed to fix.
0 x

playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: My bot have lag on internet game.

Post by playerO1 » 05 Nov 2014, 18:00

hoijui wrote:you have a patch for JavaBridge.c?
No, I mean that this file can not contain bug.
I try find bug on "JavaBridge.c", but I not found bug on this file. And I am sure that this file not have bug for make this crash.
So, if this file not have bug, and only this file have modifen on last year, it mean that bug can contain only on other Spring modules: on Spring engine, or "ExternalAI/Interface/*.h", "CUtils/*" or "AI/Interfaces/C/src/*" or other.
0 x

mojjj
Posts: 1
Joined: 27 Sep 2016, 09:31

Re: My bot have lag on internet game.

Post by mojjj » 27 Sep 2016, 09:32

0 x

Post Reply

Return to “AI”

cron