How TreesPlease Games builds gaming infra with CockroachDB Serverless

Last edited on December 3, 2021

0 minute read

    The gaming industry is all about delivering a great end-user experience which means building relationships with players that last years, not days. They can do this by instilling predictability, reliability, and creating a strong brand by giving players what they want: a new and better gaming experience each time.

    However, the success of a new game or platform is often unpredictable. A game can become successful overnight and the amount of concurrent players can surge within a few hours causing slowdowns or the inability to login. Or the game may never reach a certain level of popularity that it needed to see a ROI.

    This creates several challenges for game developers who are unable to predict demand for their game prior to its release. They don’t want to spend too much upfront on infrastructure for a game that may never be successful. At the same time, they need to prepare for an unexpected surge in users that won’t impact performance. Gaming companies need to build on an infrastructure where they can start small and cheap, yet scale really fast to accommodate a growing user base.

    Gaming Application Architecture AdviceCopy Icon

    Russell Callaghan has been developing video games for the last 15 years and recently co-founded a small startup called TreesPlease Games Ltd. The company was founded with the belief that they can create meaningful games that make players feel good about the time they spend in the game. For example, the concept behind their first free-to-play (F2P) puzzle is to restore the forest and rescue animals. It’s an ethical angle for casual games that they hope will attract vast audiences and have real world impact.

    Since TreesPlease is a small startup with only a couple of engineers, they need to use as much out-of-the-box technology as possible so they can concentrate on building features that differentiate them from the competition. Additionally, they need to keep upfront costs as low as possible but feel confident that their platform will be able to scale as they onboard users.

    “Having a reliable go-to backend service like CockroachDB is a great way to prototype new systems and allows developers to try new things without having to worry about how they might scale if they needed to.”

    - Russell Callaghan, Technical Lead & Co-Founder

    Building a gaming app with budget in mindCopy Icon

    When building a new application or service, trying to evaluate different technologies and project costs can be very difficult without concrete numbers. The gaming industry is particularly challenging.

    Russell recognized that trying to come up with realistic expectations for how much it will cost to run 10 game server instances vs a Google function would vary wildly depending on certain unknown factors. He remarked that it’s almost impossible to make an informed decision upfront as to which technologies to go with.

    Additionally, for TreesPlease to try to build anything at all pre-funding was challenging. Russell and team needed to choose an approach that would allow them to develop their first game and get it to market as quickly as possible in a way that wouldn’t put them into technical debt.

    “There’s a very hard balance to find when it comes to choosing an approach that gets you to the result as quickly as possible, in a way that doesn’t also accrue piles of technical debt. CockroachDB has allowed us to keep costs low (to non-existent) which is great for an early-stage startup.”

    - Russell Callaghan, Technical Lead & Co-Founder

    Developing scalable gaming infrastructureCopy Icon

    Russell first came across CockroachDB via Heroic Labs who recommend using the distributed SQL database alongside Nakama, their open-source game server. The cloud-agnostic, distributed nature of these two technologies is a perfect match since they remove a lot of complexity around scaling and operations for developers. Additionally, CockroachDB is Postgres-wire compatible which was a requirement for Russell and his team.

    They decided that they would leverage a combination of Unity (game engine), HeroicLabs' Nakama (game server) and CockroachDB (cloud-native SQL database) for their infrastructure. Russell and team were one of the first users to test out CockroachDB Serverless and are currently running a testing environment.

    When it’s time to move into production prior to the release of their first game, Russell feels confident that it will be an easy transition to a setup that can scale. He also foresees a lot of other CockroachDB capabilities being of use to him.

    “The combination of Unity, HeroicLabs' Nakama and CockroachDB Serverless has been absolutely amazing, especially during the early stages of a startup’s life. We know that as soon as we start to grow our user base, we will be able to easily scale without having to hire a bespoke team to manage infrastructure.” - Russell Callaghan, Technical Lead & Co-Founder

    Benefits of global reach and resilience Copy Icon

    When building a global game, you have to be able to reach users wherever they are located. Russell says that CockroachDB’s ability to deploy across multi-regions will definitely be an advantage when it comes to keeping server response times reasonable while reaching a global audience.

    Additionally, CockroachDB is architected to survive failures without performance impact which is a bonus for game devs that are worried about an influx of traffic knocking their game offline. Russell and team plan to leverage CockroachDB’s self-healing infrastructure and automate disaster recovery with managed backups.

    “Anything that I would normally have to do myself with a cloud instance running PostgreSQL manually (security, setup, scaling, administration, logging, backup) would be costly to develop in-house. For a startup, spending time/effort on these tasks is not a good investment for us. We need to concentrate on developing the unique selling proposition (USP) for our games and company, so off-the-shelf tech like CockroachDB makes a lot of sense.”

    - Russell Callaghan, Technical Lead & Co-Founder

    Future for TreesPlease Copy Icon

    They plan to release their first puzzle in 2022 and hope to receive 5 star reviews from happy players who are aligned with their mission to help the world through casual F2P. They also hope to be “ROI positive” by spending money on advertising that brings back the same amount of net revenue generated.

    Looking further into the future, Russell wants his team of game developers to release 2-3 successful games, and feel confident that making games that have a positive real-world impact can also be a sustainable business.

    how to build an application
    Customer Stories
    cockroachdb serverless
    quick bites
    case study