Game servers on Axion¶
Requirements¶
To deploy this demo, you need:
- A Google Cloud project.
- An account that has the
owner
role on that Google Cloud project.
Prepare the environment¶
-
Open Cloud Shell.
-
Configure environment variables:
AGONES_NS="agones-system" AGONES_VER="1.49.0" CONTAINER_IMAGE_REPOSITORY_NAME="arm-gaming-demo" PROJECT_ID="<PROJECT_ID>" LOCATION="<LOCATION>" GKE_CLUSTER_NAME="arm-gaming-demo" GAME_SERVER_CONTAINER_IMAGE_URL="${LOCATION}-docker.pkg.dev/${PROJECT_ID}/${CONTAINER_IMAGE_REPOSITORY_NAME}/supertuxkart-example:0.17" export GAME_SERVER_CONTAINER_IMAGE_URL
Where:
<PROJECT_ID>
is the ID of your Google Cloud project.<LOCATION>
is the location where to provision cloud resources. Example:us-central1
-
Clone this repository:
-
Change the working directory to the directory where you cloned this repository:
-
Select the Google Cloud project where to provision resources:
Provision and configure cloud infrastructure¶
-
Enable Google Cloud APIs:
-
Create a Artifact Registry repository for container images:
-
Create a VPC network and a subnet:
-
Create a Google Kubernetes Engine (GKE) autopilot cluster:
-
Configure firewall rules to allow connections to game servers running in the cluster:
-
Configure the cluster connection:
Build the game server for arm64¶
-
Build the game server container image for the
arm64
architecture, and push it to the registry:gcloud builds submit \ --config=projects/arm-reference-guides/gaming-demo/cloud-build/game-server.yaml \ --project "${PROJECT_ID}" \ --region "${LOCATION}" \ --substitutions=_LOCATION="${LOCATION}",_REPOSITORY="${CONTAINER_IMAGE_REPOSITORY_NAME}" \ --machine-type=e2-highcpu-8
The container image build takes about 25 minutes.
Deploy backend services¶
-
Configure Helm:
-
Install Agones:
-
Deploy game servers:
-
Get information about the game server fleet:
The output is similar to the following:
-
Take note of the game server external IP address and port:
The output is similar to the following:
Connect to the game server¶
On a host where you have access to a graphical desktop interface:
-
Download the game client
-
Start the game client you downloaded earlier by running the executable for your operating system.
-
Navigate to Online Play: from the main menu, select the “Online” option and then select “Enter server address” from the available options.
-
Enter Server Details: In the subsequent screen, you will be prompted to input the IP address and port number in order to join the game. Enter the IP address and port number obtained from the kubectl get gameservers command.
-
Join the Game: After entering the server details, proceed to join the server. You should now be connected to your Agones-managed game server and ready to play.
Destroying the demo¶
To destroy the demo environment, you do the following:
-
Destroy firewall rules:
-
Destroy the GKE cluster
-
Destroy the VPC network
-
Destroy the Artifact Registry repository