Java unitdef crash

Java unitdef crash

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

Moderators: hoijui, Moderators

Post Reply
w00tguy123
Posts: 3
Joined: 04 Oct 2007, 01:51

Java unitdef crash

Post by w00tguy123 »

Using code from the NullJavaAI, I've made a small test that is supposed to identify the commander when the game starts. The only code I've added is for this event:

Code: Select all

	@Override public int unitFinished(int unit) 
	{
		int def = clb.Unit_getDef(unit);
		String name = clb.UnitDef_getName(def);
		clb.Log_log("Unit " + unit + " has unitdef " + def + " which has name " + name);
		return 0;
	}
The game crashes as soon as I call 'UnitDef_getName(def)'. Is there anything that needs to be called/setup before using the UnitDef_ methods? The tutorial for the Java interface seems to be outdated. I'm testing this with Spring v0.88 and BA v7.68.

Edit: just realized that the tutorial is for the OO java AI. I'll try that one and see if it works.

Edit2: The OO java AI works fine, so I guess I'll use that instead. Out of curiosity, is the Java one broken or a WIP?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Java unitdef crash

Post by hoijui »

yeah, tutorial is outdated. :/
the non-OO java AI Interface is not meant ot be used by devs directly, but rather (maybe) ... for example when you implement an AI Wrapper in an other JVM supported language then Java. though that will likely nto make sense, as probably all of these languages may be able to use the Java OO Wrapper directly, and thus not need their own wrapper.
it should not crash though, but .. i have no time, nad there are way more important things to fix first, with the Java AI Interface.
Post Reply

Return to “AI”