Photon Realtime C# Client - Changelog Exit Games GmbH - www.photonengine.com - forum.photonengine.com Version 4.1.4.3 (24. July 2020) Added: Check that the Dev Region override is in the list of available regions (from Name Server). If not, the first available region is being used. Changed: RegionPinger.Start() now attempts to use a ThreadPool WorkerItem to ping individual regions. Only if that fails, a separate managed Thread is used. This should help avoid running into Thread limits (if any). Builds for NETFX_CORE don't use this. Changed: Error handling in PingMono. SocketExceptions were not handled entirely. Changed: PhotonPingClasses is no longer used. It's empty and can be removed. Changed: Handling of event LobbyStats in case of LoadBalancingPeer.UseByteArraySlicePoolForEvents. This relates to a new option in the PhotonPeer to use pooled memory (wrapped byte[] basically) when incoming events only contain a byte[]. See changes-library.txt and API reference. Added: Initial puzzle pieces for WSS Proxy support. This is not yet funtional. To actually use the proxy settings, a special WebSocket implementation is needed. Changed: The AppSettings.Port value is now also usable when connecting to a Name Server initially. This allows custom ports on a (custom) Name Server. Added: Various details to the SupportLogger output. Changed: Callback OnCreatedRoom() is now also triggered by the event Join. This is the same trigger as for JoinOrCreateRoom (if that created a new room). Added: Player.HasRejoined value. This is set for the local and remote players and can help define the workflow on ReJoin. Added: LoadBalancingClient.EnableProtocolFallback. If enabled, the client will try another protocol if the initial connect to the Name Server fails. Added: AppSettings.EnableProtocolFallback with a default of true. Used in ConnectUsingSettings to set the client's value accordingly. Internal: Added setting the LoadBalancingClient.Server in Connect and other places, so it should be accurate. Added: Checks for connections on WebGL and Xbox One. Settings that can be corrected (to match the platform's requirements) are corrected with a log note. An Exception is thrown, if the settings can't be corrected automatically. This means Connect methods may throw an Exception in some cases, which are to be fixed during development time. Version 4.1.4.2 (8. May 2020 - rev5519) Fixed: EventLeave handling. The IsInactive property is to false before doing the OnPlayerLeftRoom callback. Note: Use Player.IsInactive to know the 'reason' for the callback. Version 4.1.4.0 (27. April 2020 rev5469) Fixed: When connecting directly to a Master Server (self hosted), the serialization protocol 1.6 is used (not the detault 1.8). This was changed accidentally in v4.1.3.0 (and thus PUN 2.17). Added: Connection state check in CheckIfOpCanBeSent() to fail early if an op can't be sent. Updated: WebRPC handling and added an example to the doc of OnWebRpcResponse. Added: Logging of OnJoinRoomFailed to SupportLogger. Changed: StripKeysWithNullValues to reuse a list of key with null-values. This causes less allocations and garbage to clean. As a downside, the method now runs only for one thread (even for distinct IDictionary instances). This should not be a problem for the expected use case. Changed: The LoadBalancingClient.OnStatusChanged will handle StatusCode.SendError as disconnect due to Exception. Log level INFO should log the inner exception when sending. Fixed: Cleanup of the RoomReference for the local player object on disconnect. This prevents issues when setting properties, after joining and leaving a room (back on Master Server). Internal: LoadBalancingClient.ExpectedProtocol is now a nullable property with private setter. It's used internally (only) to switch to the target transport protocol when Authmode AuthOnceWss is "done". Fixed: EventLeave handling. When a player gets removed from the room, the IsInactive property must be set to false before doing the OnPlayerLeftRoom callback. Use Player.IsInactive to know the 'reason' for the callback. Version 4.1.3.0 (23.03.2020 rev5394) Changed: Trying to set empty custom properties Hashtable will fail (return false) and log error. Changed: In online mode, trying to set properties while not joined to a room will fail (return false) and log error. Caching local player properties could be allowed though. Changed: Player.InternalCacheProperties is now "protected internal" and no longer "public". Changed: LoadBalancingClient.OpSetPropertiesOfRoom is now "protected internal" and no longer "public". Use LoadBalancingClient.OpSetCustomPropertiesOfRoom or Room.SetCustomProperties. Changed: StatusCode.EncryptionFailedToEstablish will cause disconnection with DisconnectCause.ExceptionOnConnect. Changed: Fix for Unity cloud build context to prevent sanitization of server settings, it's not needed and for some reason doesn't detect the current server settings. Changed: AppSettings. The NonSerialized attribute is now only used in Unity builds. Changed: With the updated Photon library (v4.1.3.0), the encryption can be set to true on any connection, including WSS. It should not be used conditionally for Auth. Changed: GetPingImplementation() new sets a default PhotonPingImplementation for UNITY_WEBGL, NETFX_CORE and regular Mono/.Net. Internal: New datagram encryption mode DatagramEncryptionGCMRandomSequence (value 12). To be used later on. Internal: The SocketWebTcp.SerializationProtocol is now selected by the PhotonSocket with the Peer's current value. It no longer needs to be set. Version 4.1.2.20 (12. December 2019 - rev5296) Added: New callback IErrorInfoCallback.OnErrorInfo when the client receives an ErrorInfo event from the server. Changed: RegionPinger use a singleton MonoBehaviourEmpty for coroutine ping in WebGL in Unity. Added: LoadBalancingClient.SerializationProtocol property to get or set the binary protocol version. Use this always instead of setting it via LoadBalancingPeer.SerializationProtocolType. Added: LoadBalancingClient.ConnectUsingSettings(AppSettings appSettings). This allows Best Region connect, setting a custom name server and much more. Changed: Connect() is now ConnectToMasterServer(). Unlike ConnectUsingSettings(), this requires some settings to be done on the client. Added: Return parameter for all methods that set properties on the server. Note: Room.SetCustomProperties returns bool. If you did override this, your project will have errors, make sure to fix the return type. Changed: Failed Authentication will no longer call the OnDisconnected callback twice. This should better align with expectations. Internal: Pinging regions via coroutine (when Threads are unavailable) now uses only one GameObject for all pinging. Version 4.1.2.19 (12. November 2019 - rev5266) Fixed: The ExpectedProtocol is now also set for Authmode "AuthOnce" for ConnectToNameServer and ConnectToRegionMaster. Changed: Player.ToString() to show ActorNumber and NickName. The PlayerProperties are included in ToStringFull(). Changed: Logging message for OpAuthenticateOnce (only logged at info level and up). Changed: Avoiding a potential nullreference exception on leave of another player. Updated: Cluster support. The LoadBalancingClient.CurrentCluster gives access to the current cluster. Region.SetCodeAndCluster() now separates the cluster string properly. See ConnectToRegionMaster, too. Fixed: Changing the SupportLogger.Client now skips registering for callbacks, if the new value is null. Changed: Logging of SupportLogger. Added: LoadBalancingClient.OpJoinRandomOrCreateRoom. This can be used to create a room, should random matchmaking fail. This helps avoid race conditons where players can't find one another. Added: Extra null-check in handling of event leave. Version 4.1.2.17 (9. August 2019 - rev5188) Changed: SupportLogger. Traffic stats are enabled by default. The PhotonHandler no longer has to enable this. Added: Min/max ping to logged statistics. SupportLogger.TrackValues is invoked to keep track of min/max ping for each connection. Fixed: Statistics logging is started on Connect and stopped OnDisconnected(). Changed: Callback registration. Changed: All callback target changes are now queued in one queue and executed in order. This avoids cases where our implementation defined if a callback got added or removed, when a target got added and removed. Changed: Duplicate addition and removal is now prevented. Changed: The callback containers now know and use the LoadBalancingClient to update the targets. This means they don't need lists for additions and removals anymore. Changed: Events will now also update the callback targets before executing the event callback. Changed: WebRpcCallbacksContainer is now also a List like the other containers. This is simpler to maintain. The only "custom" callback implementation is that for events. This was an event delegate before and remains one. No change for this. Changed: The callbacks to OnDisconnected(reason). On timeout or exception, there is now only one callback which happens after the client/peer is actually disconnected. The peer's status changes (timeout, etc.) are used to identify the reason but don't cause a callback on their own. Previously, you could run into more than one OnDisconnected call and fail to reconnect in the first one. Changed: There are now fewer calls of OnDisconnected(). Example: A timeout disconnect caused two calls because signalled the timeout and the second signalled when the client locally finished disconnecting. Now, the DisconnectCause stores the reason and there is only one callback. Changed: Internal use of DisconnectCause. It's now set in LBC.Disconnect() and by errors from the Peer. It's reset to "None" before calls to Peer.Connect(). Removed: DisconnectCause enum values that were obsolete already. DisconnectByServerUserLimit is now MaxCcuReached. TimeoutDisconnect is now ClientTimeout. DisconnectByServer is now ServerTimeout. Changed: OnStatusChanged() case Disconnect always sets the CurrentRoom to null. It is no longer used to store the roomname from the Master Server to use on the Game Server. Removed: LoadBalancingClient.didAuthenticate, which is no longer needed for the cleaned up logic. Changed: WebRpcResponse.ReturnCode -> ResultCode and WebRpcResponse.DebugMessage -> Message. Changed: AuthenticationValues.ToString() to include more useful info. Changed: Execution order for disconnect on quit. As OnApplicationQuit is followed by OnDisable, PUN now disconnects in OnDisable, if OnApplicationQuit was called previously. This means that you can now send a final message in OnApplicationQuit. It's not guaranteed to arrive anywhere, as the message won't be repeated on loss. Removed: PhotonHandler.OnDestroy which was not needed anymore. OnDisable is also called when the app quits, so it's adequate to tear down the thread there. Removed: Outdated and unused PingMonoEditor. Changed: Random ID for each ping is now truly randomized. Changed: Region pinging result logging. Per region, all rtts are available, as well as a previous summary (if any). Pun gets it via RegionHandler.GetResults(). Version 4.1.2.15 (7. June 2019 - rev5137) Added: Options for OpFindFriends to filter which rooms should be returned by the server. The default is the same as before but now the friend list may exclude rooms which are not yet on the game server, invisible, closed (or any combination). Added: SimulateConnectionLoss(bool) to simplify testing of connection loss. This uses the built-in network simulation to get a client timeout disconnect. Removed: EventExt class, which only contained obsolete methods. Version 4.1.2.14 (6. May 2019 - rev5097) Changed: Realtime API changes are now listed in a separate changes file. Updated: Demos to make use of Sender and CustomData. Version 4.1.2.13 (3. May 2019 - rev5086) Changed: Renamed ClientState items which ended on "Gameserver" and "Masterserver" to using PascalCase "GameServer" and "MasterServer". The previous names are obsolete to ease upgrading this, if needed. Updated: Checks if any given operation can be sent (to the currently connected server) or not. As not all operations are available on all server types, this may help avoid some mismatches. Fixed: BroadcastPropsChangeToAll is applied correctly (it wasn't used properly, when false). Fixed: When in offline mode, OpSetPropertiesOfActor does not get called (it failed due to not being connected). Version 4.1.2.11 (15. April 2019 - rev5043) Changed: InLobby property is now checking the State == JoinedLobby, which is analog to InRoom. Changed: IsConnectedAndReady is now also false for ClientState.DisconnectingFromGameserver, DisconnectingFromMasterserver and DisconnectingFromNameServer. Changed: GetGameList check if the filter is null or empty. It's not sent for empty filters. Added: Nintendo Switch as CustomAuthenticationType. Version 4.1.2.10 (11. March 2019 - rev5023) Changed: The cached "best region" is cleared whenever a region's pinging finishes. This fixes a potential issue when the BestRegion value is used before the pinging is done. Then, you end up with a wrong selection. Changed: PhotonPing now reuses the Socket per region. Changed: The RegionHandler now checks #if PING_VIA_COROUTINE to use a coroutine instead of a thread (per region). This is for WebGL exports from Unity. Changed: The SupportLogger now uses a Stopwatch to log the time (not depending on Unity's APIs). Version 4.1.2.1 (31. July 2018 - rev4787) Changed: OnStateChangeAction is now named StateChanged and provides a "previous state" value. State changes only trigger the event-call when the value actually changes. Renamed: OnEventAction to EventReceived and OnOpResponseAction to OpResponseReceived. Added: LoadBalancingClient now has AddCallbackTarget and RemoveCallbackTarget to simplify registering for various callbacks. Version 4.1.2.0 (3. May 2018 - rev4660) Changed: The namespace to the simpler "Photon.Realtime". Added: Various callbacks to signal specific situations / events. To get those, a class must implement the interface and be added to a list of "Targets". See: ILoadBalancingCallbacks. Added: RegionHandler, which provides methods to ping a list of regions and to find the one with best ping. This moves PUN's "Best Region" feature to the LoadBalancing API. Moved: The PhotonPing was part of the dll but is now part of LoadBalancing. Added: LoadBalancingClient.UseAlternativeUdpPorts. This way, UDP may use ports of the Steam Multiplayer port-range by simply replacing existing port strings in addresses. Changed: RaiseEvent now has an overload, that uses RaiseEventOptions and SendOptions. The old variant is obsolete but will still work. Changed: CheckUserOnJoin is now set by default. The RoomOptions.CheckUserOnJoin got removed. Added: Client-side checks and limits for OpFindFriends. Added: Optional parameter sendAuthCookie to OpLeaveRoom. The app can control what's passed from Photon to a server via WebHook. Changes: The room list for lobbies is no longer part of the LoadBalancingClient. Instead, implement the callback for the changed room list. Added: AppSettings, a base class to host AppId and some settings for a title. This will help make it available across products. Right now, the LoadBalancingClient is not using it yet. Changed: Player.ID is now .ActorNumber, which mirrors the server's naming. Fixed: Unity compile defines to support Unity 2018, Version 4.1.1.18 (19. December 2017 - rev4540) Changed: FriendInfo.Name is now "UserId", which is up to date with it's usage. Changed: CheckUserOnJoin is now set by default. The RoomOptions.CheckUserOnJoin got removed. Version 4.1.1.17 (11. October 2017 - rev4465) Changed: OperationCode const byte Join = 255 is now marked obsolete. We use "JoinGame" instead. Added: DisconnectCause.AuthenticationTicketExpired. Fixed: DebugReturn call in Unity WebGL. Version 4.1.1.15 (17. July 2017 - rev4232) Added: LoadBalancingClient.TransportProtocol as shortcut to the use PhotonPeer's TransportProtocol value. This enables setting the protocol easily while not connected. Added: LoadBalancingClient.SocketImplementationConfig as shortcut to modify PhotonPeer's SocketImplementationConfig. This enables you to setup which IPhotonSocket implementation to use for which network protocol. Changed: LoadBalancingPeer.ConfigUnitySockets() to try to find our websocket implementations in the assembly, making the SocketWebTcpCoroutine and SocketWebTcpThread classes optional. Removed: Class "SocketWebTcp" is no longer found by ConfigUnitySockets(). Version 4.1.1.14 (5. July 2017 - rev4191) Changed: The ClientState "Uninitialized" is now "PeerCreated". This is the initial state. ConnectedToMaster is now ConnectedToMasterserver (both use the same value). Updated: ClientState values descriptions. Internal: GameEnteredOnGameServer() first sets the local player's actorNumber, then updates the player lists. Version 4.1.1.8 (24. February 2017 - rev3873) Added: Player.UserId field and code to read published UserIds from the player properties in CacheProperties(). When publishing the UserId in a room (RoomOptions.PublishUserId = true), the UserId becomes available for all players in a room. Good to find/make friends or follow a team player into another room. Added: New matchmaking operation: OpGetGameList(typedLobby, sqlFilter). This fetches a list of rooms that match the filter. You can show lists of rooms with specific properties, if needed (or still use OpJoinRandom). Fixed: WebFlags properties setters. Version 4.1.1.7 (16. December 2016) Fixed: Demos with persistent (Turnbased) games. The Memory Demo was not setting up rooms correctly (which led to errors joining them) and used a "join" rather than a "rejoin" to get into saved games (getting added to the room once more). Version 4.1.1.6 (9. December 2016 - rev3801) Added: OpJoinRandom will now "remember" to send ExpectedUsers to the Game Server (by caching the value). Added: AuthEvent and it's handling. This (internally sent) event can now update the client's token anytime (before that expires). Added: LoadBalancingClient.OpChangeGroups(). Changed: LoadBalancingClient.Disconnect() no longer sets it's own State to Disconnected. It waits till the state-change callback gets called by the lib. Version 4.1.1.2 (13. September 2016 - rev3652) Removed: LoadBalancingClient.PlayerName and Player.Name. Were obsolete for more than a year. There is a NickName and the UserId can be set in the AuthValues. Removed: OpJoinRoom() overload with actorNumber. This was obsolete. To enable clients to return to a room, set AuthValues and a userID. Changed: LoadBalancingClient no longer overrides the protocol for Unity WebGL. This is done in the LoadBalancingPeer.ConfigUnitySockets(). Changed: GetNameServerAddress() is the same in Chat and LoadBalancing APIs now. Added: DisconnectCause.DisconnectByServerLogic and handling for this case. You can check this DisconnectedCause when the LoadBalancingClient.State is ClientState.Disconnected. Added: Hashtable definition to use Photon's own implementation for Windows Store builds (NETFX_CORE). This must be used but it means you to use the same Hashtable definition in all builds (no matter if 8.1 or 10). Added: Support for WebGL export in Unity. Changed: OnStateChangeAction, OnEventAction and OnOpResponseAction are now events. To register a method in one of those, use += and to deregister you need to use -=. This prevents assigning a new method and de-registering any previously registered ones. Version 4.1.1.0 (15. August 2016 - rev3536) Fixed: Room.ClearExpectedUsers() is now sending it's current, local "expected users" to update the server with "CAS" (Check and Swap). This gives the client an update when the values become valid (which updates the local cache after the roundtrip). Added: Support for the 'Server Side Master Client' feature. The Room will read master client updates from the server accordingly. Room.SetMasterClient() enables you to override the server's selection (provided it did not change before your operation gets executed). Changed: Option for bool WebForward into the new "WebFlags". This allows fine control of which data is being sent to WebHooks. This affects all SetProperties, OpWebRPC and the RaiseEventOptions. Added: WebRPC.cs to the LoadBalancing API folder (was available separately before). It contains WebFlags and WebRpcResponse. Version 4.1.0.6 (21. June 2016 - rev3376) Fixed: LoadBalancingPeer.OpRaiseEvent(...) to send operations (and events) unencrypted again. Version 4.1.0.2 (21. April 2016 - rev3283) Added: Expected Users. This affects the Room, LoadBalancingClient, JoinRoom, JoinOrCreateRoom and CreateRoom. Added: null check in Extensions.StripToStringKeys(). Fixed: FriendInfo.IsInRoom, which returned the opposite of it's naming! Also changed FriendInfo ToString() according to PUN's. Added: RoomInfo expectedUsersField, which is updated with room properties (well known ones). Added: Room.ExpectedUsers and ClearExpectedUsers() to expose the list of expected players. Added: RoomInfo.serverSideMasterClient and masterClientIdField (also updated with well known properties). Changed: OpRaiseEvent now re-uses a Dictionary in the LoadBalancingPeer. It uses Clear(), rather than creating a new Dict each time. Changed: AuthenticationValues to also use C# properties and and backup-fields. This is guaranteed to work in Unity. Updated: EventCode ErrorInfo reference with a link to "WebHooks" doc online. Changed: Disconnect handling in the LoadBalancingClient. The client should reset correctly and log info, if it's in a State where a disconnect is a proper error. Note: In some cases like "switching server", a disconnect is expected, so it's not an error then. Fixed: PlayerProperties sent to game server will now include well-known properties again. This fixes the "NickName missing" bug. Fixed: LoadBalancingClient.State value when the client fails to join or create a game on the Master Server. The state is correctly re-set to ClientState.JoinedLobby or ClientState.ConnectedToMaster. Internal: Added private inLobby value, to store if the client was/is in a lobby on the Master Server. Fixed: DemoClient (in demo-loadbalancing) now makes use of the Name Server by using: ConnectToRegionMaster("eu"). Added: DemoClient now has debug output when the connection times out or can't be established. Version 4.0.5.1 (18. January 2016 - rev3187) Added: OpSetCustomPropertiesOfActor() and OpSetCustomPropertiesOfRoom() now check locally, if the client is currently in a room. It must be, to be able to set these properties. An exception exists for setting properties for the local player's actorNumber, but those are better set via LoadBalancingClient.LocalPlayer. Version 4.0.0.11 (28. October 2015 - rev3093) Added: LeaveLobby handling in OnOperationResponse(), which sets the client's state correctly. Changed: Order of execution for Ev Join. If user is known (inactive user rejoins), the player's props are read. The actor list is used, if available. Changed: RoomOptions to use properties with backup-fields to avoid issues in Unity which has issues with Object Initializer (curly brackets). Changed: JoinMode 2 is now "JoinOrRejoin". Was: "Rejoin". Added: ErrorCode constant AuthenticationTicketExpired. Internal: OpJoinRoom, OpCreateRoom and OpJoinRandomRoom no longer use a (growing) list of properties. Instead, classes were created to "sum up" their parameters. The api for games didn't change. Internal: Related to the refactoring of Join/Create, the LoadBalancingClient now creates a Room instance when the client arrived on the GameServer (before, it got created in the initial "create" call). Version 4.0.0.10 (14. July 2015 - rev2988) Updated: Description for IsConnectedAndReady. Changed: NameServerAddress to return a fitting address depending on protocol (including WebSocket but not yet RHTTP). Updated: The only name server host is now "ns.exitgames.com", which gets turned into a proper address by protocol. Changed: LoadBalancingClient.CustomAuthenticationValues is now .AuthValues. You can use those values to identify a user, even if you don't setup an external, custom authentication service. Changed: LoadBalancingClient.UserId no longer directly stores the id but puts it into AuthValues. This means, the UserId could also be set via setting AuthValues. Changed: The API of AuthenticationValues. There is now the UserId and AddAuthParameter() replaces the less general SetAuthParameters() (which only set specific key/values). Changed: PlayerName gets renamed to NickName, so PhotonPlayer.Name becomes .NickName and LoadBalancingClient.Name becomes .NickName, too. The old naming is marked as obsolete. Changed: Particle Demo now connects to the Cloud by default (because it's easier to setup and try). You can define your own Master Server (Photon OnPremise) of course. Added: GamePropertyKey.MasterClientId (248) and ParameterCode.MasterClientId (203) Added: ParameterCode.ExpectedValues (231) Added: ParameterCode.SuppressRoomEvents (237) Version 4.0.0.6 (05. December 2014 - rev2758) Added: LoadBalancingClient.OpJoinOrCreateRoom overload which has lobby as parameter. If a room gets created, this defines in which lobby it belongs. Changed: LoadBalancingPeer: Added new error code PluginMismatch, documentation for Plugins parameter code. Version 4.0.0.1 (17. June 2014 - rev2663) Added: LoadBalancingClient.OpRaiseEvent(). Now that LoadBalancingClient USES a loadBalancingPeer (and doesn't extend it), things are much easier by offering this method, too! Added: LoadBalancingClient.IsConnected and .IsConnectedAndReady to LB API. Going to be part of the API from now on. Removed: Unused fields clientId and clientCount. Changed: Field for internal use "lastJoinActorNumber" is now private as intended. Changed: LoadBalancingClient.Disconnect is now setting it's own state to Disconnected if the connection got closed (as expected). Version 4.0.0.0 (23. May 2014 - rev2614) Changed: LoadBalancingClient.FriendList creation/update is delayed until the server's response is available. This avoids cases where the friends are offline for the moment between requesting the update and getting it. Initially, it is null as before. Added: some methods to Player to find next player, etc. Useful for turnbased games to find an opponent. Added: LoadBalancingClient.UserId, which is the ID of a user(account). This is used in FindFriends and when you fetch account-related data (like save-games for Turnbased games). Set it before Connect*(). As fallback when empty during connect, the PlayerName is used instead. Removed: LoadBalancingPeer.OpSetCustomPropertiesOfActor and OpSetPropertyOfRoom which were too special to be so low level. Could be implemented to LBClient. Fixed: OpJoinRandomRoom and OpCreateRoom which didn't reset the ActorNr to claim when entering the room. Depending on previous actions, some calls of those methods did fail when the actorNumber wasn't available. Changed: OperationCode.Rpc is now called OperationCode.WebRpc. It's simply much cleaner (considering PUN has RPCs as well but in a different context). Changed: WebRpcResponse reading to be able to handle additional data. Added: Parameter webForward to: OpSetCustomPropertiesOfRoom and OpSetPropertiesOfRoom. The "old" overloads of these methods are still there, too. If webForward is true, the properties are sent to the WebHooks.