Turn-based Multiplayer Game for Mobile Devices (Firebase vs Photon PUN 2)

2,072 views
Skip to first unread message

umair amin

unread,
Apr 15, 2020, 11:43:30 AM4/15/20
to Firebase Google Group
Hey Firebase, 

My name is Umair and i am a Software developer from Pakistan. I have an idea of turn-based multiplayer online game and after research for 2 weeks, i mean intense research. I have shortlisted  (Firebase/ Photon PUN 2) with Unity 3D.

I am very confused between Firebase and PUN 2, both are equally good. I am more inclined towards Firebase but already made features of Lobby creation, room creation, players management of PUN2 are not letting me to decide for any between two.

I want to know, is there any API for Lobby, room and online players and network management for multiplayer game or i have to code all of this myself using events alert feature of firebase ?
How can i implement Lobby creation in Firebase ?
How can i implement Room creation in Firebase ?
How can i implement Players management in Firebase ?
How can i implement Network for multiplayers ?

These are basic concerns and 
 THIS GAME IS GOING TO BE MY FIRST GAME .

Hoping for quick response.
Take Care Firebase.

Patrick Martin

unread,
Apr 15, 2020, 12:24:13 PM4/15/20
to Firebase Google Group
Hi Umair!

My understanding of Photon PUN is that it's a very different product than Realtime Database. For a turn based multiplayer game, I think that Realtime Database is a better choice but I will expand on that below and add caveats both ways.

I typically see teams go Photon when they want something like a realtime game server. If you're making something like Minecraft or Doom, it's a really great way to get two or more computers talking in real time. Its API is really designed to make that sort of realtime networking super easy.

On the Firebase side, you'll likely be looking at Realtime Database or Firestore (alpha for Unity right now). These are really fast for Databases, but rather than just getting bytes from one computer to the next as fast as possible, you're reading and writing a database as fast as possible. Generally this isn't that useful for a realtime game, you don't really care if you miss an update about the player's location since you have a new one every 33 milliseconds. All the extra work that Firebase does to persist data and keep it ordered is extra work that a realtime game probably prefers it not do.

To answer your base question, looking just at the kind of game you're making, I'd tend to lean towards Firebase for a turn based multiplayer game. Especially if you expect games to take multiple hours to days (say you're implementing Civilization), it's probably very cost effective to have a database that isn't doing work per player when your players aren't actually interacting with your backend. There's nuance here though, maybe it's a game like Ultimate Chicken Horse with a turn based and realtime component or maybe it's a game that will only last a minute or two on average and you're hammering the backend during this time like a realtime game. Photon might be a better bet if you're not persisting data for long periods of time, but my gut says look at Firebase (I do work for Firebase, so take that with a grain of salt).

For lobby and room creation, you'll have to do that on your own (there currently aren't any Firebase Extensions to simplify it). Chat rooms are one of the most popular Firebase Realtime Database tutorials though, so following one of those should get you most of the way there.

Player management is a two part answer. Firebase Authentication will let you authenticate users and create user ids fairly easily. It will be up to you to use something like Realtime Database to really annotate those user id's and add game-specific logic to them.

You might get a better idea of what's possible after watching my video on Authentication and Realtime Database, Firebase will take care of a lot of the gruntwork but you'll still be responsible for the high level logic of what's happening (ie: networking will be more or less automatic, but you still have to figure out how to arrange your database to get the features your game needs).

A flow that I think is really cool that you can do in Firebase is to create a game (add a Realtime Database node), then invite users to it with a Firebase Dynamic Link (so you can share your game with your friends). Something that will be hard in Firebase is a general purpose matchmaking algorithm (unless you're just randomly matching users, in which case check out loteria's case study).

I don't know how much Photon does for you in matchmaking and how much you have to do yourself. It might be easier to implement that (and there isn't anything on the Firebase side stopping you from matchmaking in Photon and running the game in Firebase, but I don't know what kind of bookkeeping you'd have to do to get that all to work).

You could also try looking at Managed Game Servers, which handle matchmaking via Open Match and actual game hosting with Agones. This will be much more difficult for your first game, so I wouldn't look at this unless you're ready to just jump into the deep end. But these technologies have some AAA endorsements on Agones' site, so it wouldn't be wasted effort. The caveats here would be very similar to the ones with Photon (a turn based game probably wants a database rather than a living dedicated game server, so Firebase will be preferable).

I hope that all helps! A turn based game tutorial of some sort is on my short list of content that I want to make, but I won't have anything to share in the near term 😢

--Patrick

umair amin

unread,
Apr 15, 2020, 6:00:17 PM4/15/20
to fireba...@googlegroups.com
Dear Patrick,

Thank you so so much brother for such a detailed reply with such interest and depth. Firebase is awesome because it has awesome people like you. I will look into these links and will come back as i have couple of Questions more, but i want to have a look on those recommended links before. 
So goodnight.
I am impressed ;-).   

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/7382e64d-ce49-4b7f-807e-38c466af04af%40googlegroups.com.

Patrick Martin

unread,
Apr 16, 2020, 3:27:08 PM4/16/20
to Firebase Google Group
No problem, glad to have helped!
To unsubscribe from this group and stop receiving emails from it, send an email to fireba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages