Unlocking Collaborative Success: Mastering Data Sharing in Games

Fadzuli Said
Mighty Bear Games
Published in
3 min readNov 29, 2023

When we were figuring out how to share game data with partners, I knew that whatever solution we chose, there were challenges that needed to be tackled:

  1. Keeping the data safe and private
  2. Making sure it can handle growing demand without a hitch
  3. Being smart about the costs of bandwidth and infrastructure

We want to make sure everyone’s data stays secure, especially the sensitive stuff, and keep things running smoothly as our game, Mighty Action Heroes, gets more popular. Also, it’s important to balance the cost so that we can keep up a great partnership without breaking the bank.

Greeting Quests when we announced our collaboration with Treasure.

Right after Mighty Action Heroes Early Access 3.0 at the end of April this year, FastAPI was all the rage — and for good reason! FastAPI is known for being quick, secure, and able to grow with our needs. It’s got some cool tricks up its sleeve like automatic validation, and easy-to-understand documentation, and it even supports asynchronous programming. This means we can share data safely and efficiently. Plus, its strong security and ability to handle more as we grow make it a fantastic choice for both our team and our partners. It’s like a turbo-boosted Python, which was perfect for me to dust off my rusty Python skills and dive into some hands-on coding.

Photo by Andy Hermawan on Unsplash

We can structure our API into smaller modular components using include_route to help organize and keep things maintainable.

Documentation is automatically generated using the OpenAPI standard. Tags can be used to organize related APIs in the same way that include_route organizes the code.

Documentation automatically generated by FastAPI

Athena was used at first as a way to query the data but it proved to be quite costly. It provided support for large datasets which was not something we actually needed given the overheads. Furthermore, we needed the queries to be real-time so we ended up just accessing the game data directly in DynamoDB, using Boto.

In order to keep the APIs secure, we decided to use API keys. This also allowed us to track usage and apply rate limits to control costs.

We made sure the APIs were working correctly by creating unit and functional tests, and by simulating the data using FastAPI dependencies along with Pytest fixtures.

Photo by Hans-Jurgen Mager on Unsplash

We dipped our toes into FastAPI and found it a breeze to support our partners with any new data they needed to implement quests, to run tournaments for our communities or whatever creative way they wanted to engage with our players!

We are still learning and looking to improve performance, scalability and security. For example, we are investigating how we can use Redis to cache data and speed things up and also looking at how we can automatically generate responses in the documentation to make communication with our partners #ButterSmooth.

Let me know in the comments how you are using FastAPI differently from what we are doing or if there are other cool frameworks you would recommend!

--

--