Java AI API: bug SIGSEGV or dirrerent API interface? - Page 2

Java AI API: bug SIGSEGV or dirrerent API interface?

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

Moderators: hoijui, Moderators

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

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by hoijui »

vecmath.jar is not generated by the build process. i actually don't remember how it was supposed to be obtained, but it is an external dependency. version 1.3.1 is used by spring, which you can get it from here:
http://mvnrepository.com/artifact/java3d/vecmath/1.3.1

cmake should find it if you put it into the spring sources at this location:
AI/Wrappers/JavaOO/jlib/vecmath.jar
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by playerO1 »

My cmake files do not find this library automatic. Don't undestatd whay. Maybe reason for bad fount that I using 'ccmake .'?
I found how I can compile this. I edit AI/Wrappers/JavaOO/CMakeLists.txt file:
replace

Code: Select all

	FindJavaLib(vecmath_jar "vecmath" "${myJLibDir}")
	set(myJLibs                      "${vecmath_jar}")
on absolute path

Code: Select all

	FindJavaLib(vecmath_jar "vecmath" "${myJLibDir}")
	set(myJLibs                      "/home/user/Documents/spring-develop 97/spring/AI/Wrappers/JavaOO/jlib/vecmath.jar")
I know, it's bad, but it work for me. I pass Java Wrapper compile with this.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by abma »

on ubuntu its installed with "apt-get install libvecmath-java", imo this should be a dependency from java-jdk.

i've never used ccmake, afaik this is just a gui for cmake.
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by playerO1 »

abma wrote:on ubuntu its installed with "apt-get install libvecmath-java"
thanks, I think it is main reason fo my problems. But I have finish compiling siccess now :-)
Now I see other problem. Now, if I start 2 or more Java bot's I see in game message "Click to take 2 abandoned units !". All work (2 bot working nice). But whay this message showing for me? (Spring 96, AI Interface from Spring 97 dev + some AI Interface config files from 94.1 for JVM settings)
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by abma »

> Spring 96, AI Interface from Spring 97 dev

DON'T DO THAT!

very likely because of that you get bugs. mixing versions isn't supported, ai interface isn't made for backwards-compatibility.

regardingless of that, infolog.txt should help.

stick to one engine specific & current engine version, then we maybe can help. ideally current development version, this way you'll get patches/fixes the fastes way.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by hoijui »

also, there is (or at least was) a bug in the Java AI Interface that did not allow for two instances of s single AI implementation. i remember vaguely that someone said to have a dirty fix for it, but then i am not sure if it worked... or i was just dreaming this up.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by abma »

@hoijui:

this problem is fixed: http://springrts.com/mantis/view.php?id=2840
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by hoijui »

niiiice! thanks abma! :-)
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by playerO1 »

You about "Click to take 2 abandoned units !"? It fixed? Nice.
If reason for problem double-call initinit then I hope you fixed double-call relase() too.
BOT log:

Code: Select all

release: reason=2
release: reason=2
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by abma »

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

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by playerO1 »

I test my bot on "97.0.1-206-g8576ee8 develop" for Linux 64.
Where I call "unitDef.getCustomParam()" I have crash:

Code: Select all

[f=0000000] Connection attempt from ME
[f=0000000]  -> Version: 97.0.1-206-g8576ee8 develop
[f=0000000]  -> Connection established (given id 0)
[f=0000000] Player ME finished loading and is now ingame
[f=0000000] Error: Ошибка сегментирования (SIGSEGV) in spring 97.0.1-206-g8576ee8 develop
[f=0000000] Error: Stacktrace for Spring 97.0.1-206-g8576ee8 develop:
[f=0000000] Error: This stack trace indicates a problem with an AI Interface library.
[f=0000000] Error:   <0> /usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so(+0x79c4e5) [0x7fbe639d44e5]
[f=0000000] Error:   <1> /usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so(JVM_handle_linux_signal+0x179) [0x7fbe639d84c9]
[f=0000000] Error:   <2> /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7fbea4300340]
[f=0000000] Error:   <3> /usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so(+0x5d0d16) [0x7fbe63808d16]
[f=0000000] Error:   <4> ??:?
[f=0000000] Error:   <5> [0x7fbe6024a698]
[f=0000000] Error: [ErrorMessageBox][1] msg="Spring has crashed:
It is only I can not call on Java AI:

