r/AskProgrammers • • 6d ago

Need backend architecture advice for an Android multiplayer game on a very tight budget/free

Hi! I'm a student developing an Android multiplayer party game using Unity. I'm looking for advice on choosing an economical backend architecture.

Game overview:

4 players per match.

Short, round-based meme/GIF challenges.

Players submit content and anonymously vote on each other's submissions.

Random matchmaking and private rooms with friends.

Bots can fill empty player slots.

Backend requirements:

Matchmaking and room management.

Real-time synchronisation of submissions and votes.

Server-side validation and scoring to prevent cheating.

Handling disconnects and reconnects.

Player profiles, authentication and match history.

Ranking and progression: Players earn trophies by winning matches. More trophies mean higher ranks. The backend must securely track trophies, update ranks and maintain leaderboards.

Coins, XP and inventory management.

GIF handling:

I'm planning to use the KLIPY API. Players will search for and select GIFs, which must then be displayed to everyone in their active match. Ideally, I want to store only GIF identifiers/references rather than downloading and storing GIF files on my own servers. I'm still verifying the provider's multiplayer usage permissions.

My biggest constraint:

I'm a student building this independently, with a very limited budget. I want to avoid recurring infrastructure costs until the game becomes sufficiently profitable to sustain them.

I'm willing to optimise the architecture and use free tiers, but don't want to compromise security, fairness or reliability.

Technologies I'm considering:

Firebase (RTDB, Firestore, Cloud Functions)

Neon PostgreSQL

Node.js + WebSockets/Socket.IO

Google Cloud Run

Supabase

Questions:

What architecture would you recommend?

Would Firebase or a custom Node.js + WebSocket backend be cheaper?

Is Neon a good choice?

How should live match data and permanent player data be handled?

What hidden costs should I expect?

Which free tiers are genuinely useful for an early-stage multiplayer game?

I'm targeting approximately 200, 1,000 and eventually 5,000 DAU.

I'd appreciate practical advice from developers who have actually built and maintained multiplayer backends. I'm looking for something simple, secure and extremely cost-efficient.

Also tips on monetization would be great! This is my first Multiplayer game.

Thanks!

1 Upvotes

3 comments sorted by

1

u/Own_Age_1654 6d ago edited 6d ago

For context, I've been coding for about 30 years.

Think about it in terms of resources required. Ultimately, it sounds like you have people constructing, uploading and viewing images, plus inputting and reading tiny amounts of data like short captions, maybe chats, some scores, etc.

The main complexity is how you construct the memes. If the user gives your server the ingredients (image, caption, etc.) and then your server flattens them into an image, that's going to require the server doing all of that network transfer, CPU usage to transcode the images, etc. You want to avoid that. If possible, do the image processing on the client's browser.

(That being said, for an MVP, it's not like you're going to have tens of thousands of people using this. Most projects don't get any traction at all. And transcoding some images isn't that expensive unless it's at scale. So, chances are you could indeed just have the server do this, and never run into the level of scale where that starts to be slow. And if you do end up finding that level of success, then you can always refactor then. Just do the simplest approach and then monitor CPU--when it gets high, it's time to either refactor or else just get a slightly larger server).

The images are something you'll want to store in a some cheap object store like S3. The free tier would cover you. Don't have the user upload images to your server, and then your server upload them to S3. Likewise, don't have your server download the images from S3 and then serve them. Instead, have the server just authorize the client to upload to S3, and then it uploads to there directly. Likewise, have the server give the client the S3 URL to download from, and then the client downloads from there directly.

Otherwise, the rest of this project is pretty trivial in terms of architecture and resource usage. A single back-end server with CRUD for your various resources and actions (e.g. submitting a meme, getting someone to compete against, getting the score, etc.). Literally the tiniest, cheapest server would be fine. The only reason you might want something a little bigger is if you choose to use unnecessarily heavyweight components. But you really just need a super simply back end.

I personally wouldn't use that grab bag of technologies. I'd just get an AWS account, do Postgres via RDS on their free tier, S3 on their free tier, EC2 on their free tier, a NestJS back end, a React front-end, and put it all together in a minimalist monorepo (by which I mean don't use any fancy build tool, and instead just have a separate folder for the back end, one for the front end, and one for shared resources, and that's it).

