Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: escpodgames on August 01, 2013, 12:06:49 AM
-
Hi,
I have been thinking about this for a while now and figured Id put it out there to see if there are any other/different ideas out there.
Basically my current game needs to be able to create a room (yes I'm using Photon) and only friends can join and or see. What is a friend?! Options are Facebook friends (best option) GameCenter friends (second best option)
The photon side of things would be rather easish?! Create a room that has a unique name to the Master, this could be the users facebook http as an example (just encase there are more than one John Smith playing my game at the same time) From there each user would check the list of rooms with the list of their facebook friends http address (is that very practice?) provided I haven't found a means to get facebook friends info yet. Gamecenter is the back up plan.
Just thought id see if anyone else has tackled this issue/problem.
Cheers
Andrew
-
Hi,
basically, dealing with this is something separate from Photon in terms of logic. It's up to you to deal with who can view/access/join rooms.
you have two ways to go about room listing:
-- you can make room invisible, and you have your own server logic ( php/mysql or else) to maintain accessible rooms based on friends listing, and your game simply get that list
-- rooms are visible to all, but your interface simply filter them, this is the same principle as what you would implement on your own server side
as for friend listing, yes, you can use facebook and graph queries. If you use your own system, you will need a lot of work to get to a point where you have your member management with all the tools to deal withs friends ( inviting, accepting, black listing, etc etc etc), so if you use a social system ready made, I strongly advice to do so, if you never tackled such system before.
bye,
Jean
-
Hi,
Thanks for your input Jean :D Personally, anything server related scares the bajesus out of me just because I've never had to deal with anything overly complex .... I'm using Playmaker after all :P
I think the best bet is to filter the rooms via the interface, as you said. I've already designed the Ui and how it will/could work its just a matter of how to filter the users.
Facebook graph queries is where I'm headed, I've taken a look at a bunch of other networked room based game (Poker is a good example) where they allow other people to be added to your friends etc but I don't think that is needed for my game. I just need a way to find your friends and play with them otherwise you can play with random people.
P.S. Thank you so much for your Photon tutorial (and/or Alex) was rather easy to setup and everything seems to be working .... just need the friends aspect. Back to writing Facebook actions for me :D
-
Hi,
as I looked closer, Photon HAS a friend list system. So I'll be working on this to provide access to this built in friend system. It will not be in the very next release, but likely in the following one.
bye,
Jean
-
Sweet, I might have to rethink the way I do "playing with friends" then as I'm planning to submit my game around 13 weeks from now ... unfortunately this aspect is pivotal to its potential success :(
Might be able to create a room per player with their Facebook ID being the room name, then use that somehow to get a sudo 'play with friends' system.
-
I guess there in no way to search the room titles so that idea is out.
Does GUILayout ToolBar With Players give us access to all the player names? :D
-
"There is a new operation opFindFriends(). You pass an array with the names of the players that you want to look up. The client then asks the master server (the operation will fail, when you are in a game room, which implies being on a game server), if there are any players with these player names online and in which rooms they are, if in any.
You would just pass your list of players into this operation, but handling who is on this list and who is not, is up to you. Functionality therefor is not provided"
Sounds like exactly what I need, Via Facebook I the friends names, opFindFriends looks them up and gives back which players are online and in what room!
-
Hi,
where did you get this?
bye,
Jean
-
http://forum.exitgames.com/viewtopic.php?f=8&t=2864
"Photon is only able to find players by name. It does not provide the actual social component (adding friends, etc). This is up to you or a middleware of your choice.
We decided against designing and implementing another friend listing in Photon when most game-developers already have a favorite social API."
If its not much extra work, would this be possible for the next update as I'm building the 'social component' actions atm it would be a very powerful addition combine with Array maker.
-
Hi,
Yes, this is planned. I'll need to make sure it works and all, so I am not sure it will go for the very next release, but definitly the next big thing for me to work on for Photon.
bye,
Jean
-
Hi Jean!
Was this ever further developed?
-
Hi,
not really, The problem being that scripting is unavoidable in the case of friends because they need to be pulled from various systems and servers that you'll need to hook up with and provide server side scripts to get the list of friends from the social systems you'll be using and giving access to from within your games.
So that's tricky indeed... What kind of back end you are thinking of using to manage users and friends list?
Bye,
Jean
-
I'm using Steamworks SDK, unfortunately my coding/scripting is weak, so I can't figure out how to use the Steam Overlay for invites, as this would be more intuitive to users.
However, using the Steamworks.NET Playmaker actions I can already populate a friends list using their Steam ID and assigning it as their Photon ID.
All I really need is an action to populate an array using the information from the OpFindFriends() function (https://doc-api.photonengine.com/en/dotnet/current/class_exit_games_1_1_client_1_1_photon_1_1_load_balancing_1_1_load_balancing_client.html#a797304e9d94079efad420f4e6f62ce5f) for Photon. Using this, users can at least get the room name of a friend's room and join manually.
-
I'm in the same boat, getting friends is not the issues it's finding them in rooms.
-
Hi,
ok, good, let me work on this then. Thanks for the clear explanations of what you need, it always help :)
Bye,
Jean
-
Hi Jean,
Any progress on this? Sorry to bug you, I could use this soon or I'll have to get started on a workaround (manually entering a room name)
-
Hi,
I'll likely get on it soon, but havent' started sorry... But thanks for the bump it helps!
Bye,
Jean
-
Hi,
Ok, support for FriendList is now available ( get the latest on Ecosystem or wiki if ecosystem is capricious).
use PhotonNetworkFindFriends to make the request ( ONLY WORKS IN LOBBY)
you'll have a new "PHOTON / FRIEND LIST UPDATED" which is only when you receive this that you should query it using
PhotonNetworkGetFriendsOnlineStatus
PhotonNetworkGetFriendsinRoomStatus
PhotonNetworkGetFriendsRoomStatus
It's now mandatory to have PlayMaker 1.8, because I started using FsmArray with friendList.
Let me know how it goes.
Bye,
Jean
-
Awesome!
Thanks Jean, I will implement these this week and let you know if I hit any issues.
-
This is great! New "Friends" actions.
I'll be happy for any simple demo of this feature too (unity package or video).
By the way... any chance in the future for "Photon change owner" action?
https://doc.photonengine.com/en/pun/current/tutorials/ownership-transfer
-
Hi,
It's tricky to do a demo, because you need to come up with a social system to have a friend list being created. Else it means that for testing, you'll have to instantiate several instance of the demo, name each player of them instance properly, and then test on the Unity editor... this is I feel too much for a demo...
basically, you name each your player with a unique name, which is usually a facebook id or some social id.
then, your social network gives you the list of your friends id, you store them id in an FsmArray, and you feed that inside the FindFriend Action, and you wait for "PHOTON / FRIEND LIST UPDATED", which then allows you to use all the get Friendxxx actions for who's online, what room they are in, etc etc.
So that in itself is really simple.
I'll work on the change owner action yes. Should have that by tomorrow.
Bye,
Jean
-
FindFriend Action!!!
OMG I can't wait! Thanks a TON Jean!
-
Hi Jean,
The "PHOTON / FRIEND LIST UPDATED" event never seems to trigger after using the Find Friends action, and the other actions are unable to receive friend status information.
Also, "PHOTON / FRIEND LIST UPDATED" does not appear to have an existing global event, such as the older Photon events. Am I missing something? The "failure event" does not happen after calling the find friend action, so I assume it is using the action successfully.
-
Hi,
My test works fine.
Get the PlayMaker worker demo, and play it, when in the lobby, locate the "menu" GameObject, and the fsm "Friends Test", trigger "FIND FRIENDS" from the PlayMaker inspector.
You should then be receiving "PHOTON / FRIEND LIST UPDATED"
Let me know how it goes. Remember, it only works if you are in the lobby.
Bye,
Jean
-
OK, I got the "PHOTON / FRIEND LIST UPDATED" to work, but only ONCE.
It appears that using the Find Friends action causes a Photon disconnect immediately afterwards.
The connection state is returning as "not connected", and if I use another connect action, it will work again ONCE, and disconnect again.
edit: For now at least I can force a refresh of the list by constantly reconnecting
-
Hi,
ok. very odd... I am witnessing any disconnection after I request and receive "PHOTON / FRIEND LIST UPDATED".
Are you using the demo worker or your own scene and logic?
You only get friend list update when you request it first of all. You won't get an automatic callback when a friend connects you have to query it. do that every minute maybe.
Bye,
Jean
-
I am using my own logic to populate the friends list array, but followed very closely with the example. I've got everything working correctly now!
Things to watch out for:
- The process can hang or disconnect if you attempt to use Find Friends on an array with null values in it
- Resizing your array to the size of the friends list will avoid this issue
Thanks for the help Jean!
-
Hi,
uhm, interesting comment on null friends references. It of course doesn't make sense to feed an array with null value in this case, so let's keep it as is ok? or do you think I should implement a clean up or event being fired if friend list contains null values?
Bye,
Jean
-
For users who may not understand a lot of coding (like me) it may be helpful, it took me several hours to figure out why this was happening so it may help save them some time!
But also it was a good lesson for me with working with arrays :)
-
I'll work on the change owner action yes. Should have that by tomorrow.
Hey, @jeanfabre. Any luck on getting the Photon Takeover action (this.photonView.RequestOwnership()) going?
We could really use it, as we transition to scene objects.
Thanks so much!
-
Hi,
It's done already :) waiting for the next iteration of Photon to ship it, which will happen this week.
Bye,
Jean
-
Awesome!
I managed to use code from Get Photon View ID and add that line to it, and it seems to work if anyone needs a simple version in the meantime.
Thanks, Jean! You and the crew make games happen.
EDIT: Removed failed attempt at Photon script.
-
Hi,
Carefull, you need to also spread this across the network, that's not enough to request, you need to apply this back on all instances using TransferOwnership()
Check out the PhotonViewRequestOwnerShip (https://github.com/jeanfabre/PlayMaker--ExitGames--PhotonUnityNetworking_U4.3.4-Library-/blob/master/Actions/PhotonViewRequestOwnerShip.cs) and PlayMakerPhotonProxy (https://github.com/jeanfabre/PlayMaker--ExitGames--PhotonUnityNetworking_U4.3.4-Library-/blob/master/Scripts/PlayMakerPhotonProxy.cs) method OnOwnershipRequest()
Bye,
Jean
-
Thanks again, Jean.
I humbly redact my submission.
-
Hi,
Actually, your action was right, you just needed the extra script ( in photon proxy) to listen to transfer changes.
I am working on a demo so that you can testify ownership changes, this will be easier to understand how everything works.
Bye,
Jean
-
Very much looking forward to the demo.
With our scripts updated to the two you posted, whenever a client enters a room it does not recognize the owner of the Photon View. It just sees them all as Scene objects, regardless of them being taken over previously.
Are we missing some step?
Thanks, man!
-
Hi,
FindFriends is now available. Get the latest on the Ecosystem.
Let me know how it goes and if you have more questions :)
Bye,
Jean
-
Thanks for this!
I am happy to see you updating wiki page too. Because you know, sometimes ecosystem not working.
Oh.. yeees "RequestOwnerShip" :)
-
Hi,
when ecosystem is not working, everything is available either on github or on snipt:
https://github.com/jeanfabre?tab=repositories
https://snipt.net/search/?q=playmaker
Bye,
Jean