Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.jaspergeurtz:jbwapi:2.1.0'
}
dependencies {
implementation("com.github.jaspergeurtz:jbwapi:2.1.0")
}
<dependency>
<groupId>com.github.jaspergeurtz</groupId>
<artifactId>jbwapi</artifactId>
<version>2.1.0</version>
</dependency>
libraryDependencies += "com.github.jaspergeurtz" % "jbwapi" % "2.1.0"
:dependencies [[com.github.jaspergeurtz/jbwapi "2.1.0"]]
Pure Java bwapi 4.4.0 client implementation backed by N00byEdge's JavaBWAPIBackend idea and automated by Bytekeeper.
Also contains a modified version of the pure Java BWEM implementation from BWAPI4J.
Async
support for realtime tournament constraints, made possible by dgantMaven
Add JitPack as a repository:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add JBWAPI to your dependencies in <dependencies></dependencies>
:
<dependency>
<groupId>com.github.JavaBWAPI</groupId>
<artifactId>JBWAPI</artifactId>
<version>2.1.0</version>
</dependency>
Gradle
Add JitPack as a repository:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add JBWAPI as a dependency:
dependencies {
implementation 'com.github.JavaBWAPI:JBWAPI:2.1.0'
}
Jar
Alternatively add the latest .jar from the releases page to your project.
mvnw.cmd package
or if you already have maven installed
mvn package
A simple Hello World
bot is as easy as
import bwapi.*;
class HelloBot extends DefaultBWListener {
private BWClient bwClient;
@Override
public void onFrame() {
Game game = bwClient.getGame();
game.drawTextScreen(100, 100, "Hello World!");
}
public static void main(String[] args) {
HelloBot bot = new HelloBot();
bot.bwClient = new BWClient(bot);
bot.bwClient.startGame();
}
}
The API documentation can be found here.
You can also ask any further questions on the SSCAIT Discord
If you are a just starting out with bot development, it might be helpful to follow the tutorial!
Some bots using JBWAPI (feel free to open a pullrequest to add yours!)
If you use Linux you can choose to develop normally and run the jar
and starcraft
using wine
or try to use openbw
by following the following instructions