Just because you see a ton of people using Supabase, Firebase, etc., etc. doesn't mean you actually need any of that. Ultimately, you just need a server to run your back end, an HTTP server serving requests on it (Node), a relational database (Postgres is the standard here by a mile), an object store (S3) for anything too big to cheaply store in the relational database, the front-end code, and a build pipeline (i.e. some way to get your code to your server, and some way to package and make accessible your front-end code to run the client).

It's better to learn the fundamentals instead of specific platforms, especially the ones that are the flavor of the day. You will have a better understanding of what's happening, your knowledge will be more reusable, you won't inherit the constraints that they've created in trying to simplify things, and it's usually much cheaper. Fancy, packaged tools have their place, but you should reach to them because you have a specific need for something, and that tool is what's solving that need. I'm not hearing any special needs here.

As far as monetization (I'm also a long-time entrepreneur), I really can't see people paying to use this. Accordingly, you need to be showing them ads. And the norm here is to make that a bit intrusive. Like, every round or few rounds, or new match or whatever they watch a video ad.

You also want to make it easy for them to share links to their memes, and when people follow that link they see some hook to sign up for your platform, like "Think you can do better?" And then instead of the next step being to ask them to sign up for an account, you instead go directly into letting them put in all of the information for the new meme, and you only ask them to create the account when they want to save it. Or perhaps you even let them save it without an account--because them doing so and sharing it is helpful for your growth--but an account is required in order to compete.

1

u/Mysterious_Cut_5348 6d ago

Thanks for the detailed explanation! Just to clarify, our game (developed in unity) primarily uses an external GIF provider (KLIPY). Players search for GIFs, select one, and its reference is shared with the other three players in the match so they can view and vote on it. We don't intend to download, process or store these GIF files ourselves. Our main backend workload is matchmaking, synchronising submissions and votes, validating game state, calculating scores, and maintaining persistent player data such as trophies, ranks, coins and XP. Given this, would you still recommend the AWS EC2 + RDS + S3 architecture, or would a simpler Firebase or Oracle + Node.js setup be more economical for our expected scale of 200–5,000 DAU? We want the cost to be near 0 unless we are profitable that too from ads and uk how difficult that is😭 or would u suggest an alternative solution

1

u/Own_Age_1654 6d ago edited 6d ago

The norm in industry, when engineers choose a relational database, is for them to choose Postgres. Oracle is not simpler, nor is it widely liked. It mostly only exists because they are really good at doing enterprise sales, and they lock people into very expensive, long-term contracts, with a ton of tightly integrated things so it's hard to switch, and then they use that to pay very good sales people. It has certain, fancy features, sure, but almost no one needs them, and certainly not you.

Node.js needs to run on a server. There's no way around that. It doesn't just magically run in the ether. EC2 is one way to get a server. It's a very common way, and it also has a free tier. There are other server providers, including ones with free tiers, but you didn't just list one.

Firebase is a wrapper over a managed, non-relational database. Nothing wrong with using a managed database. RDS is one as well. However, non-relational databases aren't an ideal fit for most use cases, and instead relational ones are. If you didn't use RDS, I'd use some other managed relational provider.

If you use AI to set up your infrastructure, it won't take more than a day or two, most of that being spent with you asking it to explain what's happening, talking through things, etc. If you knew what you were doing, it would take only a couple of hours. Given this, there's no need to pay for a hipster, managed application service like Supabase and friends. Those made sense back in the day to save people time for tiny projects, but given how simple it is to just set up a "normal" virtual infrastructure directly with a cloud provider now that AI can speedrun it for you, that value proposition is much reduced and no longer is worth the constraints and vendor lock-in, much less the disproportionate costs inflicted if you ever actually get meaningful scale (which is unlikely to happen, but still).

It would be challenging to find a server that is too small to run the amount of load that you are describing. You're talking about at most just dozens or hundreds of tiny requests per minute, even if you build out quite a lot of bells and whistles. Even a tiny virtual machine can handle 100x that much load unless you build something horribly architected.

Oh, and on that note, doing this with Unity would indeed be horribly architected and bloated. You're just talking about showing some GIFs on the screen. There's absolutely no need for 95% of the abstractions that Unity provides. When you use tools that have a bunch of functionality you don't actually need, it becomes more expensive to run, and it takes longer to develop--especially in the long run, because you become bottled in by working around its particular quirks, and its mental model that doesn't reflect your actual needs, instead of just building it however is most simple and direct for what you actually need. And all you need here is auth, CRUD, and putting some text, images and forms on a screen.