Weekly AWS Builds

Share this post

Building a serverless game back-end using AWS Step Functions

nbtl.substack.com

Building a serverless game back-end using AWS Step Functions

I know, i know.. Serverless isn't cool anymore. Prime video reduced cost by 90%, feeding the already existing skepticism of 'why we need serverless'. Well - let me tell you a story about an use case.

Mart Noten
May 15, 2023
1
Share
Share this post

Building a serverless game back-end using AWS Step Functions

nbtl.substack.com

Prime video released their story on how to reduced cost of their AWS infrastructure by 90% when they moved away from Serverless and into containers. Amazon, as a company, shows their not afraid to innovate and keep moving forward - even if it hurts their own marketing.

This doesn’t mean that we should never take a look at serverless again. The compute heavy workloads and process numbers that Prime does is not something that you and I will have to work with for our personal projects. Heck, even most enterprise companies won’t need to do that type of compute.

What have I used Serverless for then?

Many, many (… many, many many) things. Example, I’ve been experimenting with Mobile App Development using Flutter over the last year or so.

Side note - I love the effect you can have on people with a good mobile app. You’re building a relationship with the apps you ship - more than a website with an URL can do. I know.. Probably not true, but it is how I feel. The fact you have that App Icon on your home screen creates a bond that a bookmark can’t.

Most recently, I’ve been experimenting with a real-time multiplayer game that leverages streaming updates using Firebase’ Cloud FireStore. This allows me to subscribe users to the changes and have the application update accordingly.

AWS Step Functions as a game engine

I see two options with regards to running the game engine:

  1. Have the game-engine run decentralized on one of the players phones

  2. Have the game-engine run using centralized infrastructure

Since I do not want to bother and abuse people’s phone (also for a range of technical reason) I’d prefer to have the engine run centrally. Now, cost-wise, this is where Serverless pops up again.

My game is rarely going to be played - ouch - so I do not want to have any major reoccurring cost. By leveraging AWS Step Functions I can combine a set of logical processes like updating records, keeping game state and identifying game rounds in one flow. Create a set of flows and you’ll end up with a game-engine.

Step Functions offer a nice visual workflow to track steps, state and execution

This ‘game-engine’ actually works amazingly well with consistent results. It has obvious gaps, when you need to work with tight latency numbers for example, but for my mobile game that no-one will play it offers a nice first step.

As soon as you want to do something a little bit more special with AWS Lambda then you’ll end up with AWS Step Functions. I’d recommend everyone to at-least take a look at it once. It will probably solve more issues than you can imagine.

👉 Want to read more?

Interested in reading more about games and Serverless development? Take a look at:

  • How Gamercraft and Theodo built a highly scalable serverless gaming tech platform (jan, 2021)

  • You can build and design your Step Function directly in Visual Studio Code (march, 2020)

I’m interested in hearing your thoughts: how are you thinking about these development in the Servless landscape? Does it surprise you? Are you enthaustistic about it?

Leave a comment

1
Share
Share this post

Building a serverless game back-end using AWS Step Functions

nbtl.substack.com
Comments
Top
New

No posts

Ready for more?

© 2023 Mart Noten
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing