Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all 8947 articles
Browse latest View live

Photon not disconnecting if we disconnect internet while connected

$
0
0
Hi,

We are facing this issue with PUN. While game is running and if we disconnect internet, we don't get disconnect callbacks and game keeps running.

PUN + 1.73
Unity 5.4.2p2

Steps to reproduce
1. Connect your device or machine to a wifi
2. Once inside room, remove internet cable from your router or if you are using android device just pull down setting and switch off wifi.

Notice that app doesn't get disconnected. We have set background time out and app disconnect time out to 10seconds.

Thanks

Shared ownership (soccer, air hockey etc)

$
0
0
This has been asked about before, but the answers doesn't help me with the small Ownership transfer lag.
In a game like this: https://youtube.com/watch?v=wIsFce5SZ3I
I have two players and a ball with a photonview. When the player touch the ball, the ownership is transfered to them. This causes some noticeable jitter and by doing so, I can't "push" the ball during the transfer.
That means that when I want to hit the ball back (when it goes toward my player) it doesn't push back, but stops .... the second hit works as intended (but that is probably because the transfer has occured).

Why ownership transfer slow ?

$
0
0
Im making online air hockey game. When player hit puck, player requesting ownership like puck.TransferOwnership(player.ownerID).

But ownership transfering between 0.4 or 0.9 second. I need speed up this transfering. If transfer complete between 0.4 - 0.9 second, puck is not correctly sync position.

How to make work Photon with VRTK

$
0
0
Hello,
I'm making a game with Photon and VRTK.
I have a problem of synchronization of my object in the game.
I explain : I have a gameObject with a component VRTK-interactableObject on it. I want to put it on a dropZone on my playerprefab. This works on the local player but the object in the other player rest on initial game and not in the first player.

You can find here 3 images on my settings :

https://drive.google.com/drive/folders/1xlgvEiGlU2xM-HiKTfYjJhOEC3tmfvGv?usp=sharing

best regards

Ryu

Client becomes Master when entering the room, only on iOS, Any ideas?

$
0
0
I'm using UFPS and the UFPS Multiplayer Kit, the problem I have is that when a client enters the room the game crashes for the master only, everything works as expected on the client (now new master), in other words it can only be one master and it will keep crashing if someone else enters the room, the problem it only appears on apple devices, I mean Mac (while testing in Unity) and iPhones or iPads, on Android everything works, as well as on PC. Here are the console errors:

NullReferenceException: Object reference not set to an instance of an object
vp_BodyAnimator.InitMaxSpeeds () (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_BodyAnimator.cs:823)
vp_BodyAnimator.Awake () (at Assets/UFPS/Base/Scripts/Gameplay/Player/vp_BodyAnimator.cs:310)
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
vp_MPPlayerSpawner:InstantiatePlayerPrefab(PhotonPlayer, Hashtable, Int32, Int32, Int32, Int32, Int32) (at Assets/UFPS/Multiplayer/Scripts/Master/vp_MPPlayerSpawner.cs:401)
vp_MPPlayerSpawner:ReceiveInitialSpawnInfo(Int32, PhotonPlayer, Vector3, Quaternion, String, Int32, Int32, Int32, Int32, Int32, Int32, PhotonMessageInfo) (at Assets/UFPS/Multiplayer/Scripts/Master/vp_MPPlayerSpawner.cs:311)
System.Reflection.MethodBase:Invoke(Object, Object[])
NetworkingPeer:ExecuteRpc(Hashtable, Int32) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:3022)
NetworkingPeer:RPC(PhotonView, String, PhotonTargets, PhotonPlayer, Boolean, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:3831)
PhotonNetwork:RPC(PhotonView, String, PhotonTargets, Boolean, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:2941)
PhotonView:RPC(String, PhotonTargets, Object[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:597)
vp_MPMaster:TransmitInitialSpawnInfo(PhotonPlayer, Int32, String, Int32, Int32, Int32, Int32, Int32, Int32) (at Assets/UFPS/Multiplayer/Scripts/Master/vp_MPMaster.cs:709)
vp_MPMaster:RequestInitialSpawnInfo(PhotonPlayer, Int32, String, Int32, Int32, Int32, Int32, Int32, Int32) (at Assets/UFPS/Multiplayer/Scripts/Master/vp_MPMaster.cs:657)
System.Reflection.MethodBase:Invoke(Object, Object[])
NetworkingPeer:ExecuteRpc(Hashtable, Int32) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2999)
NetworkingPeer:OnEvent(EventData) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2592)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:153)

