Code Monkey home page Code Monkey logo

zkgbai's People

Contributors

aeonios avatar anarchid avatar deinfreund avatar mojjj avatar pasthelod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zkgbai's Issues

Endgame crash

[f=0068025] <SkirmishAI: ZKGBAI (team 5)>: exception(java.lang.NullPointerException
at zkgbai.kgbutil.Pathfinder.findPath(Pathfinder.java:96)
at zkgbai.military.fighterhandlers.RetreatHandler.retreatCowards(RetreatHandler.java:117)
at zkgbai.military.fighterhandlers.RetreatHandler.update(RetreatHandler.java:76)
at zkgbai.military.MilitaryManager.update(MilitaryManager.java:1233)
at zkgbai.ZKGraphBasedAI.update(ZKGraphBasedAI.java:250)
) java.lang.NullPointerException

ZKGBAI freezes on start on Spring 103.0.1-516

After spawning, saying glhf, analyzing the map, parsing the json metalmap message, and merging all its commanders, the AI attempts no further actions. There are no exceptions in infolog. I didnt check kgbdebug. This is an engine compatibility and not a game compatibility issue, because same game version on older engine works.

Circuit doesn't seem to have this problem so it's likely some kind of a logical change.

patch: make ant install target a bit more cross-platform

Hello again, I hope you don't mind the issue spam.

diff --git a/build.xml b/build.xml
index 17ff208..9bc5ced 100644
--- a/build.xml
+++ b/build.xml
@@ -41,15 +41,10 @@
   </target>

   <target name="install" depends="dist">
-       <exec executable="mkdir">
-               <arg value="-p"/>
-               <arg value="${installDir}"/>
-       </exec>
-       <exec executable="cp">
-               <arg value="-r"/>
-               <arg value="${dist}/"/>
-               <arg value="${installDir}"/>
-       </exec>
+       <mkdir dir="${installDir}" />
+       <copy overwrite="true" todir="${installDir}">
+               <fileset dir="${dist}/" />
+       </copy>
   </target>

   <target name="clean"

Even one instance of ZKGBAI produces insane CPU load/lag

Pretty much what title says. Sometimes it begins to lag at the very start, but always at the end of match.

AI is (10af1d0) built from source by javac 1.7.0_91

JRE is openjdk 7

java version "1.7.0_91"                        
OpenJDK Runtime Environment (IcedTea 2.6.2) (7u91-2.6.2-1)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)

Hardware is 2.3 ghz 8-core i7.

Graph manager broke horribly

After I added the new porc algorithm suddenly everything broke horribly. After a thorough investigation I found out that graphmanager started shifting metal spots around randomly, causing mexes to be placed off center and other shenanigans. The only thing I changed in graph manager was to add getMexes() (a one liner), which I wasn't using originally when it started breaking. It doesn't throw errors consistently, but sometimes it shows array out of bounds.

IntegerInterleavedRaster.getDataElements ArrayIndexOutOfBoundsException

I've got a few exceptions (about 4 more like these), I thought they worth a new issue.

