Planetarium Engineering Snack

Testing P2P Game with Kubernetes

(한국어)

Hello, I am Swen Mun, Libplanet developer at Planetarium. From December 16th last year, we held a 2-week alpha test of Nine Chronicles, a fully decentralized MMORPG. Today, we’re going to share our experience deploying headless games on Kubernetes.

What Did We Need?

A game developed with Libplanet is considered a blockchain node, and the same goes for Nine Chronicles. That is, every game client can play a role that is in itself similar to a typical game server (data storage, refereeing). To hold a test as close to a game environment in this P2P environment, we needed to run as many of these game clients at the same time.

Although we will be running the games, we’re focused on executing as many game clients at the same time so it’s not that important to see the screen of each client. Therefore, we’re OK with running headless without any UI.

Test Conditions

Docker

To meet these conditions, we needed to run and manage multiple processes at the same time, and that led us to use Docker. Docker is a popular solution for containerizing and running Linux applications throughout your environment. Although we’re not considering Linux as a major platform for Nine Chronicle’s first launch, developing games with Unity has made it relatively easy to produce a build for Linux, and apart from minor UI bugs (which doesn’t matter much for the headless test node), the behavior didn’t change much.

Kubernetes

Even though we used a Docker to make a container that easily runs a game build, that wasn’t the end. Our goal was to easily run/end/update many clients while maintaining a test environment. To do this, just using Docker wasn’t enough.

Our first option was the execution environment offered by cloud providers, such as ECS. These execution environments are designed to efficiently set up complex workflows. But in other words, they’re complex to set up and we wouldn’t be using a lot of functionality provided since we’re just using it in a test environment. Also, a test environment dependent on a particular cloud provider would likely to be a burden on future operations.

AWS Container Orchestration Comparison

AWS Container Orchestration Comparison

So the alternative we came up with was Kubernetes. Kubernetes is an open-source project that allows us to do what we want similar to services like ECS while being Provider Agnostic. The feature of running and stopping complex containers is called container orchestration, and because we wanted to run multiple containers (games) of the same kind, the setup wasn’t that complicated.

Coming Up

Next time we’ll take a look at the specific procedures for setting up the Kubernetes for testing and how to deploy it on the cloud.