Difference between PhotonRoomProperties and RoomProtocolToken
Options
donovan
✭
in Photon Bolt
Best Answers
-
Hello @donovan ,
Yes, there are some differences, but first, both are classes that implement theIProtocolToken
interface and can be passed as extra data to certain operations on Bolt.
TheRoomProtocolToken
is just a simple Token that comes along with the Sample Package and exists just as an example, as so you can use the Token without creating it, in order to get a simple string passed by the server to the client, this can be like a map or a character to load.
On the other hand,PhotonRoomProperties
is an internal Token implemented inside the Bolt SDK, that you can use to configure a room when using theSetServerInfo()
function. By using this token you will be able to set the visibility of the room and/or some custom properties, so your clients will be able to know which type of game are you running (free-for-all or a team match for example), but these properties can be anything that is more related to your game.1 -
No, not all can be done with the custom Token. When you use the
SetServerInfo()
you are asking the Photon Server to create a room for your game, so other players can join it.
In order to setup this room, you need to use thePhotonRoomProperties
class, this is used to create the room similar to what happens on Photon Realtime (https://doc.photonengine.com/en-us/realtime/current/reference/matchmaking-and-lobby#not_so_random_matchmaking).
Photon Bolt uses Photon Realtime underneath to make the connection with the servers, but this is transparent to the user.
If you want that all your sessions are available to all players, so yes, you can use the custom Token, otherwise, you need to use our Token. We are currently implementing a filtering/searching utilities that will use the room properties as reference, but these can only be set using aPhotonRoomProperties
instance.5
Answers
-
Hello @donovan ,
Yes, there are some differences, but first, both are classes that implement theIProtocolToken
interface and can be passed as extra data to certain operations on Bolt.
TheRoomProtocolToken
is just a simple Token that comes along with the Sample Package and exists just as an example, as so you can use the Token without creating it, in order to get a simple string passed by the server to the client, this can be like a map or a character to load.
On the other hand,PhotonRoomProperties
is an internal Token implemented inside the Bolt SDK, that you can use to configure a room when using theSetServerInfo()
function. By using this token you will be able to set the visibility of the room and/or some custom properties, so your clients will be able to know which type of game are you running (free-for-all or a team match for example), but these properties can be anything that is more related to your game.1 -
Hi @ramonmelo ,
If I'm understanding correctly, anything that can be done with a custom Token (e.g. RoomProtocolToken) can be done with PhotonRoomProperties? Then why is there a need to define a custom Token in this case?
Thanks again!0 -
No, not all can be done with the custom Token. When you use the
SetServerInfo()
you are asking the Photon Server to create a room for your game, so other players can join it.
In order to setup this room, you need to use thePhotonRoomProperties
class, this is used to create the room similar to what happens on Photon Realtime (https://doc.photonengine.com/en-us/realtime/current/reference/matchmaking-and-lobby#not_so_random_matchmaking).
Photon Bolt uses Photon Realtime underneath to make the connection with the servers, but this is transparent to the user.
If you want that all your sessions are available to all players, so yes, you can use the custom Token, otherwise, you need to use our Token. We are currently implementing a filtering/searching utilities that will use the room properties as reference, but these can only be set using aPhotonRoomProperties
instance.5 -
The confusing bit to me is, why is that argument of the base token interface rather than just being a PhotonRoomProperties ? If the only way to configure your room for eventual discovery, matchmaking, etc is to pass a PhotonRoomProperties, why does it allow just any old token class? Seems like it would be better to take a PhotonRoomProperties argument, and then give you the option to register a subclass of PhotonRoomProperties to extend it with custom data, rather than writing your own token and then presumably being unable to configure the room properly. That way the internals can always expect it to be a PhotonRoomProperties and useful for configuring the room properties and you don't give up functionality if you have a need to make your own.0
-
Hello @JeremyS
You are not abligated to usePhotonRoomProperties
, this is just an extension class that you can use to have a more fine control of how the room will behave (visible/open). If you want to pass data to your clients when they connect to the room, fine, use a normalIProtocolToken
with any data layout you want.
The idea ofPhotonRoomProperties
is to be used by filtering (not yet implemented), as you are able to set custom properties on the room, and then search for the ones that you want to connect to.
Sure, we could make it extensible, so you can add more data to the token, but this is not our intention at the moment. In summary, you can just use the regularIProtocolToken
and it will work just fine.0