I'm not sure, but I think the problem starts with this function:
NetworkingPeer:ExecuteRpc

Any ideas why it doesn't work on iOS?

Thank you



Rejoin fail because player ttl isnt set on local server !

$
0
0
hi.
im using Photon-OnPremise-Server-SDK_v4-0-29-11263
and when i set player tll working on cloud servers but i get 0 ttl on local server..
how i fix that?

OnStatusChanged: TimeoutDisconnect

Got an error containing (not rejoining (JoinMode=1)) while trying to connect

$
0
0
Hello, i'm fairly new with photon and unity but could get photon to work with CustomAuth on my own webserver, got webhooks and all. What im doing right now server side is save the map on GameClose in a text file which save the State object. Once the client connect to the server with customauth, i attribute a uuid (from server) and the client then use that as UserId. Then the client try to load the game and last State he was saved in, but im getting this error:

Operation failed: OperationResponse 226: ReturnCode: -1 (Found inactive UserId '8742636b-f03b-40a9-9114-2cffd1b1ad0b', but not rejoining (JoinMode=1).). Parameters: {} Server: GameServer

Tryed to search google for more info and this forum about joinmode=1 but i get nothing. If anyone could light me up! :)

I'm trying to generate a random key and share it with other players using RPC.

$
0
0
This is the code that i'm currently using, i've tried may different logic but it's no use. Can someone please point out the problem? i think i'm using the RPC wrong.

public class GeneratingKey : Photon.MonoBehaviour {
int random;
string key = null;
string RandomKey = "";
void Start() {
if(PhotonNetwork.countOfPlayers == 1 && key == null)
{
for (int i = 0; i < 30; i++) {
random = Random.Range (1, 5);
RandomKey = RandomKey + random.ToString();
}
key = RandomKey;
}
if (key != null) {
ProceduralNumberGenerator.SetKey (key);
}
}
void Update(){
photonView.RPC ("SetKey", PhotonTargets.Others, key);
if (key != null)
Debug.Log (key);
ProceduralNumberGenerator.SetKey (key);
}
// Update is called once per frame
[PunRPC]
void SetKey (string tempString) {
if (key == null) {
key = tempString;
}
}
}

"OnConnectedToPhoton" and "OnConnectedToMaster" not getting called

$
0
0
Hi there,

I have a question that I need help with. I'd like to first know if first I have the correct approach and secondly if I do, what am I doing wrong? In my game, at the start the user first connects to a database to collect his account information. Once that happens, I do a few things:

PhotonNetwork.autoJoinLobby = false;
PhotonNetwork.automaticallySyncScene = true;
PhotonNetwork.offlineMode = true;
PhotonNetwork.CreateRoom("MainMenu");

While the user is in the Main Menu, he doesn't need to connect to Photon but I do need some of the Photon functionality like the use of RPCs. From the Main Menu, the user can click on "Find Match" where he gets paired up with a single opponent. Players have a personal rating and when they search for a match, they do 8 searches in a row looking for an opponent with the closest rating to theirs. So if they're at 1500 rating, they'll look for someone between 1450 and 1550, if nobody is available then 1400 and 1600 and so on for a total of 8 iterations. If nothing is found, they create their own room and place their own rating in the room options so other people looking for matches can get paired with them.

So when the player presses the "Find Match" button, I do the following:
PhotonNetwork.ConnectUsingSettings(); // with the game version inside ()
I immediately get a notification of "ConnectUsingSettings() disabled the offline mode. No longer offline."
I also get "Best region found in PlayerPrefs. Connecting to: eu"
And "OnConnectedToPhoton" and "OnConnectedToMaster" get called.
The "OnConnectedToMaster" callback checks if we're looking for a match and if we are, it does the custom search for an opponent described above and if it can't find anyone it creates a room.

So far, so good, everything seems to work perfectly. Now I also have a "Cancel Search" button. When pressed I do the following:

PhotonNetwork.Disconnect();
PhotonNetwork.offlineMode = true;
PhotonNetwork.LeaveRoom();
PhotonNetwork.CreateRoom("MainMenu");

If I press the "Cancel Search" button and then I press the "Find Match" button again, I only get as far as "Best region found in PlayerPrefs. Connecting to: eu". "OnConnectedToPhoton" and "OnConnectedToMaster" no longer get called. What am I doing wrong and is this a proper way of doing things?

Thank you!

How to determine animation state?

