Skip to content
Glen edited this page Feb 17, 2015 · 3 revisions

JNIBWAPI wiki

JNIBWAPI allows you to build a Starcraft AI in Java. It is a wrapper around the C++ Brood War API (BWAPI).

Getting Started

Take a look at the getting started guide. If anything is unclear or does not work as expected, please edit the page or file a bug report on the issues page.

If you want to make changes to the C++ side of JNIBWAPI, take a look at the modifying JNIBWAPI guide.

Documentation

JNIBWAPI (as of version 1.0) aims to closely mimic the API of BWAPI (version 3.7.4).

Therefore, the best place to look for documentation is in the BWAPI 3 documentation. More general information is available at the BWAPI website.

If anything in JNIBWAPI does not work as expected according to the BWAPI documentation, please file a bug report on the issues page.

How it Works

JNIBWAPI uses JNI to communicate between Java and BWAPI's C++ code.

JNIBWAPI itself works as a BWAPI AI Client, with the C++ code in src/c acting as a binding between the BWAPI and Java processes. The code in src/java/jnibwapi encapsulates the C++ function calls and tries to replicate the interface of the BWAPI Game class.

By implementing the BWAPIEventListener interface (as done by the example AI), a Java class can receive callbacks identical to a BWAPI AI Module.

Overview diagram JNIBWAPI connection to Starcraft over shared memory bridge

The JNI interface provides several advantages over the previous socket-based ProxyBot interface. First, the interface uses the BWAPI shared memory bridge which lessens the communication bottleneck between C++ and Java and prevents cheating using direct memory access. Second, the BWAPI utility functions (e.g. canBuildHere) can be now be called from Java. Finally, the use of JNI should result in easier project maintainability and extensibility.

Clone this wiki locally