Code: Select all

        java.util.Map customP = unit.getCustomParams();
        sendTextMsg(" Custom params size = "+customP.size() );
        sendTextMsg(" Custom params data = "+customP.toString() );
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by playerO1 »

I just write about you'r Interface AIP documentation.
You'r Interface documentation is very bad!
For example see next you'r documentation

Code: Select all

int getTeamAllyTeam(int otherTeamId)
Returns the ally-team of a team

int getPlayerTeam(int playerId)
I see that this function have parameter otherTeamId. I do not see range of value. I see only "int". "int" mean for me that I can send to this parameter next value: 0,1,2,...100, Integer.MAX_VALUE, -1, -2. This documentation was not have rules for developer, what value I can send. I see "int getTeamAllyTeam" then what you think the return range? Do this can return 0,1,2, or 9999, -1, -2, -3, Integer.MIN_VALUE?
If you answer that "It can return only true value" then whay true value of "int getPlayerTeam(int playerId)" may be not true for parameter "getTeamAllyTeam"?!
lamer
Posts: 153
Joined: 08 Mar 2014, 23:13

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by lamer »

playerO1 wrote:I test my bot on "97.0.1-206-g8576ee8 develop" for Linux 64.
Where I call "unitDef.getCustomParam()" I have crash
...
It is only I can not call on Java AI:

Code: Select all

        java.util.Map customP = unit.getCustomParams();
        sendTextMsg(" Custom params size = "+customP.size() );
        sendTextMsg(" Custom params data = "+customP.toString() );
MAP keyword in awk generator script is not implemented (or rather not finished) for Java. And all getCustomParams functions marked as MAP. Thus abandon Java, go C++ (:
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by hoijui »

it makes more sense for a dev to learn what is the valid range of a teamId, then to plaster this info everywhere a teamId appears.
reasons:
* less work
* less cluttering
* no risk of spreading outdated info (probably the most important reason)
* no wasting of time of devs reading the same, lengthy info a million times
* no risk of over-reading actual important info, where there might be some, in the jungle of the repeated info
.. and maybe more

of course it has negative side effects, like you having to find such info in other places, like the spring source directly. this in turn though, has again positive side effects too (you learn the force.. aehh source, you will be fixing bux, maybe, you will understand spring better, and be able to write better AI, you can write the documentation that you think is missing, ....)
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by Anarchid »

Such a motivation for inferior docs sounds kinda machiavellian.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by abma »

imo thats just an excuse why few docs exist :)

i agree that a dev should know what he is doing, so he either has to read docs or read source code to understand whats happening. its arguable what uses less time / leads to better results in some cases.

still most/many ai api functions are documented!
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by gajop »

I think the API is documented well enough. There is a lack of a good guide, as well as a lack of example usage and common problems with solutions.

That said, I tend to have trouble reading your posts that I usually don't bother. No idea what you wanted to say in your last sentence. Could your main issue be with your lack of English knowledge perhaps?
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by Anarchid »

Even the best-documented part of AI API (java) occasionally has things that are very hard to parse.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by abma »

crash because of calling unitDef.getCustomParam() should be fixed in current development version:

https://github.com/spring/spring/commit ... b3478f10f9

buildbot builds:
http://springrts.com/dl/buildbot/defaul ... -g28fadd8/
playerO1
Posts: 57
Joined: 25 Jun 2014, 15:22

Re: Java AI API: bug SIGSEGV or dirrerent API interface?

Post by playerO1 »

I found other method to get morph info. I just parsing string from CMD.getTolTip(). It is slow, bit it is work.
Post Reply

Return to “AI”