This is a Java wrapper for BWAPI 4.2.0. It is intended to replace older projects such as bwmirror and JNIBWAPI.
BWAPI4J is compatible with both the original BW (on Windows) as well as OpenBW (on Linux)
The project consists of three parts:
- The eclipse Java project "BWAPI4J" containing all Java classes
- The VS2017 C++ project "BWAPI4JBridge" containing the C++ code required to interact with the original BW
- The eclipse C++ project "OpenBWAPI4JBridge" containing the C++ code required to interact with OpenBW
This is a development version, and breaking changes can occur at any time.
Clone the BWAPI4J repository:
git clone https://github.com/OpenBW/BWAPI4J.git
Clone the OpenBW BWAPI repository:
git clone https://github.com/OpenBW/bwapi.git
Prerequisites:
Both Eclipse and Gradle are optionial in theory. However, it is greatly recommended to use Gradle to build the project, since it automates the build process and reduces it to executing a single Gradle target. Eclipse is recommended because it works seamlessly with Gradle (using the Gradle Wrapper) and Git and both the Java project and the C++ project can be developed in the same IDE.
-
JDK 1.8 (32bit for original BW and 64bit for OpenBW) or later installed
-
Eclipse installed (preferably Eclipse CDT with out-of-the-box support for C++)
-
Gradle, JUnit, and Git plugins for Eclipse
-
Alternatively to Eclipse / Eclipse Gradle plugin: Gradle install
-
BrooDat.mpq, StarDat.mpq, Patch_rt.mpq from the original BW (available for free)
-
At least one melee map. For example from the SSCAIT map pack
Note: the original game does not have to be installed. Only the 3 files mentioned are required.
Build Steps:
-
Import the project as follows:
- in eclipse, choose:
File -> Import... -> Git/Projects from Git -> Existing Local Repository - if BWAPI4J does not appear, choose
"add..."and add "/git/bwapi4j" where is the path to your git directory - Select
Import existing Eclipse projectsand clickNext - Select
BWAPI4Jand clickFinish
- in eclipse, choose:
-
Copy
gradle.properties.sampletogradle.propertiesand add the path to your JDK at the keyorg.gradle.java.home= -
Execute the gradle target
distribution / assembleDistWindows -> Show View -> Other... -> Gradle/Gradle Tasks- In the view, click the
Refresh Tasks for All Projectsicon - The BWAPI4J project should appear. Navigate to
distributionand double-click onassembleDist
Run the smoke test:
- copy
BrooDat.mpq,StarDat.mpq, andPatch_rt.mpqto the root directory of the eclipse project - copy
bwapi-data/bwapi.ini.sampletobwapi-data/bwapi.ini - Right-click the project and choose
Run as... -> JUnit Test
The smoke test starts a game and sends the first SCV to the first mineral patch it finds.
Prerequisites:
Eclipse is optional. However, it is recommended, since it allows to develop both the Java project and the C++ project within the same IDE.
- gcc compiler supporting c++14a
- Eclipse CDT installed
Build Steps:
-
Import the project as follows:
- in eclipse, choose:
File -> Import... -> Git/Projects from Git -> Existing Local Repository - if BWAPI4J does not appear, choose
"add..."and add "/git/bwapi4j" where is the path to your git directory - Select
Import existing Eclipse projectsand clickNext - Select
OpenBWAPI4JBridgeand clickFinish - Add
<path to JDK>/includeand<path to JDK>/include/linuxto the include section underProject -> Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Includes - Click the
Build releaseicon in the Eclipse menubar
- in eclipse, choose:
Prerequisites:
- Windows
- Visual Studio 2017 installed
Build Steps:
- Open the complete BWAPI4JBridge solution, including the BWAPI4JBridge project inside the solution from
<your path>/git/BWAPI4J/BWAPI4JBridge/where is the path to your git directory. - Build the DLL to be used in the Java project via "Build - Rebuild BWAPI4JBridge" with the targets "Release" and "x86"