playMaker

Author Topic: Photon:Room Players Watcher.  (Read 3567 times)

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Photon:Room Players Watcher.
« on: February 23, 2014, 06:10:38 PM »
Another photon "is it a bug?" is this:

In the Photon Demo, there is an FSM that looks at how many players there are, and if theres more than one it displays the chat guis.
GREAT!
Now Im looking for a way to limit my games to 4 players /the 5th would start a NEW room) And here on the first State I notice this.
Photon Network Get Room Properties
Theres a max players setting, (Not really helpful because game just fails if you reach this number, OR you could use it to somehow send a message back to the lobby, and then what... tell the lobby not to let someone into this room, how...?
Forget it.. I notice the next thing...
Visable

Check the Blue Book, and AMAZING! This setting, makes this room INVISIBLE IN THE LOBBY! HOORAY!
So Heres what Im thinking. I crate a bool for this (Shown in lobby) set to True,Then the 4th player arrives, I set this to False.
So then long comes a new player wanting to join a game, but Lobby shows there ISNT ONE.. so he creates a new server! (This is already in play)

Except... of course... it doesnt work!
Heres the set-up Im doing here, right before the regular "is there players in the room" states... nothing changed here...

Heres the picture! Spot anything wrong... Do I get understand the functionality of
Photon Network Get Room Properties correctly?

(EDIT: thinking some more, Im suspecting that this action just REFLECTS the current state of the game, so a variable added to the Visable property will just show what the room is, and setting it, will not change that property, to False for example. SO what Im looking for is an action that actually SETS this visible property in the Lobby. So that its not included in the Random Matchmaking, because the room is full)

« Last Edit: February 24, 2014, 05:01:30 AM by markfrancombe »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon:Room Players Watcher.
« Reply #1 on: February 24, 2014, 08:05:55 AM »
Hi,

 You need to "SET" room properties using a special action. I think you are trying to set the variable holding the value of that property, not the actual source of it ( the room properties themselves)

use the action "PhotonNetworkSetRoomCustomProperty" do set a room custom property, and then photon will properly save that property in its cloud system and fire an event "PHOTON / CUSTOM ROOM PROPERTY CHANGED" event

 
Bye,

 Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Photon:Room Players Watcher.
« Reply #2 on: February 24, 2014, 06:42:36 PM »
Thanks Jean!

I had a look at "PhotonNetworkSetRoomCustomProperty"  but didnt understand how to use it. The property that i need is Visible as shown on the "photon Network get Room Properties" action.
Assuming that IS a property I can change? What do I write in the "Custom Property Key" field?

Regards

Mark

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon:Room Players Watcher.
« Reply #3 on: February 25, 2014, 02:48:46 AM »
Hi,

One sec, Visible is not a custom property, it's a built in property of rooms. Doy ou want to change the visibility of a room at runtime?

bye,

 Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Photon:Room Players Watcher.
« Reply #4 on: February 25, 2014, 03:58:12 AM »
No, not really.. er.. no..er yes...
 :P
Visibility of a room in Photon Network Get Room Properties is presumably referring to THAT rooms visibility in the Lobby, right?
As you know, (Ive gone on about it enough) I want a robust way that if a room has already got 4 players, then a new player, who is still in the Lobby, will instead of trying to join that room, and it fail, just thinks that there ARE NO rooms so creates a new one. So we now have 2 rooms, but only one is JOIN-ABLE from the Lobby.
So then, if a player leaves the full room, that room is now made visible in the lobby and another new user will have 2 rooms to choose from, or rather Join Room Random will pick one of those 2 rooms... This action also contains a parameter to fill up rooms first, so the oldser game will (should) get the latest new player.

So Yes... A simple PhotonGet Players in Room in the Lobby, could make the room invisible if its below 4 players.

Can I achieve that?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon:Room Players Watcher.
« Reply #5 on: February 25, 2014, 05:02:34 AM »
Hi,

 I think this should be controlled automatically by Photon Server based on the room setup itself when you created it and how you actually order Photon to make a player join a room.

 I'll investigate this, as I think it's more a photon question than a PlayMaker one to begin with. I'll get back to you after I tested a bit more on this.

bye,

 Jean