Generally, when an internal developer is tasked with building a demo for a trade show, that demo offers up some mundane task, automated in a reproducible fashion. When it comes to enterprise software built on microservices, "Hello World" and the sock shop app aren't quite enough to flex all those behind-the-scenes application muscles.
Naturally, building a game with microservices would be a bit more fun for those involved, but generally, a simple 2D game doesn't exactly tax backend services. But that's only because they usually don't have to. When the a ramshackle team of former game developers and aspiring game makers gathered together to build an obscenely over-engineered demonstration game for this year's Red Hat Summit, they had similar thoughts.
In the end, however, they found plenty of ways to utilize the hosted services inside of their OpenShift cluster. These services are integrated into Pod Escape, a 1-minute-long runner game built in the style of endless runner games.
For a start, the high scores are kept in OpenShift Container Storage. While they encompass a minuscule amount of data overall, the interesting aspect is working with dynamic storage in an OpenShift cloud. Unlike ephemeral storage, state is kept long term here on stable yet dynamically provisioned storage mediums.
The game itself is based on the behavior of Kuberentes, said Roddie Kieley. "The player character is a pod as you would host on Kubernetes. You’re trying to escape from being shut down and evicted from a node. We have this thing called a grace period, where once a pod gets shut down it has a maximum of 60 seconds before it gets terminated. It’s trying to get to another node or escape from on-prem to the cloud to survive. That timeline came in naturally because before there was virtual summit, at summit there would have been a physical display with 4 laptops running this game, and the location would have setup an automatic real time limit to how much people would play because it was in an area people would pass through."
With the game going online instead, the team expects more competition for high scores, and more repeat players.
As with most things at Red Hat, Pod Escape was built in an open, collaborative fashion. It was essentially built by anyone at Red Hat who was interested in joining the team. As a distributed project built by developers around the world, distributed development tools were important to success.
"We all had different backgrounds. A bunch of us had done custom game development, with Unity and Unreal, but we pretty quickly settled on Godot, an open source game development environment similar to Unity in some ways, and different in others. It has a number of different languages you can use from a programmer standpoint to develop content for the game. We settled on C#. Microsoft jumped in upstream of Godot and did an integration with their Mono back end, and allowed Godot developers and C# developers to come to the same place," said Kieley.
Of course, the source code for Pod Escape is available on GitHub. Feel free to try and get it running on your own clusters. It's a great way to learn about coordinating microservices in an application that doesn't include a million lines of code.
The Pod Escape team would like to offer the following thanks:
THANKS TO THE FOLLOWING
COMMUNITIES AND TEAMS
The Godot community
The Kubernetes community
The OpenShift community
The IBM Cloud team
The Red Hat OpenShift Container Storage team
The Red Hat Virtual Summit event team
IBM Cloud Coordination
Juan Jose Floristan Jusue
Music & SFX
OpenShift Ecosystem, OpenShift 4