Spring.SendSkirmishAIMessage Access violation

Spring.SendSkirmishAIMessage Access violation

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

Moderators: hoijui, Moderators

Post Reply
touraj21
Posts: 7
Joined: 12 Feb 2012, 22:44

Spring.SendSkirmishAIMessage Access violation

Post 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
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Spring.SendSkirmishAIMessage Access violation

Post 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 ;-)
touraj21
Posts: 7
Joined: 12 Feb 2012, 22:44

Re: Spring.SendSkirmishAIMessage Access violation

Post 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
Attachments
FogofWar.zip
Skirmish AI
(874.78 KiB) Downloaded 29 times
infolog.txt
Stacktrace
(16.49 KiB) Downloaded 114 times
EmptyMod.sdd.zip
The Game
(6.68 MiB) Downloaded 24 times
touraj21
Posts: 7
Joined: 12 Feb 2012, 22:44

Re: Spring.SendSkirmishAIMessage Access violation

Post by touraj21 »

Java AI source code:

http://pastebin.com/LaGuEQg9


Thanks for helping.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Spring.SendSkirmishAIMessage Access violation

Post 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 :-/)
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Spring.SendSkirmishAIMessage Access violation

Post 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
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Spring.SendSkirmishAIMessage Access violation

Post 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)
touraj21
Posts: 7
Joined: 12 Feb 2012, 22:44

Re: Spring.SendSkirmishAIMessage Access violation

Post by touraj21 »

Hoijui, abma and Kloot thanks for investigating.
Post Reply

Return to “AI”