If you are a user who only wants to code your own bot, then simply head to the snakebot client respository and follow the instructions there. There will be a docker-compose file there to easily get your own server and webclient running as containers without the need to clone them from here.
A multi player, server based snake game for computer bots as players
Clients connect via a websocket through which events and commands are sent bidirectionally. Following client implementations are up to date:
To clean and build:
> ./gradlew clean build
To run server locally:
> ./gradlew bootRun
To run server locally with increased memory:
> export JAVA_OPTS="-Xmx4096m" && ./gradlew bootRun
Snakebot can be deployed on-demand to production on GCP as a Kubernetes cluster (GKE) using Terraform.
You need the following CLI tools installed:
- terraform
- gcloud (for authenticating to GCP)
- kubectl (optional if you want to control the cluster through CLI)
First navigate into the directory:
cd terraform
Initalize the terraform modules and providers:
terraform init
Authenticate with GCP:
gcloud auth application-default login
Deploy the cluster:
terraform apply
(Optional) If you want to use kubectl, make gcloud set the context to use the newly created cluster:
gcloud container clusters get-credentials snakebot-cluster --region europe-north1
After you no longer need the cluster, you can deprovision it by running:
terraform destroy
NOTE: this requires the state files created from running terraform apply
. If you didn't provision the cluster from the current computer you need to run terraform apply
first.