$
0
0
Hi, I'm making an FPS, so ideally, one character should have a few hitboxes. But Photon Server knows nothing about Animation/Animator at all, then how can it determine client's animation and hitboxes position?

NavMeshAgent [Syncing only agent Destination gives inconsistent results]

$
0
0
Hey guys,

Currently I am developing a game where I spawn units which are following way paths. I sync with RPC calls (which RPC is a coroutine) the agent destination (the next way point on the path). In addition, I have on the coroutine (the RPC call) check if there are enemy units in radius, if there are the next agent destination is the enemy unit. I have limited the FPS to 60 for both clients and there are discrepancies in unit locations (difference of a few metrical units, not that much but still there is unsync between clients).

How would you advise me to move my nav mesh agents so there is no difference between clients' units positions?

No Rooms on OnReceivedRoomListUpdate after disconnection

$
0
0
Hi there,

Been using PUN for quite a while now..
I have an issue with players disconnecting when switching scenes that Im investigating, however, in the meanwhile I just want to implement a re-connection when it happens.

I encounter a very odd thing.
I use Playfab with Photon, and Login users with photon token authentication...

I auto join lobby -> OnReceivedRoomListUpdate -> run through the list of rooms and join the room I want.
The problem starts when a disconnect occurs, this is the flow of events:

OnDisconnectedFromPhoton -> PhotonNetwork.Disconnect(); to make sure its disconnected -> PhotonNetwork.ConnectUsingSettings -> OnJoinedLobby -> OnReceivedRoomListUpdate -> looking at the room list ITS EMPTY!

I am sure rooms exist because I can relogin manually and everything works fine again, meaning, Im getting the room list and everything...

EDIT: found the issue, after disconnect I was calling ConnectUsingSettings from a different scene effectively connecting a different "version"....

Thanks ahead,
Michael.

Getting loading bar progress while loading using PhotonNetwork.LoadLevel

$
0
0
I was getting the progress before by creating an async task and getting the task.progress. This does not seem possible in PUN. I read online that I can use PhotonNetwork.LoadLevelAsync but the method is not showing and I cannot get it to work. Any thoughts? I just want to create a basic loading screen when changing scenes.

Physics gameplay - best practices?

$
0
0
Hi all!
New user to PUN here. I'm working on a simple physics-based game, you can think of it as a Rocket League clone, and I'm interested in using PUN for networking. However, even trying the included "JumpAndRun" demo, it seems like physics can be pretty unreliable. It's pretty easy to make the two robots go through each other just running against each other. I can understand why this is tricky - so what's the recommendation?

