Page 1 of 1

Spring.SendSkirmishAIMessage Access violation

Posted: 22 Feb 2012, 03:28
by touraj21
Hi,
Can anyone please help me with the following:

I am trying to communicate to my Java AI, using the following code inside gadget:

Code: Select all

Spring.SendSkirmishAIMessage(0, MESSAGE)
Spring crashes and infolog.txt is :
http://pastebin.com/qJ3gmZpN

Re: Spring.SendSkirmishAIMessage Access violation

Posted: 22 Feb 2012, 13:08
by hoijui
hey! :-)
welcome here!

for the future: please dont c&p long logs directly into a post, but atach them as file or through pastebin (i did it for this post now).

would it be possible for you to supply code (game & AI) for me to try to replicate this?
.. me lazy ;-)

Re: Spring.SendSkirmishAIMessage Access violation

Posted: 22 Feb 2012, 20:09
by touraj21
Thanks for reorganising my post.
I Have attached the game,AI etc.

reproduce:
1.When game starts, type message in the chat box
2.Spring crashes with "access violation"


Some Notes:

--The widget " testing.lua" in EmptyMod.sdd\LuaUI\Widgets
calls the "turnController.lua" function gadget:RecvLuaMsg when message is typed in the chat box.

--The gadget "turnController.lua" in EmptyMod.sdd\LuaRules\Gadgets
includes the code for calling the AI:

Code: Select all

Spring.SendSkirmishAIMessage(0, MESSAGE)

NullOOJavaAI.java ===> java AI source code

Re: Spring.SendSkirmishAIMessage Access violation

Posted: 22 Feb 2012, 20:14
by touraj21
Java AI source code:

http://pastebin.com/LaGuEQg9


Thanks for helping.

Re: Spring.SendSkirmishAIMessage Access violation

Posted: 22 Feb 2012, 20:43
by abma
translated:

http://pastebin.com/wdbLKiRv

last known line:
https://github.com/spring/spring/blob/8 ... ry.cpp#L95

(translation of the skirmish-ai didn't work :-/)

Re: Spring.SendSkirmishAIMessage Access violation

Posted: 23 Feb 2012, 11:37
by hoijui
i think i was not really able to reproduce, but with a look at the generated Java AI Interface code, the problem was obvious.

so the thing is... this new AI event looks like this (rts/ExternalAI/Interface/AISEvents.h):

Code: Select all

struct SLuaMessageEvent {
	const char* inData;
	const char** outData;
}; //$ EVENT_LUA_MESSAGE
which is invalid for two reasons:
  • events can not have return values/out params
  • the C AI Interface can not have pointer-pointers/arrays
in other words... spring devs failed (mostly me, for not noticing it when it was introduced).

edit: i try to mak change

Re: Spring.SendSkirmishAIMessage Access violation

Posted: 23 Feb 2012, 12:15
by Kloot
  • fail 1: undocumented artificial restriction (is undocumented)
  • fail 2: the interface "parser"/Java code generator is what needs fixing then (pointer-pointers?? sure aint nevah seen those in mah C soup before, damned if Im gonna start eating them now!!!~!1~!one)
  • fail 3: no documentation anywhere about which C constructs are "allowed" (meaning primitive enough for the parsing scripts not to break)
--> both "can not"'s are really "should not"'s.

(note: I've already "fixed" it)

Re: Spring.SendSkirmishAIMessage Access violation

Posted: 23 Feb 2012, 19:42
by touraj21
Hoijui, abma and Kloot thanks for investigating.