Replay Visualizer

Just want to know if anybody had the time to make a basic replay visualizer and are willing to share it? Sure it will make it easier to help identify which round a bot makes wrong decisions :slight_smile:

I also want a visualizer. If I can find the time, I might try to whip up something basic over the weekend - and I’m quite happy to share it with the forum.

Just remember rfnel that the rules will change after this first event so just keep that in mind. I believe the most obvious thing coming next will be new bullet types (and possibly ship types too…I would guess).

I hacked together something basic. It’s not well-tested and it’s not beautiful, production-ready code - but it works well enough to give me an idea of what’s going on. Feel free to try it out (and you’re more than welcome to add to it). You’ll need Java and Maven to build and run it - and I’ll admit that I’m too lazy to write proper documentation on a Sunday evening. You’ll just need to build it and run the Visualizer.jar file with Gson on the classpath and the location of your replay directory (for a specific match) as a command line argument.

Thank you rfnel,

I will definitely give it a try. I don’t have any experience with Java to add to the project, but if it shows the basics it is much better than manually searching through the replay :slight_smile:

Hi rfnel sorry to bother but I keep getting the following error:

java Gson .\target\Visualizer.jar .\target\replay
Error: Could not find or load main class Gson

Am I doing anything wrong? I build the application with maven by running: mvn package

Hi Kortgat,

You need to specify the ‘-cp’ argument to tell the Java Virtual Machine what you want on the classpath.:slight_smile: Based on the command that you’ve got there, Java thinks that the main class in the application is called ‘Gson’, while it’s actually just a library for reading Json.

I updated the Maven config to explicitly generate a lib file to make it easier for non-Java folks to run the visualizer without having to worry about stuff like the classpath. If you grab the latest version from Github and build it, you should find a lib directory in the target folder. See the commands for building and running it below.

mvn clean install java -cp Visualizer.jar;lib\* za.co.rfn.Visualizer "<path to dir>"

Hi,

I am getting the following error message after a successful build when I use the command: java -cp Visualizer.jar;lib* za.co.rfn.Visualizer “…\…\Game Engine - Version 1.0.1\Version 1.0.1\Game Engine\Replays\2017-05-22 20-51-05-375”

_Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gson/Gson_

_ at za.co.rfn.ui.VisualizerRunner.(VisualizerRunner.java:28)_
_ at za.co.rfn.Visualizer.main(Visualizer.java:38)_
Caused by: java.lang.ClassNotFoundException: com.google.gson.Gson
_ at java.net.URLClassLoader.findClass(Unknown Source)_
_ at java.lang.ClassLoader.loadClass(Unknown Source)_
_ at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)_
_ at java.lang.ClassLoader.loadClass(Unknown Source)_
_ … 2 more_

The file target/lib/gson-2.3.1.jar exists.

Anything I need to check or change with the way I am trying to run it?

Looks like there might be a missing slash in your classpath (lib* as opposed to lib\*) - although that might just be formatting on the forum. Also are you running Linux by any chance? If so, your path separator will be ‘:’ and not ‘;’.

This was the issue, somehow that slash got lost in copy-pasta…

Thank you This works 100%

I just added some functionality to indicate which ships are placed where. Also, bhaeussermann submitted a pull request that allows you to pause the game and navigate between rounds with the arrow keys (see the README.md for detail). Thank bhaeussermann!

Hi Everyone,

Raezor07 was kind enough to also make a game visualizer. You can have a look at it here:
https://github.com/EntelectChallenge/2017-Battleships/tree/master/GameVisualizer