[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: ZK boxes detected
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: LosManager initialized.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Detected 130 metal spots in GRP
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: GraphManager initialized.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: EconomyManager initialized.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: MilitaryManager initialized.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: FactoryManager initialized.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Large Map Detected: Enabling Air Starts.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Checking Veh Pathability..
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Path Check Failed: unreachable mexes.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Average Relative Path Cost: 1.4227375
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Checking Hover Pathability..
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Path Check Failed: unreachable mexes.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Average Relative Path Cost: 1.4432367
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Checking Bot Pathability..
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Average Relative Path Cost: 1.4145821
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Path Check Failed: high path costs.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Checking Spider Pathability..
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Average Relative Path Cost: 1.1526521
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Terrain Analysis: Spider path check succeeded, enabling spiders and jumps!
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Selected Commander: Zweihander level 0.
[f=0000000] <SkirmishAI: ZKGBAI 0.5 (team 1)>: Start Position Selected!
...
[f=0034187] game_message: Reaper is under attack
[f=0034337] game_message: Reaper is under attack
[f=0034487] game_message: Reaper is under attack
[f=0034638] game_message: Banisher is under attack
[f=0035218] game_message: Reaper is under attack
[f=0035940] <SkirmishAI: ZKGBAI 0.5 (team 1)>: exception(java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
    at sun.awt.image.IntegerInterleavedRaster.getDataElements(Unknown Source)
    at java.awt.image.BufferedImage.getRGB(Unknown Source)
    at zkgbai.military.MilitaryManager.getEffectiveThreat(MilitaryManager.java:275)
    at zkgbai.military.MilitaryManager.assignRaiders(MilitaryManager.java:369)
    at zkgbai.military.MilitaryManager.update(MilitaryManager.java:908)
    at zkgbai.ZKGraphBasedAI.update(ZKGraphBasedAI.java:201)
 ) java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
[f=0035955] <SkirmishAI: ZKGBAI 0.5 (team 1)>: exception(java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
    at sun.awt.image.IntegerInterleavedRaster.getDataElements(Unknown Source)
    at java.awt.image.BufferedImage.getRGB(Unknown Source)
    at zkgbai.military.MilitaryManager.getEffectiveThreat(MilitaryManager.java:275)
    at zkgbai.military.MilitaryManager.assignRaiders(MilitaryManager.java:369)
    at zkgbai.military.MilitaryManager.update(MilitaryManager.java:908)
    at zkgbai.ZKGraphBasedAI.update(ZKGraphBasedAI.java:201)
 ) java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
...

Code review

Somebody did a code review of kgb. See #ai for more info.

[19:55] bky: I did a code review of a piece of it as essentially a training exercise.
[19:56] bky: One of the things I noticed is a pattern that will make it randomly crash on some JVMs.
[19:57] bky: Line 310-315 of MilitaryManager
[19:59] bky: join() can experience interrupts from the JVM rather than a user thread.
[19:59] bky: This trips a System.exit(-1) to intentionally crash the AI
[20:03] Sprung: @Anarchid ^
[20:05] bky: I don't know what the fix should be because I don't know why it's intentionally crashing.
[20:06] bky: But it'd involve conditionally retrying the join().
[20:16] Sprung:

boolean ok = false;
while (!ok) {
    try {
        thread.join();
        ok = true;
    } catch (InterruptedException e) {
        // ignore, JVM is just being a dolt
    } catch (Exception e) {
        // something more brutal happened
        ai.printException(e);
        System.exit(-1);
    }
}

[20:16] Sprung: something like this presumably
[20:16] bky: yeah
[20:17] bky: There's also a separate concurrency issue if the AI experiences 15 frames of lag before the join() succeeds.
[20:18] bky: Potentially.
[20:18] bky: You might have two simultaneously running invocations of the same method fighting over the same threatmap.
[20:19] bky: I can't tell whether that actually happens without knowing whether the Module superclass tries to handle severe lag by not updating on some frames.

Wrong behaviour when losing the commander

When the commander is destroyed and all storage is lost, the AI starts building a lot of generators. This is probably because it sees that the energy storage has gone to zero. So it will keep overcommitting resources to generators, until it will eventually lose the game.
What it should do instead is build some storage, probably even before the commander is killed.

"StartBox" class missing..

the new startbox inference fix requires a StartBox class which was not included in any of your commits, which has left kgb uncompilable.

Picket Pushing: Line of Sight derpiness

KGB seems to try Picket pushing where the Pickets can't actually fire at their targets:
screen00018
It also really, really wants to finish Pickets, even if this costs it their commander:
screen00019

KGB apparently calculates line of sight shadows for other attacks. I'm not sure how to add this here, though.

Fresh clone of ZKGBAI ( 4382a1b ) does not compile with 'ant dist'

Log:

% ant dist
Buildfile: /home/user/tmp/spring/zkgbai-build/zkgbai2/build.xml

init:
    [mkdir] Created dir: /home/user/tmp/spring/zkgbai-build/zkgbai2/build

compile:
    [javac] /home/user/tmp/spring/zkgbai-build/zkgbai2/build.xml:23: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 88 source files to /home/user/tmp/spring/zkgbai-build/zkgbai2/build
    [javac] /home/user/tmp/spring/zkgbai-build/zkgbai2/src/zkgbai/kgbutil/Pathfinder.java:14: warning: Bool is internal proprietary API and may be removed in a future release
    [javac] import com.sun.org.apache.xpath.internal.operations.Bool;
    [javac]                                                    ^
    [javac] /home/user/tmp/spring/zkgbai-build/zkgbai2/src/zkgbai/ZKStartLocation.java:13: error: cannot find symbol
    [javac] public class ZKStartLocation extends StartArea {
    [javac]                                      ^
    [javac]   symbol: class StartArea
    [javac] /home/user/tmp/spring/zkgbai-build/zkgbai2/src/zkgbai/ZKStartLocation.java:22: error: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] /home/user/tmp/spring/zkgbai-build/zkgbai2/src/zkgbai/ZKStartLocation.java:32: error: method does not override or implement a method from a supertype
    [javac]     @Override
    [javac]     ^
    [javac] Note: /home/user/tmp/spring/zkgbai-build/zkgbai2/src/zkgbai/graph/GraphManager.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 3 errors
    [javac] 1 warning

BUILD FAILED
/home/user/tmp/spring/zkgbai-build/zkgbai2/build.xml:23: Compile failed; see the compiler error output for details.

Total time: 1 second

JDK9 build issue

Hello!

compile:
    [javac] F:\projects\zkgbai\build.xml:23: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 82 source files to F:\projects\zkgbai\build
    [javac] F:\projects\zkgbai\src\zkgbai\gui\AdditiveComposite.java:16: error: as of release 9, '_' is a keyword, and may not be used as an identifier
    [javac]     public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints _) {
    [javac]                                                                                                              ^
    [javac] 1 error

After replacing _ with __ here things are find and compiling.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.