Hello everyone,
I am trying to make synchronous loading so that after number of players in room reach 6 players then the game will go to loading scene before spawning players at same time in arena then start the timer. I wonder how to do that in PUN?
Thank you for your help
↧
Sync loading for every players before spawn in Scene
↧
Deal with the webRCP
Hello, i saw that some of you work with PlayFab + PUN 2 so I post here...
i want to update a move in my turned based game, so i do
PhotonNetwork.WebRpc("SetColor", null);
How am i suppose to get it back in the Cloud Script ?
I have done this:
handlers.SetColor = function (args) {
server.WriteTitleEvent({
EventName : "wants_set_color"
});
return { ResultCode : 0, Message: 'Success' }; };
But i don't have wants_set_color in my log on PlayFab, instead i have raiseEvent, is webRcp make raiseEvent ?
How should I do that ?
Thank you.
↧
↧
Bug in Player.SetCustomProperties, expectedValues is not being null checked before being used
public void SetCustomProperties(Hashtable propertiesToSet, Hashtable expectedValues = null, WebFlags webFlags = null)
{
if (propertiesToSet == null)
{
return;
}
Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
Hashtable customPropsToCheck = expectedValues.StripToStringKeys() as Hashtable;
↧
Getting errors on an empty scene with the hidden "PhotonMono" object
I have a completely empty scene in my project (literally 0 game objects) and if i press play sometimes i get an error: "Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)"
I temporarily updated my project to Unity 2018.2 and now the error was:
"Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
PhotonMono"
And noticed the static PhotonNetwork class constructor is creating this object, and the times i get the error the object is not created at all.
Im guessing theres a race condition between the generation of the "PhotonMono" object and the scene cleanup unity does when pressing Play on editor.
Im gonna transfer the part the PhotonNetwork constructor creates the game object to an external method called Init and call this in my scene, but i wanted to be sure i wasnt doing something wrong, since this seems like something that would happen a lot to people.
↧
Cannot send to: xxx.x.xx.xxx. Not enough buffer space is available
I was trying to search for a solution for this but i'm having issues with running the game on the laptop (this is for IOS though) but still strange its closing the game with this error. Anyone know why it would be doing this?
Cannot send to: xxx.x.xx.xx. Not enough buffer space is available UnityEngine.Debug:LogError(Object) NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1522) ExitGames.Client.Photon.<>c__DisplayClass145_0:b__0() ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)
↧
↧
Photon OnPremise Server
Hi,
I am supporting the development of a multiplayer application in, of course, Unity. Up to this point, the devs have been using Photon Cloud on the backend for multi-player and voice. I'll have plenty of questions about implementing voice, but I am concerned now with an exception being thrown when we attempt to connect to the new OnPremise server.
So far, we've changed the connection settings in the PhotonServerSettings Inspector window. We aren't using name server, are leaving the appid realtime and voiceid to random numbers, setting a version number = 1, running in the background and setting the IP and port numbers for the OnPremise server. I should add that when I run the Stardust test client, it is able to connect to the server just fine with 3 to 5 connections, and i am using loadbalancing though I only have 1 box hosting the server.
Here is the exception being thrown. Any ideas would be greatly appreciated:
IndexOutOfRangeException: Index was outside the bounds of the array.
ExitGames.Client.Photon.Protocol16.SerializeDictionaryHeader (ExitGames.Client.Photon.StreamBuffer writer, System.Object dict, System.Boolean& setKeyType, System.Boolean& setValueType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:1048)
ExitGames.Client.Photon.Protocol16.SerializeDictionaryHeader (ExitGames.Client.Photon.StreamBuffer writer, System.Type dictType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:1038)
ExitGames.Client.Photon.Protocol16.SerializeDictionaryHeader (ExitGames.Client.Photon.StreamBuffer writer, System.Object dict, System.Boolean& setKeyType, System.Boolean& setValueType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:1082)
ExitGames.Client.Photon.Protocol16.SerializeDictionary (ExitGames.Client.Photon.StreamBuffer dout, System.Collections.IDictionary serObject, System.Boolean setType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:1030)
ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, System.Boolean setType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:627)
ExitGames.Client.Photon.Protocol16.SerializeObjectArray (ExitGames.Client.Photon.StreamBuffer dout, System.Collections.IList objects, System.Boolean setType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:1000)
ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, System.Boolean setType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:619)
ExitGames.Client.Photon.Protocol16.SerializeHashTable (ExitGames.Client.Photon.StreamBuffer dout, ExitGames.Client.Photon.Hashtable serObject, System.Boolean setType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:1017)
ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, System.Boolean setType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:604)
ExitGames.Client.Photon.Protocol16.SerializeParameterTable (ExitGames.Client.Photon.StreamBuffer stream, System.Collections.Generic.Dictionary`2[TKey,TValue] parameters) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:527)
ExitGames.Client.Photon.Protocol16.SerializeOperationRequest (ExitGames.Client.Photon.StreamBuffer stream, System.Byte operationCode, System.Collections.Generic.Dictionary`2[TKey,TValue] parameters, System.Boolean setType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/Protocol16.cs:442)
ExitGames.Client.Photon.EnetPeer.SerializeOperationToMessage (System.Byte opCode, System.Collections.Generic.Dictionary`2[TKey,TValue] parameters, ExitGames.Client.Photon.EgMessageType messageType, System.Boolean encrypt) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:1095)
ExitGames.Client.Photon.EnetPeer.EnqueueOperation (System.Collections.Generic.Dictionary`2[TKey,TValue] parameters, System.Byte opCode, ExitGames.Client.Photon.SendOptions sendParams, ExitGames.Client.Photon.EgMessageType messageType) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:936)
ExitGames.Client.Photon.PhotonPeer.SendOperation (System.Byte operationCode, System.Collections.Generic.Dictionary`2[TKey,TValue] operationParameters, ExitGames.Client.Photon.SendOptions sendOptions) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1505)
Photon.Realtime.LoadBalancingPeer.OpRaiseEvent (System.Byte eventCode, System.Object customEventContent, Photon.Realtime.RaiseEventOptions raiseEventOptions, ExitGames.Client.Photon.SendOptions sendOptions) (at Assets/DownloadedAssets/Photon/PhotonRealtime/Code/LoadbalancingPeer.cs:864)
Photon.Realtime.LoadBalancingClient.OpRaiseEvent (System.Byte eventCode, System.Object customEventContent, Photon.Realtime.RaiseEventOptions raiseEventOptions, ExitGames.Client.Photon.SendOptions sendOptions) (at Assets/DownloadedAssets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1603)
Photon.Pun.PhotonNetwork.RaiseEventInternal (System.Byte eventCode, System.Object eventContent, Photon.Realtime.RaiseEventOptions raiseEventOptions, ExitGames.Client.Photon.SendOptions sendOptions) (at Assets/DownloadedAssets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2193)
Photon.Pun.PhotonNetwork.SendInstantiate (Photon.Pun.InstantiateParameters parameters, System.Boolean sceneObject) (at Assets/DownloadedAssets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2523)
Photon.Pun.PhotonNetwork.NetworkInstantiate (Photon.Pun.InstantiateParameters parameters, System.Boolean sceneObject, System.Boolean instantiateEvent) (at Assets/DownloadedAssets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2447)
Photon.Pun.PhotonNetwork.Instantiate (System.String prefabName, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation, System.Byte group, System.Object[] data) (at Assets/DownloadedAssets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:2297)
NetworkMesherHelpers.NetworkModel.GenerateNetworkMesh (System.String nodePath, System.String linkPath, System.String statPath, System.String alertPath) (at Assets/Scripts/NetworkMesherHelpers/NetworkModel.cs:603)
GameManager.OnJoinedRoom () (at Assets/Scripts/Management/GameManager.cs:28)
Photon.Realtime.MatchMakingCallbacksContainer.OnJoinedRoom () (at Assets/DownloadedAssets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3348)
Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/DownloadedAssets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2476)
ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:633)
ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:545)
ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1473)
Photon.Pun.PhotonHandler.FixedUpdate () (at Assets/DownloadedAssets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:130)
↧
what are some Best Tutorials to learn photon PUN 2?
Any Paid tutorials will be great on udemy.
Where can I find some of the best tutorials for Photon-2 this year?
As Unet being Deprecated by Unity Photon is Claiming to be the Number One Platform To create Realtime Multiplayer GAMES. Recently Photon Changed The implementation in Photon 2 with better and optimized and well structured code.
As being the number one still lack in documentation.
↧
Raise event
How to instantiate object for other players in the same room using raise event?
↧
Ownership transfer
Hi!
I have the following situation:
Player loses connection, becomes inactive and server waits for that player's reconnect. And I'm trying to get that disconnected player controlled by AI or something like that until he/she reconnects. So the master client takes care of everything, but only after playerTtl time expires, since only then player view is owned by scene. So the question is: is there a way to get ownership of the disconnected player view?
I've read something about Ownership Transfer and I know I shoud choose TakeOver option for the desired PhotonView. But I don't get what to do next and I'm not sure if that ownership transfer would succeed since the current owner is disconnected. Also, what will happen if that player reconnects? Will he be the owner of that view again?
P.S. I'm sorry for my English
↧
↧
High ping PUNBasis
Hello,
i have done the PUNBasics demo with PUN2 and i calculate the ping myself: with RCP, i send a call and the 2nd player send me back the call. I get around 100-200 ms and it's very variable. The ping with the EU server is 42ms (written in the log at the launch of the game), being in France. I would like to know if my calculation seems right (according to the EU ping). And also, how can I get this ping better ? But maybe this is normal and there shouldn't be any latency ? Because for now the demo doesn't seem to lag or just a bit but maybe it's because the game is quite simple ? It's very important cause i have to decide if I'm gonna use photon for the game project of my company. (which would rather like to keep a free version).
↧
Can we join a game removed from Photon Cloud ?
Hello,
i'm posting here just to get a little confirmation before going any further in my project with Photon. Is this scenario possible with Photon + Playfab, in turned based game:
- PlayerA starts a game
- He plays his turn and can't do anything more as it's the turn of the future opponent
- He disconnects to do something else (without leaving the game), so the room is out of the Photon Cloud but stored in PlayFab
- PlayerB wants to play too, he doesn't create a room as a place is available in the PlayerA's room, he joins it
(- The max players is reached, the room isn't available anymore for other players)
I think about the RoomCreate with type="Load" but i don't know if the fact that "we can join a room removed from photon cloud" is true only if the PlayerB has already previously been in this room. (That he was registred in the player list of the room because he joined when the room was on Photon Cloud)
I hope you got the point ! :neutral:
Thanks
↧
Single player Sync
I'm new developer with PUN and i hav a question about PUN. Can i make a Single Turn based strategy that Sync each player action like skill. targeting, moving... so when they disconnected, they can reconnect back to the game (maybe in 1 or 2 days after), everything still exactly like when they disconnected?
Sorry if my engrisk not good.
↧
Disconnection followed by stuck reconnecting/disconnecting 'DisconnectByServerLogic'
Photon seems to be working perfectly for the most part, but we're getting these random disconnects, 'ClientTimeout', 'ServerTimeout', etc. but my game would never be able to reconnect again (which means the player cannot create/join rooms anymore) properly constantly attempting to reconnect but getting disconnected (cause 'None' and 'DisconnectByServerLogic') until an arbitrary amount of time (10-20++ minutes) pass by and it would stop disconnecting and start working again. Rebooting the game fixes the issue immediately as well. Any insight or advice would be greatly appreciated.
Internet connectivity: Wifi
Unity version 2018.2.20f1
Photon version 2.8 (was 2.5 but updating to 2.8 did not resolve the issue)
Photon analyze:
Max CCU: 5 (out of 10)
Rooms max: 3
Msgs/per room max: 44
Traffic: 54.9MB
Rejected Players: 0
↧
↧
Async Turnbased. Error Converting State to type 'Photon.Hive.Plugin.SerializableGameState
Hello,
I am using Pun 2 - Free & PlayFab CloudScript to make an async turn-based game.
Everything has worked smoothly so far except for loading a room with the serialized (JSON.stringified) state.
When loading a new room with the return
{"State":"", "ResultCode":0}
, the game starts fine and transitions from my Main Menu into the Main Scene. Perfect!
I am also able to successfully save the room state on /PathClose to my web server after the EmptyRoomTTL of 12 seconds has passed. I also have set the PlayerTTL = -1 according to the documentation.
The errors occurs when a Player attempts to ReJoin a room with the return {"State":data.State, "ResultCode":0}
where data.State
is the serialized state fetched from a web server.
I receive this error in the OnJoinRoomFailed callback. Error converting value data.State to type 'Photon.Hive.Plugin.SerializableGameState'
. I am stripping out the DebugInfo property that is passed into the /PathClose webhook before posting to my web server but the error occurs even if I just save the whole State.
I can't quite figure out where to go from here!
Does anybody have any advice or tips to push me in the right direction? Thanks for your time:)
↧
Exception: Can't add. Size exceeded.
I have a Dictionary that I am trying to send in OnPhotonSerializeView. Unfortunately, when I do this, it throws an exception as follows-
Exception: Can't add. Size exceeded.
at Photon.Pun.PhotonNetwork+SerializeViewBatch.Add (System.Collections.Generic.List`1 viewData) [0x00034] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1390
at Photon.Pun.PhotonNetwork.RunViewUpdate () [0x00123] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1467
at Photon.Pun.PhotonHandler.LateUpdate () [0x00025] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonHandler.cs:132
Is this not supported? The docs on Serialization says it should be. I'm using PUN 2.9 and my code is simple-
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.IsWriting)
{
stream.SendNext(MyData);
}
else
{
MyData = stream.ReceiveNext() as Dictionary);
}
}
I have verified that MyType otherwise works correcty, and also sending arrays of the keys and values also works as a workaround. It just doesn't seem to like my Dictionary.
↧
PUN 2.9, have not run the OnJoinedRoom callback when I was the second one into the room
I use the PUN 2.9 . I found when I was the first one into the room(which means I was the ClientMaster).Everything is OK. But when I was the second one into the room. The function "OnJoinedRoom" would not run. It just switch to the sync scene. But I did not write any code to load the scene. What I want is callback the OnjoinedRoom, And then load a loading scene. finally get into my sync scene. My sync scene is too big to direct load. There would be a lag.
I hope you know what I mean. My English is so poor. If there is any confuse. Please just ask me.
↧
AuthenticationValues, UserID, Photon Standalone Server
I've seen some posts about setting the UserID in AuthValues when using the standalone server. I understand, I think, that each user connecting to the server needs a unique user ID. A couple of questions:
1. I'm not asking for user credentials in my application, users simply connect. I don't want to manage users at this point, so what is the best method for creating a user ID?
2. I see references to AuthValues in at least three clients: LoadBalancingPeer, LoadBalancingClient and PhotonNetwork. I know I need to set the UserID attribute before connecting to my serverf, but in which of these classes do I set this value. They all call a Connect() method as far as I can see, so where should it be set. I've searched the forums, but while I see some code snippets, each different, nowhere have I seen where to actually set the value so that it is available for any class calling Connect().
Any help? Much appreciated.
↧
↧
Does PUN use Time.timeScale?
I want to make a end screen for my game when a round ends, and I thought it'd be cool to make everything slow down. Does photon use the Time scale at all? Just making sure so I don't run into any bugs
↧
Adding Vector3 to transform.position looks strange?
Okay, I've had this question closed for being a duplicate and I have a feeling nobody answered as I didn't give enough detail. So don't close this question yet, JohnTube. I'm making my player move by adding a Vector3 to his position, and it works fine on my client. The problem is, while the player moves perfectly on my client, other players won't see me "dash", more just move a little bit upward. It's not like the players are going out of sync, and I believe the problem is how the player lerps on other clients. How can I get the same behaviour on other clients? I have a Photon View, Photon Transform View and a Photon Rigidbody 2D View on my player if that helps.
↧
Master client background issue with photon (PUN) in unity
I'm making a multiplayer game like tambola (housie) using photon (PUN) in unity3d where random number is generating in the master client. That generated number is send to all clients using RPC. Now my problem is when my master client goes in the background, master client doesn't able to send RPC to other clients. Because of that game freezes in all the connected players.
So any workaround for this? Where game won't freeze and random numbers keep on generating though my master client goes in the background.
TIA
↧