Create Private Rooms?
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Create Private Rooms?
Kuroato
2012-12-26 00:24:12
Hello all,
I am using Photon Cloud with My Unity Game Projects.
Photon Plugin is Integrated and Working, I am able to Join and Create Rooms, but I am curious about the Private Rooms.
I read somewhere on the Photon ExitGames Website you can create Private Rooms, but I could Not find any documentation on how to enable Creating Private Rooms.
Is Private Rooms only Feature for Dedicated Photon Servers, or can this be done using Photon Cloud?
If so, what script do I need to add to Enable the Private Rooms in my Main Menu Lobby?
Any leads, highly appreciated . = )
Comments
you can create private rooms in any incarnation of Photon, the only requirement to get them private is to set the corresponding property when creating them so they are not listed / hidden.
@dreamora wrote:
corresponding property
What exactly is the "corresponding property" and where do I Input it?
by the way Dreamora... where the heck is Exit Games Staff ? :?: They should be answering my questions... I mean I appreciate your help, but shoot they should be paying you if you are the only Senior Level Member here Answering all the Questions. ;)
Yeah I could do with some support from them too I even reproduced my prob in their example project! It is Christmas so perhaps they're on holiday which is fair enough! Wait another week or so and I'm sure we'll all get good responses ;)
I think the "corresponding property" he means is PhotonNetwork.room.open = false. Maybe just set that after you join the room then others can't join it I think?
then others can't join it correctly but I doubt that this was the idea.
You would normally use a combination of .visible (which controls if the room is listed in the room listing) and usage of room properties to set a password which you verify on the master client (he is the one who created the room) or something similar.
you could naturally also avoid the visible and just check if the room has the password property in its RoomProperties and correspondingly mark it. There is sample code for this around, though unsure if there is such example code for PUN I've to admit.
There is no true inbuilt form of password protected rooms I'm aware off.
Thanks guys! Check out my Thread here... I think someone has the solution on Unity 3D Forum.
http://forum.unity3d.com/threads/163714 ... oton-Cloud
Seems it's just a small simple line of code to prevent certain rooms from Listing, by hiding any room created with a certain starting value such as ("private_"), so if I have that code in my Photon Script, it seems when I type a room name that looks like this "private_myroom" it will not be listed for other players, but only those who know the name can join.
Sounds simple enough... lets follow that thread above see what the outcome is if your interested.
hey dreamora any idea what's up with all the "photonview does not exist" issues? Seen a few ppl have them including me. Think its a bug in photon or maybe we're all just doing something the wrong way?
Would have to check the current versions. In old versions I used to see the "view id does not exist" problem but can't comment on your problem, as I normally work with the normal SDK when I use Photon as I tend to mess in the lower layer sooner or later anyway so I don't see that problem anymore.
About us Photons not responding: Yep, we've been on holidays between Christmas and NYE. Back now.
About private rooms: You can hide rooms from being listed and randomly joined by the "visible" flag. You best set it when you create a room. Passwords are not supported but as the room is never listed, finding it by name is as good as a password. Alternatively, the masterclient could kick anyone who's not sending the proper password by RPC.
I assume the viewID issues are also discussed in another topic? If not yet, let me know how you reproduced your prob in our example project in a new topic. Thanks.
@Tobias wrote:
About us Photons not responding: Yep, we've been on holidays between Christmas and NYE. Back now.
About private rooms: You can hide rooms from being listed and randomly joined by the "visible" flag. You best set it when you create a room. Passwords are not supported but as the room is never listed, finding it by name is as good as a password. Alternatively, the masterclient could kick anyone who's not sending the proper password by RPC.
I assume the viewID issues are also discussed in another topic? If not yet, let me know how you reproduced your prob in our example project in a new topic. Thanks.
thank you Tobias! = ) and no problem regarding the holiday break... i still think you guys should hire dreamora! :lol: lol!
I responded to this topic on the unity forum you posted on... i guess maybe you can copy and paste your answer to both forums as im sure it will be useful for others asking, seeking the same.
I said:
since i'm not much of a programmer, can you explain alittle more in detail such as provide the exact line of code needed to set this up? the part where you said "When you create a room, just set the "visible" option to false. "
Would highly appreciate it!
Ah, right! Same discussion. My reply:
I can only help with C# code but JS should be very similar. Hope this helps:
Somewhere in your code are calls to CreateRoom. There are several variants of this same method with more or less parameters. One is defined as: CreateRoom(string roomName, bool isVisible, bool isOpen, int maxPlayers)
So, to create an invisible (private) room for up to 4 players you could call: PhotonNetwork.CreateRoom(roomNameAllPlayersKnowAbo ut, false, true, 4);
The variable roomNameAllPlayersKnowAbout must be a string your players know. Don't set isOpen to false, or else no one can join. You can replace 4 with any number that fits your game or 0 for "no limit".
The other thread: http://forum.unity3d.com/threads/163714 ... oton-Cloud
Back to top