Thanks!! Some more info on the implementation, I also have some posts on Linkedin showing the journey and sadly the need to pivot away from Supabase' Realtime for most of the gameplay
Initially Supabase was running EVERYTHING over their Realtime and Presence features, however things started to scale quite badly when it comes to the cost. Their pricing model on Realtime just isn't sustainable with a realtime game like this, sadly, so I had to pivot over to using Photon for the realtime messaging however still use Supabase for everything else.
- Database
- RLS
- Functions
- Auth
I then have a custom hook set up with Photon -> Supabase to ensure when players are trying to connect to the Photon Engine the Photon Engine checks back to ensure they are authenticated users.
I would have loved to have had everything running through Supabase like it was initially as it would have been a great use-case for them, but sadly with as little as 1,000 players per month it would have meant charging users at least $1.5 a month just to run with only about 2 hours of gameplay day each.
More info:
The issue: message-based billing. Real-time games are incredibly chatty:
- 8 players sending position updates at 10Hz = ~80 messages/second
- Add shooting, health, abilities = ~200-400 messages/second
- 1 hour of gameplay = ~1.4 million messages
Supabase free tier: 2M messages/month. We'd hit the limit in 90 minutes. On Pro tier ($25/mo base + $0.01 per 1000 messages):
- 100 concurrent players, 2hr sessions = ~150M messages/month
- Cost: ~$1,500/month
Photon charges by CCU (concurrent users), not messages:
- 100 CCU = $95/month flat, unlimited messages
- 16x cheaper for game workloads
What stayed on Supabase:
- Auth (perfect for this)
- Persistent data (player stats, leaderboards)
- ~1000 reads/day (well within free tier)
What moved to Photon:
- Position/movement updates
- Combat events
- Real-time state sync
SteveChurch|4 months ago
Initially Supabase was running EVERYTHING over their Realtime and Presence features, however things started to scale quite badly when it comes to the cost. Their pricing model on Realtime just isn't sustainable with a realtime game like this, sadly, so I had to pivot over to using Photon for the realtime messaging however still use Supabase for everything else.
- Database - RLS - Functions - Auth
I then have a custom hook set up with Photon -> Supabase to ensure when players are trying to connect to the Photon Engine the Photon Engine checks back to ensure they are authenticated users.
I would have loved to have had everything running through Supabase like it was initially as it would have been a great use-case for them, but sadly with as little as 1,000 players per month it would have meant charging users at least $1.5 a month just to run with only about 2 hours of gameplay day each.
More info: The issue: message-based billing. Real-time games are incredibly chatty: - 8 players sending position updates at 10Hz = ~80 messages/second - Add shooting, health, abilities = ~200-400 messages/second - 1 hour of gameplay = ~1.4 million messages
Supabase free tier: 2M messages/month. We'd hit the limit in 90 minutes. On Pro tier ($25/mo base + $0.01 per 1000 messages): - 100 concurrent players, 2hr sessions = ~150M messages/month - Cost: ~$1,500/month
Photon charges by CCU (concurrent users), not messages: - 100 CCU = $95/month flat, unlimited messages - 16x cheaper for game workloads
What stayed on Supabase: - Auth (perfect for this) - Persistent data (player stats, leaderboards) - ~1000 reads/day (well within free tier)
What moved to Photon: - Position/movement updates - Combat events - Real-time state sync