alvarofpp / docker-s2client

This docker image was built to facilitate the development of scripted bots and research using the s2client-proto.

Home Page:https://hub.docker.com/r/alvarofpp/s2client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker for StarCraft II Client

Docker Hub

This docker image was built to facilitate the development of scripted bots and research using the s2client-proto.

Tags

This docker image have one tag for each one version listed in Linux Packages. You can see all tags here.

Example: if you want to take the version 4.9.3, you need to specify this version in the docker pull command: docker pull alvarofpp/s2client:4.9.3.

The latest is the same image of the 4.10, because it's the latest version until this moment. If you use the latest version, you can ignore the :<version> in these commands below.

Getting Started

These instructions will cover usage information and for the docker container.

Prerequisites

In order to run this container you'll need docker installed.

Usage

Docker pull command:

docker pull alvarofpp/s2client:<version>

And run the client:

docker run --rm alvarofpp/s2client:<version> run_client

Run your client in a specific port:

docker run --rm --env CLIENT_PORT=13000 alvarofpp/s2client:<version> run_client

Environment Variables

  • CLIENT_PORT - The port the client runs on. By default is 12000.

Maps and minigames

This image already comes with the all maps listed in Map Packs and the pysc2's minigames (version 1.2). But if you need add more maps or minigames, you can through the command:

docker cp <map_folder> <container_id>:/root/StarCraftII/Maps/

All maps and minigames downloaded for the image are listed in image/maps.txt.

Use multi-stage builds

Using Docker's multi-stage, you can copy the StarCraft 2 files and use it in your own Docker image.

FROM alvarofpp/s2client:4.10 AS sc2client
FROM python:3.9.10

# ...
COPY --from=sc2client /root/StarCraftII /root/StarCraftII

Display graphics (Linux)

If you want to display graphics during the script execution, you can follow the steps below.

Step 1

docker run -i -t -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro alvarofpp/s2client:<version>

Description:

  • -i: sets up an interactive session;
  • -t: allocates a pseudo tty;
  • -e: sets the host display to the local machines display (which will usually be :0);
  • -v: bind mounts the X11 socket residing in /tmp/.X11-unix on your
    local machine into /tmp/.X11-unix in the container and :ro makes the socket read only.

Step 2

In your local machine:

xhost +
# access control disabled, clients can connect from any host

xhost
# access control disabled, clients can connect from any host
# SI:localuser:username

Save the last line of the xhost result (in this example it's SI:localuser:username) for use in the next step.

Step 3

In your docker container:

xhost +si:localuser:username
# localuser:username being added to access control list

Done! After that, you can run your script.

Reference here.

Contributing

Contributions are more than welcome. Fork, improve and make a pull request. For bugs, ideas for improvement or other, please create an issue.

License

This project is licensed under the MIT License - see the LICENSE file for details. If you use this docker image, you also agree to AI and Machine Learning License.

About

This docker image was built to facilitate the development of scripted bots and research using the s2client-proto.

https://hub.docker.com/r/alvarofpp/s2client

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Shell 57.9%Language:Dockerfile 22.3%Language:Makefile 19.8%