Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ocraft/ocraft-s2client
StarCraft II Client - Java library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
https://github.com/ocraft/ocraft-s2client
ai artificial-intelligence java starcraft-ii starcraft-ii-bot starcraft2
Last synced: 15 days ago
JSON representation
StarCraft II Client - Java library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
- Host: GitHub
- URL: https://github.com/ocraft/ocraft-s2client
- Owner: ocraft
- License: mit
- Created: 2017-11-16T21:58:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-02-25T23:50:02.000Z (4 months ago)
- Last Synced: 2024-03-01T09:33:58.030Z (4 months ago)
- Topics: ai, artificial-intelligence, java, starcraft-ii, starcraft-ii-bot, starcraft2
- Language: Java
- Homepage:
- Size: 16.4 MB
- Stars: 54
- Watchers: 5
- Forks: 15
- Open Issues: 3
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE.txt
Lists
- awesome-sc2-ai - ocraft-s2client
- awesome-starcraft2 - ocraft - A java wrapper around Starcraft 2's C++ api. (Software Packages)
README
ifdef::env-github[:outfilesuffix: .adoc]
[[ocraft]]
= Ocraft S2Clientimage:https://img.shields.io/badge/license-MIT-brightgreen.svg[alt="MIT License"]
The StarCraft II Java API provides access to in-game state observation and unit control. The API is a wrapper around protobuf
defined protocol over a websocket connection..Discord Server
* Unofficial server for discussing AI questions and projects.
* https://discordapp.com/invite/Emm5Ztz[Invite Link] // see #java-api channel.Documentation
*link:http://ocraft.github.io/ocraft-s2client[]*[[ocraft.bot]]
== Ocraft S2Client BotOcraft Bot is a Java port of Blizzard's C\++ Api for Starcraft 2. All of documentation and user-experience of C++
sc2client-api should be valid or similar by analogy in this Java Api. More info about C++ Api:* https://github.com/Blizzard/s2client-api
* https://blizzard.github.io/s2client-api/.Maven
[source,xml]
----com.github.ocraft
ocraft-s2client-bot
0.4.19----
.Examples
https://github.com/ocraft/ocraft-s2client/tree/master/ocraft-s2client-sample[Examples are provided in ocraft-s2client-sample module.]
[source,java]
----
package com.github.ocraft.s2client.sample;import com.github.ocraft.s2client.bot.S2Agent;
import com.github.ocraft.s2client.bot.S2Coordinator;
import com.github.ocraft.s2client.protocol.data.Abilities;
import com.github.ocraft.s2client.protocol.game.BattlenetMap;
import com.github.ocraft.s2client.protocol.game.Difficulty;
import com.github.ocraft.s2client.protocol.game.Race;
import com.github.ocraft.s2client.protocol.unit.Alliance;public class SampleBot {
private static class TestBot extends S2Agent {
@Override
public void onGameStart() {
System.out.println("Hello world of Starcraft II bots!");
}@Override
public void onStep() {
long gameLoop = observation().getGameLoop();if (gameLoop % 100 == 0) {
observation().getUnits(Alliance.SELF).forEach(unitInPool ->
actions().unitCommand(
unitInPool.unit(),
Abilities.SMART,
observation().getGameInfo().findRandomLocation(), false));
}
}}
public static void main(String[] args) {
TestBot bot = new TestBot();
S2Coordinator s2Coordinator = S2Coordinator.setup()
.loadSettings(args)
.setParticipants(
S2Coordinator.createParticipant(Race.TERRAN, bot),
S2Coordinator.createComputer(Race.ZERG, Difficulty.MEDIUM))
.launchStarcraft()
.startGame(BattlenetMap.of("Lava Flow"));while (s2Coordinator.update()) {
}s2Coordinator.quit();
}}
----If you are interested in the inner working of the game protocol or you want to have low access to the game api for
specific purposes, check link:ocraft-s2client-api/README.adoc[ocraft-s2client-api] module which is a low level api on
top of which ocraft-s2client-bot is build.