AnonX - Anonymous Posting
DP
Anonymous x/DevSpeak
Thread Image
I achieved multiplayer mode in my game using just database listeners

I’ve been working on a coding puzzle game where you guess what a code snippet prints. I recently added a basic multiplayer mode, and surprisingly, I got it working using just Supabase database listeners (on ‘postgres_changes’), no sockets, no WebRTC, just real-time database events.

The experience was a mix of “this is magic” and “why did nothing update just now?”

One issue was that sometimes a listener wouldn’t fire, so the room state wouldn’t update. To work around it, I added a few safeguards:

•Resetting local state when a player reconnects.

•Forcing an update every few seconds

•Re-subscribing if something breaks

I know this isn’t a scalable solution. I’ve used socket servers before on the player side, but I’m not too confident with setting up a solid backend for multiplayer yet.

Still, it was cool to get it working this way, and I’d love to hear how others approach real-time multiplayer at scale.

Here’s the game if you want to try it:
https://whatitprints.com

You can play solo in Endless Mode, or try out the new Multiplayer Mode and race friends to guess what the code prints.

Replies

No replies yet. Be the first to reply!