- Home /
Play Game with FaceBook Friend
Basically I am developing two player Tic Tac Toe game. I am using Photon as my game server and normal working of this game is perfect.
For this game, I want to add FaceBook support through which player can send request to other friend so that they can play together.
At present I have working code with other player receiving notification about playing request. But now I want to implement both player can able to play game in same room. Means I want to create private room for both of these players so that they can play together.
But I can't able to detect they are FaceBook friend and want to play together. Please give some suggestion in implementing this. Only some though become enough for me.
Answer by tobiass · Feb 13, 2015 at 01:49 PM
If you are able to invite your friend, you usually can include a custom message / info in that invitation. Then it's easy, as Photon uses a "room name" as ID for each room. When you make up a room name and send it, then both players can join this room.
Best of all, we have PhotonNetwork.JoinOrCreateRoom(). Both players can call this method to get into the room by name - no matter who happens to call this first.
If you can't send a room name, you can derive one from the invitation itself, too! Let's say "playerA" invites "playerB", then the room name can be "playerA"+"playerB"+date.ToString(), e.g.
Check out the PhotonNetwork-Documentation.chm in the PUN package for the API reference. See "Custom Authentication with Facebook" for help with custom auth and using FB userIDs in PUN.
@tobiass, Thanks for your reply. First of all, I can't able to understand Custom Authentication with Facebook available in Photon. What is the purpose of that? Please give some advice for that.
Custom Authentication in Photon means that our server asks another server if the user's "login" is O$$anonymous$$ and if you allow the connection to Photon. You basically build a web service which checks user authentication before clients can connect to Photon.
It's optional. If you want that, check the linked page.
$$anonymous$$eans using Custom Authentication with Facebook, I don't need to check if player has connected with Facebook or not. Am I right in this?
If the player was not connected then we have to move to that page.
Your answer