Java AI crashes with external libraries

Java AI crashes with external libraries

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

Moderators: hoijui, Moderators

Post Reply
Bla
Posts: 79
Joined: 25 Feb 2013, 14:44

Java AI crashes with external libraries

Post by Bla » 03 Sep 2016, 05:03

I wrote my AI a long time ago and I decompiled the libraries then recompiled them into my project because I didn't know the jars could be used directly. Now I'm trying to do things the correct way by removing the decompiled files and using the jars instead. However, that causes my AI to die upon startup. For comparison I used /aicontrol with an older version to show that the older AI can initialize in the infolog. in my jlib file are AIInterface.jar, AIInterface-src.jar, JavaOO-AIWrapper.jar, vecmath.jar, and vecmath-src.jar. My init method is also quite simple. The full code of my AI is at: https://github.com/Bla1/Bla1AI/blob/master/Bla1AI.java

I put the jars both in Bla1AI/0.41.7 and Bla1AI/0.41.7/jlib just to be safe but it still crashes.

Code: Select all

[f=-000001] Loading Skirmish AIs
[f=-000001] [Java Interface] JRE found in registry!
[f=-000001] [Java Interface] Using JRE (can be changed with JAVA_HOME): C:\Program Files (x86)\Java\jre1.8.0_91
[f=-000001] [Java Interface] Successfully loaded the JVM shared library at "C:\Program Files (x86)\Java\jre1.8.0_91\bin\client\jvm.dll".
[f=-000001] [Java Interface] Unable to find common read-only data-dir (optional).
[f=-000001] [Java Interface] Unable to find common read-only native libs data-dir (optional).
[f=-000001] [Java Interface] Initialization successfull.
[f=-000001] Warning: AI for team 0 (ID: 0) failed handling event with topic 1, error: -5
[f=-000001] Error: Failed to handle init event: AI for team 0, error -5
[f=-000001] [WatchDog] deregistering controls for thread [load]
[f=-000001] <Easy Facing> Spectator mode. Widget removed.
[f=-000001] GameID: 673aca57eb992dc9d20c5af5a4e560fe
[f=-000001] Connection attempt from Player
[f=-000001]  -> Version: 103.0
[f=-000001]  -> Connection established (given id 0)
[f=-000001] Spectator Player finished loading and is now ingame
[f=-000001] <GhostRadar> Spectator mode. Widget removed.
[f=-000001] Skirmish AI "Bot1" (ID:0), which controlled team 0 is now dead
[f=0000030] <Blast Radius> Spectator mode. Widget removed.
[f=0000030] <Unit Marker> Spectator mode. Widget removed.
[f=0000730] Skirmish AI being created for team 0 ...
[f=0000730] [Java Interface] JRE found in registry!
[f=0000730] [Java Interface] Using JRE (can be changed with JAVA_HOME): C:\Program Files (x86)\Java\jre1.8.0_91
[f=0000730] [Java Interface] Successfully loaded the JVM shared library at "C:\Program Files (x86)\Java\jre1.8.0_91\bin\client\jvm.dll".
[f=0000730] [Java Interface] Initialization successfull.
[f=0000730] Warning: AI for team 0 (ID: 0) failed handling event with topic 1, error: -5
[f=0000730] Error: Failed to handle init event: AI for team 0, error -5
[f=0000732] Skirmish AI "Bla1AI" (ID:0), which controlled team 0 is now dead
[f=0000930] Skirmish AI being created for team 0 ...
[f=0000930] [Java Interface] JRE found in registry!
[f=0000930] [Java Interface] Using JRE (can be changed with JAVA_HOME): C:\Program Files (x86)\Java\jre1.8.0_91
[f=0000930] [Java Interface] Successfully loaded the JVM shared library at "C:\Program Files (x86)\Java\jre1.8.0_91\bin\client\jvm.dll".
[f=0000930] [Java Interface] Initialization successfull.
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding energy making buildings
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found aafus
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armadvsol
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armfus
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armsolar
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found cafus
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found coradvsol
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corfus
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corsolar
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tlladvsolar
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllcoldfus
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllmedfusion
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllsolar
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding Mexes
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armmex
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armmoho
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found cormex
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found cormoho
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllamex
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllmex
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding Builders
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armack
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armacv
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armck
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armcv
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corack
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found coracv
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corck
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corcv
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllack
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllacv
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllck
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllcv
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding Factories
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armlab
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corlab
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tlllab
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding Factories
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armvp
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corvp
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllvp
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding Factories
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armalab
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found coralab
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllalab
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding Factories
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armavp
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found coravp
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllavp
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding Raiders
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armfast
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armflash
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armlatnk
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armpw
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corak
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corgator
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corpyro
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corseal
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllares
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllburner
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllcoyote
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllprivate
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding Nanos
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armnanotc
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found cornanotc
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllnanotc
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Finding metal makers
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found ametalmakerlvl2
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armckmakr
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found armmakr
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found cmetalmakerlvl2
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found corhmakr
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found cormakr
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: Found tllmm
[f=0000930] <SkirmishAI: Bla1AI 0.41.5 (team 0)>: unitDecider constructed
[f=0000930] ResourceMapAnalyzer by Krogothe, initialized for resource 0(Metal)
[f=0000960] Skirmish AI "Bla1AI" (ID:0, Short-Name:"Bla1AI", Version:"0.41.5") took over control of team 0

