BoardGameWork (BGW) is a framework for creating 2D board game applications using Kotlin.
Start with BGW using the dedicated Getting Started guide, take a look at the complete API Reference or learn more concepts in the Advanced Usage section.
Additionally, three examples are available for MauMau, Sudoku and Tetris.
Visit the Playground to see BGW in action and try out some of its features.
Before you can start using BGW, you will need a Java Development Kit (JDK) installed on your system. BGW requires at least Java 11 to run. You can download a compatible version of Azul Zulu OpenJDK from the official website.
Start by adding the latest version of BGW as a dependency to your project.
implementation(group = "tools.aqua", name = "bgw-gui", version = "0.10")
<dependency>
<groupId>tools.aqua</groupId>
<artifactId>bgw-gui</artifactId>
<version>0.10</version>
</dependency>
When running on JDK 16 or later, you need to add the following JVM arguments to your run configuration:
application {
applicationDefaultJvmArgs = listOf(
"--add-opens", "java.desktop/sun.awt=ALL-UNNAMED",
"--add-opens", "java.desktop/java.awt.peer=ALL-UNNAMED",
"--add-opens", "java.desktop/sun.lwawt=ALL-UNNAMED",
"--add-opens", "java.desktop/sun.lwawt.macosx=ALL-UNNAMED"
)
}
<configuration>
<jvmArguments>
--add-opens java.desktop/sun.awt=ALL-UNNAMED
--add-opens java.desktop/java.awt.peer=ALL-UNNAMED
--add-opens java.desktop/sun.lwawt=ALL-UNNAMED
--add-opens java.desktop/sun.lwawt.macosx=ALL-UNNAMED
</jvmArguments>
</configuration>
It is therefore recommended to explicitly specify the correct JVM target (e.g. 11 in this case) in your build system:
compileKotlin {
kotlinOptions.jvmTarget = "11"
}
<configuration>
<jvmTarget>11</jvmTarget>
</configuration>
The basic setup should now be complete. To learn more about creating your first board game application using BGW, continue with the Getting Started section or visit the Playground.