I suppose one option is to go full server (or in this case, master client) authoritative - how could I go about that with PUN? Should I just have (non-master) clients send RPCs to the master, and have the master own all objects (so they eventually just get sync'd to the clients)? Is there a better way? Is PUN not the best solution for me?

Thanks much
--Steve

Easy way to use PUN over LAN?

$
0
0
Hi all,
While PUN's cloud-hosted servers and lobbies are a great convenience, it would also be great if I could connect only over my LAN. I'm working on an internal prototype/demo, so I don't need to connect players across the internet, and so it would be nice to ignore latency for now and just do it all over LAN. Is this possible?

stuttering / freezing on Hololens

$
0
0
hello

I'm using PUN to send a moving object position using a TransformView from a PC to a Hololens.

On the Hololens, the object freezes every .5 to 1 second, for about .5 to 1 second. It appears to just stop receiving any updates, and then resumes moving briefly before freezing again. For the brief moment it does update, it moves smoothly using the interpolation on the TransformView.

things i've tried:
- I've had issues previously with network messages (using regular sockets, not PUN) blocking the main thread on the Hololens, so as a test I placed several rotating cubes in the scene. They move smoothly.

- On another PC, the network transforms move smoothly, no issues.

- I've tried a sendRate of 3, 10(default), and 30, results are the same. I also reduced the number of objects down to just 1 TransformView and the results are the same, freezing every .5 to 1 second.

- Tested using both Cloud and local photon server.

Anyone have any experience with the Hololens and PUN or any ideas what might be causing the freezing? Are there any known issues with the way PUN processes messages on the Hololens that would cause these lags/freezes?

thanks!

Sync rotation and animator states

$
0
0
Hello! I want to syncronize rotation and animator states (idle, run => trigger,bool, float) of main enity (RPG-character) . I was able to sync position with this:

Client side:

public void MoveOperation(float x, float y, float z)
{
PhotonPeer.OpCustom((byte)OperationCode.Move,
new Dictionary
{
{(byte) ParameterCode.PosX, x},
{(byte) ParameterCode.PosY, y},
{(byte) ParameterCode.PosZ, z},

}, false);
}


Server side:

case (byte)OperationCode.Move:
{
var moveRequest = new Move(Protocol, operationRequest);
if (!moveRequest.IsValid)
{
SendOperationResponse(moveRequest.GetResponse(ErrorCode.InvalidParameters), sendParameters);
return;
}

Position = new Vector3Net(moveRequest.X, moveRequest.Y, moveRequest.Z);

var eventData = new EventData((byte)EventCode.Move);
eventData.Parameters = new Dictionary {
{ (byte)ParameterCode.PosX, Position.X },
{ (byte)ParameterCode.PosY, Position.Y },
{ (byte)ParameterCode.PosZ, Position.Z },
{(byte)ParameterCode.CharacterName, CharacterName }
};

eventData.SendTo(World.Instance.Clients, sendParameters);

}
break;


Can you give me some advices , thx!

Stack Trace for RPC is too long. Hard to Debug.

$
0
0
Hi, apparently at some point I am trying to send a custom data type but get a "Exception: cannot serialize() customdata" which is fine, I would like to change it. But I am having difficult time trying to find it because the debug stack for rpcs is so long that it does not point me to the source(what I actually wrote).
Exception: cannot serialize(): SomeCustomData
ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, Boolean setType)
ExitGames.Client.Photon.Protocol16.SerializeObjectArray (ExitGames.Client.Photon.StreamBuffer dout, System.Object[] objects, Boolean setType)
ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, Boolean setType)
ExitGames.Client.Photon.Protocol16.SerializeHashTable (ExitGames.Client.Photon.StreamBuffer dout, ExitGames.Client.Photon.Hashtable serObject, Boolean setType)
ExitGames.Client.Photon.Protocol16.Serialize (ExitGames.Client.Photon.StreamBuffer dout, System.Object serObject, Boolean setType)
ExitGames.Client.Photon.Protocol16.SerializeParameterTable (ExitGames.Client.Photon.StreamBuffer stream, System.Collections.Generic.Dictionary`2 parameters)
ExitGames.Client.Photon.Protocol16.SerializeOperationRequest (ExitGames.Client.Photon.StreamBuffer stream, Byte operationCode, System.Collections.Generic.Dictionary`2 parameters, Boolean setType)
ExitGames.Client.Photon.EnetPeer.SerializeOperationToMessage (Byte opCode, System.Collections.Generic.Dictionary`2 parameters, EgMessageType messageType, Boolean encrypt)
ExitGames.Client.Photon.EnetPeer.EnqueueOperation (System.Collections.Generic.Dictionary`2 parameters, Byte opCode, Boolean sendReliable, Byte channelId, Boolean encrypt, EgMessageType messageType)
ExitGames.Client.Photon.PeerBase.EnqueueOperation (System.Collections.Generic.Dictionary`2 parameters, Byte opCode, Boolean sendReliable, Byte channelId, Boolean encrypted)
ExitGames.Client.Photon.PhotonPeer.OpCustom (Byte customOpCode, System.Collections.Generic.Dictionary`2 customOpParameters, Boolean sendReliable, Byte channelId, Boolean encrypt)
LoadBalancingPeer.OpRaiseEvent (Byte eventCode, System.Object customEventContent, Boolean sendReliable, .RaiseEventOptions raiseEventOptions) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/LoadbalancingPeer.cs:779)
NetworkingPeer.OpRaiseEvent (Byte eventCode, System.Object customEventContent, Boolean sendReliable, .RaiseEventOptions raiseEventOptions) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1018)
NetworkingPeer.RunViewUpdate () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:4221)
PhotonHandler.Update () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:165)
Are there any good ways to debug this?

Getting error 32748 (user does not exist in game) when using room.playerTTL setter

$
0
0
Hi,

The game I'm working on has been working fine up to now using the room options playerTTL set to a specific value at room creation. Players disconnecting during game were saved and game would be rejoined upon reconnecting as expected.

After upgrading to 1.89, in order to solve timing matchmaking issues, I tried changing the playerTTL to 0 at room creation, then setting it to the correct value once matchmaking was successful (using room.playerTTL = value). Now, when players disconnect, they get the error 32748 and are unable to rejoin the game.

The debugger is showing the correct playerTTL value for the room on both clients and the other player is still active in the room.

Any idea? Thanks.
Viewing all 8947 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>