Code: Select all

public int init(int teamId, OOAICallback callback)
    {
        try
        {
            teamID = teamId;
            new CallbackHelper(callback);
            new UnitDecider();
            tracker = new EnemyTracker();
            manager = new UnitManager();
            rManage = new ResourceManager(this.teamID);
            Emanager = new EconManager(teamId, this.manager, this.rManage);
            Mmanage = new MilitaryManager(this.teamID, this.manager, this.rManage, this.tracker);
            assistMode = false;
        }
        catch (Exception ex)
        {
            CallbackHelper.say("Error in init");
            CallbackHelper.say(ex.toString());
            return 0;
        }
        return 0;
    }
0 x

lamer
Posts: 146
Joined: 08 Mar 2014, 23:13

Re: Java AI crashes with external libraries

Post by lamer » 04 Sep 2016, 02:03

Probably just messed up installation (wrong version of AIInterface.jar + JavaOO-AIWrapper.jar)?
Compiled Bla1AI+spring103.0 from link above and it kinda even killed NullAI.
(Tested with basic replacement of NullOOJavaAI stuff by Bla's SkirmishAI.jar + AIInfo.lua)

Checkout other working spring103 AI layout and installation: https://github.com/Anarchid/zkgbai
1 x

Bla
Posts: 79
Joined: 25 Feb 2013, 14:44

Re: Java AI crashes with external libraries

Post by Bla » 04 Sep 2016, 05:18

Ah, thanks so much, those new jars fixed my problem!

Btw, what do you mean my AI 'kinda' killed NullAI? :-)
0 x

lamer
Posts: 146
Joined: 08 Mar 2014, 23:13

Re: Java AI crashes with external libraries

Post by lamer » 04 Sep 2016, 12:20

WRT 'kinda': On Nuclear_Winter map Bla1AI built only eco and constructors till 10th minute, then spammed military units, ok so far. But after mexing half of the map and when scout didn't find NullAI in corner Bla1AI seized its activity - constructors, scout, everything went idle. I had to /cheat and move NullAI into Bla's LoS, then it attacked with everything it had.
0 x

Bla
Posts: 79
Joined: 25 Feb 2013, 14:44

Re: Java AI crashes with external libraries

Post by Bla » 04 Sep 2016, 17:35

Ah, I figured if my AI kept making units and sent out a fraction of them randomly it would eventually find everything, but it runs into bandwidth problems first...
0 x

Post Reply

Return to “AI”