This docker image was built to facilitate the development of scripted bots and research using the s2client-proto.
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.
These instructions will cover usage information and for the docker container.
In order to run this container you'll need docker installed.
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
CLIENT_PORT
- The port the client runs on. By default is12000
.
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
.
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
If you want to display graphics during the script execution, you can follow the steps below.
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 theX11
socket residing in/tmp/.X11-unix
on your
local machine into/tmp/.X11-unix
in the container and:ro
makes the socket read only.
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.
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.
Contributions are more than welcome. Fork, improve and make a pull request. For bugs, ideas for improvement or other, please create an issue.
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.