Skip to content

Install and Configure

WolfgangKonen edited this page Jan 28, 2023 · 53 revisions

Starting the framework

To get an easy start into the framework, download GBGLaunch.jar from the Code - Release section and start it by double-clicking on it (or start it from a cmd window).

Start any game and select from the menu Help - Help File as PDF in order to view the GBG Help with all further informations. Or select from the menu Help - Game Rules as PDF to view the game rules.

Compiling the framework

Download GBG from this GitHub repository.

Have Java 1.14 or higher installed.

If IntelliJ IDEA is your preferred IDE

Make a new IntelliJ project (New - Project) with build path GBG (the downloaded directory, containing src/ and lib/)

  1. Libraries: if any .zip files from subdirectories of agents/ are proposed as libraries: de-select them.
  2. Click through the New Project dialog until Finish.
  3. Specify Test folder: File - Project Structure... – Modules – Tests (green) and mark directory test/.
  4. Specify Resources folder: File - Project Structure... – Modules – Resources(gray-yellow) and mark directory resources/.
  5. Start the GUI: Right mouse on GBGLaunch.java (package starters) - Run.
  6. Similarly, to start the batch facility: Right mouse on GBGBatch.java (package starters) - Run.
  7. Optional: Modify Run Configurations... and enter -ea -Xmx12096M (enable assertions and extended heap space) in the VM options text field. For GBGBatch.java you have to specify additional arguments, see the Javadoc on GBGBatch.

If Eclipse is your preferred IDE

Make a new Eclipse project (New - Java Project) with build path GBG (the downloaded directory, containing src/ and lib/)

  1. Project Properties - Java Compiler - Compiler Compliance Level: 1.8. And have the other two compliance levels in this window also set to 1.8.
  2. Include GBG/src and GBG/test into the Java Build Path.
  3. Start the GUI: Right mouse on GBGLaunch.java (package starters) - Run - Run As... - Java Application.
  4. Similarly, to start the batch facility: Right mouse on GBGBatch.java (package starters) - Run - Run As... - Java Application.
  5. Optional: Edit Run - Run Configurations - Arguments - VM args = "-ea" (enable assertions, if you want them). For GBGBatch.java you have to specify additional arguments, see the Javadoc on GBGBatch.

Building a JAR under IntelliJ IDEA

Example: Build and run GBGBatch.jar.

  • File - Project Structure (Strg+Alt+Umschalt+S) – Artifacts – Add (+) – JAR – empty
  • specify a name for the new JAR: GBGBatch.jar
  • click on GBGBatch.jar and specify a main class
  • specify output directory: C:\Users\wolfgang\Documents\GitHub\GBG\jartools
  • Output Layout – (+) – Module Output – SourceGBG compile output
  • AND add all needed libraries via Output Layout – (+) – Extracted Directory
    • cmaes, commons-compress, commons-math, jcommon, jfreechart

Close the Project Structure window and issue

  • Build – Build artifacts … – GBGBatch – Build

This will create GBGBatch.jar in the directory jartools/.

Libraries

If the libraries are not all found by the compiler (normally they should be found automatically in lib/), locate them 'by hand' via 'Project Properties'

  1. Java Build Path - Libraries - Add JARs... - GBG/lib/jfreechart-1.0.17/jcommon-1.0.21.jar
  2. Java Build Path - Libraries - Add JARs... - GBG/lib/jfreechart-1.0.17/jfreechart-1.0.17.jar
  3. Java Build Path - Libraries - Add JARs... - GBG/lib/commons-compress-1.9/commons-compress-1.9.jar
  4. Java Build Path - Libraries - Add JARs... - GBG/lib/commons-math3-3.6.1.jar
  5. Java Build Path - Libraries - Add JARs... - GBG/lib/guava-31.0.1-jre.jar
  6. Java Build Path - Libraries - Add JARs... - GBG/lib/junit-runners-1.3.jar
  7. Java Build Path - Libraries - Add JARs... - GBG/lib/Ludii-1.3.0.jar

If the JAR file commons-compress-1.9.jar is not on your system, locate it from lib/commons-compress-1.9 or download it from https://commons.apache.org/proper/commons-compress/download_compress.cgi. This is needed for Add JARs... above and for the imports in agentIO/LoadSaveTD.java:

	import org.apache.commons.compress.archivers.ArchiveException;

and similar.

JFreeChart is under Eclipse normally available as User Library, but its JAR (v1.0.17) is for convenience also available in GBG/lib). If not, follow the tipps in jfreechart-1.0.17-install.pdf, p. 31-35.

If this PDF is not available locally, download it from https://sourceforge.net/projects/jfreechart/files/2.%20Documentation/1.0.17/jfreechart-1.0.17-install.pdf.

Tips and tricks

The following tips and tricks are for IDE Eclipse:

If help files or image files for the game board (e.g. Connect Four) are not found, do the following to locate them: Edit .classpath and add line

	<classpathentry excluding="**/*.java" kind="src" path="resources"/>

For other IDEs it might be necessary to have "GBG/resources" in your CLASSPATH environment variable or to work with the "-classpath GBG/resources" compiler switch.

If the help files in GBG/resources change: Right mouse on project root, F5, Build project. Then the help files will be automatically copied from GBG/resources to GBG/bin, and there the program will find them.

When training a big net, there can be a heap-memory crash. How to cure: Set this option in Run - Run Configurations - Arguments - VM-Arguments

	-Xmx12096M -ea

then the program gets 12096 MB heap space and the error is gone. The additional argument -ea enables all assertions in the Java code to make sanity checks during runtime.

For an in-depth description of classes and interfaces in GBG see the technical report on GBG [Konen2022a].