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

Overhead of a huge string as room property?

$
0
0
So I am using a custom room property to store a level description string. (This is for steam workshop levels.) Potentially, the description on Steam can be 8K characters. My question is, would an 8K string property cause any significant overhead? Also, I'm guessing when a custom room property is changed, ONLY THAT property is transmitted? If that's not the case, I suppose I could send description through an RPC. Thanks for any ideas.

Photon server is Not connect

$
0
0
Hello, The photon server can't connect give me this error "Connect() to 'ns.exitgames.com' () failed: System.Net.Sockets.SocketException: No such host is known." I'm using the best region in settings is this a general problem right now in photon? Thank you

Method to pause outgoing messages? Or method to tell client to set isMessageQueueRunning to true?

$
0
0
Hello, I'm having an issue with players joining a game and while they're awaiting the MasterClient to initialize the scene and then send the the fully loaded game state, the MasterClient sends some intermediary RPCs, which the joining client doesn't exactly know how to handle, because they haven't received the full game state yet. Specifically, in a number of my intialization methods, a lot of network objects send messages over the network. I realize I could check in each of those RPC calls if it's coming from the MasterClient and then check if the MasterClient has 'finishedLoadingLevel', but I'm I'm realizing this late and that's a lot of methods I'm going to have to find and I would prefer to not have that check in every function that sends a network message. I realize I can toggle off PhotonNetwork.isMessageQueueRunning for the joining player, but then I don't know how to tell that player to turn the queue back once the MasterClient is done setting up the level. If there were something that I could toggle on the MasterClient like PhotonNetwork.isSendingMesssages, then I could toggle that off, initialize the level, toggle it on, then send the game state out to any other players in the room waiting for the game state. Thanks for reading :)

PUN running within an enterprise network protected by a firewall

$
0
0
Hello, We plan to use PUN and self-hosted servers for our multi-user application. This application is intended to be used by companies which usually have an internal network protected by a proxy server. Our self-hosted servers would be hosted on AWS. Now I've read in this forum that Photon does not support connection through a proxy and that UDP does not use any proxy. These messages are now at least 2 years old. I just wanted to check if this would still be an issue for us (in 2019). If so, what would be the best way to deal with our clients'' proxy? Is the only solution to ask them to allow all traffic between our app (from within their network) and our servers on AWS? Or is there a new way to configure proxy settings in PUN? Thanks

New players spawning twice on existing players

$
0
0
I have this problem when new players join the room, they get instantiated twice on all the existing players. I read the code from the PunBasics demo and tried to replicate how it works but the problem still occurs no matter what I do. I checked the logs on the new players and see that NetworkManager Start function gets called as many times as there are players and I believe this is normal Unity behavior but it should only spawn one player instance for each new player as there is a check to see if the player instance has been created already but it doesnt seem to work that way. The NetworkManager is a scene object in every scene and it doesnt have a PhotonView component. The playerPrefab gets instantiated by the NetworkManager in Start() function and that prefab has a PhotonView component. After the playerPrefab gets instantiated, it instantiates another prefab on the owner's client that is a localPlayerPrefab which then receives input from the player and plays all animations etc. Here is my code for the NetworkManager: https://pastebin.com/RzrBM8eM and here is code for the playerPrefab object that gets instantiated by the NetworkManager: https://pastebin.com/WWUdVMav I had pretty much the same setup when I was using the Unity network API and worked quite well but I cant get it to work with Photon. It might be a simple thing that I missed and just cant see.

How to disable RPC shortcuts?

$
0
0
In the documentation about Shortcuts for RPC names it says on https://doc.photonengine.com/en-us/pun/v2/gameplay/rpcsandraiseevent "Due to this shortcut, different builds of games maybe don't use the same IDs for RPCs. If this is a problem, you can disable the shortcut." But how do I do that? Is it enough to just clear the list of RPCs in the PhotonServerSettings?

Force a timeout disconnection

$
0
0
Is there a way to force a timeout disconnection or any error disconnection? Or, is there any other way to test a timeout disconnection?

How to use Photon to sync Tilemaps between players?

$
0
0
I have had some issues for quite a while now, trying to figure out how to synchronize a tilemap between multiple players in a Photon network, since there is no way to get the individual tiles as objects or some sort of list. Tilemaps seems very restricted and the amount of documentation is very restricted, especially with Photon. Does anyone have any experience with that matter or at least with Photon at all? I'm kind of a newbie with it, so forgive me, if I don't immediately get it.

how to close all rooms at a certain time

$
0
0
I'd like to close all game rooms (even though there are players in) at a certain time. For example, every monday 4:00am. It seems rooms have more garbages as time goes by. Because of program or network errors. So I thought I need to close all rooms to start it all over once in a while. I'm afraid if this is bad idea. How can I close all rooms at the same time? Any Photon commands for this? Or can I do this in the Photon homepage, not in the source codes? I'm using PUN and Unity3D. Thanks for any help.

Random Room Failing To Join

$
0
0
I have an issue where my code says to join a random room and if there isn't one, create your own. My issue is that I launch one client and it creates the room. I then launch another instance of the client and instead of joining the random room I just made, it instead creates it's own. The only work around I've found is to launch one client to make the room with a set name (such as "Room") and then edit the code on the other client to join "Room". But that's obviously not a real solution. Here's the code I got for this problem:
void OnJoinedLobby() {
Debug.Log ("OnJoinedLobby");
PhotonNetwork.JoinRandomRoom();
}

void OnPhotonRandomJoinFailed() {
Debug.Log ("OnPhotonRandomJoinFailed");
PhotonNetwork.CreateRoom( null );
}

void OnJoinedRoom() {
Debug.Log ("OnJoinedRoom");

SpawnMyPlayer();
}

Thanks

Two device can't listen to other

$
0
0
Hello, I have two device both already joined to room but when use "PhotonNetwork.countOfPlayers" return 1 although there are two device connected and when use "PunRPC -- Function" nothing happen. Thanks

Photon Animator View - Synchronization Parameters Changing

$
0
0
Hey all, I have this weird thing going on. Whenever I build the game, the Synchronization Parameters were chosen randomly switch to disabled. I have the animator view last in the component hierarchy, and in the photon view list. Not changing anything through code. This is really weird and it's driving me nuts. And help would be appreciated. Unity version - 2019.2.0f

Actor with number not found

$
0
0
Hi I am trying to set custom properties of a player but I get an error Actor with number not found. I tried to check if inactive false but did not work. I am using old sdk not the new one.

Question around the OnPhotonSerializeView

$
0
0
Hey, I know I post here a fair bit I just want to become as knowledgeable as I can with PUN. o:) So I had a misunderstanding with how the OnPhotonSerializeView worked. I thought that isWriting was called when that instance is making a change, and the else was when someone else had written a change. After putting some debugs in I found that the isWriting gets called around 2 per second by the owner. So when player1 would take damage from player2 by modifying the value directly, a few moments later it would go back to the original value. private void PhotonQuickSync< T >(PhotonStream stream, ref T syncItem) { if (stream.IsWriting) stream.SendNext(syncItem); else syncItem = (T)stream.ReceiveNext(); } A simple RPC gets the job done. But I'm wondering if the OnPhotonSerializeView can still be used? I quite like it, especially if I can create the above function and call a value to be synced in one line. Rather than creating the RPC function, then calling the RPC function. :) Cheers.

PhotonNetwork.KeepAliveInBackground having no affect

$
0
0
Hi! PhotonNetwork.KeepAliveInBackground seems to be failing completly in our windows project, using PUN v2.13, Unity version 2018.2.21f1, .Net 4.0, Mono scripting backend.). No matter what I set it to (or if I leave it to default), our connection times out after the server side 10 seconds is up, so I assume the keep alive thread is not working at all. We noticed this happens when using a plugin (StandaloneFileBrowser) that opens a native windows file browser (which I think just essentially pauses the unity application while you browse for your file), but I can also make it happen at any time simply by pausing the Unity Editor for 10 seconds. The error we receive, as you might expect, is... SocketTcpAsync.EndReceive SocketException. State: Connected. Server: '92.38.154.5' ErrorCode: 10054 SocketErrorCode: ConnectionReset Message: An existing connection was forcibly closed by the remote host. System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host. at System.Net.Sockets.Socket.EndReceive (System.IAsyncResult asyncResult) [0x00012] in :0 at ExitGames.Client.Photon.SocketTcpAsync.ReceiveAsync (System.IAsyncResult ar) [0x00023] in :0 Is this a current bug? Cheers! Alex.

Please Help : Ev Destroy Failed. Could not find PhotonView with instantiationId 2100. Sent by actorN

$
0
0
Im currently facing an issue in my project, Destroying enemys and bullets! I tough this would be so simple, but im stuck with this error for weeks! So my game consistis in a portal defense, where enemys are spawned as SceneObjects and go towards the portal, the problem is trying to destroy them as clients creates a lot of errors and lot of lag for the client, while the MasterClient faces no lag, but usualy sees frozen bullets and enemys! Here's a demo of what happens! The PC is master client and the Android is an client! Youtube Video Link! A bunch of errors like this pop up "Ev Destroy Failed. Could not find PhotonView with instantiationId 2100. Sent by actorNr: 2" and more than one with the same instantiation ID This is what the android side sees, a bunch of enemys and bullets "frozen" This is the code used on the bullets: void DesativarDestruir() { if (GetComponent().IsMine) PhotonNetwork.Destroy(gameObject); else Destroy(this.gameObject); } private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("cima") || collision.gameObject.CompareTag("baixo") || collision.gameObject.CompareTag("direita") || collision.gameObject.CompareTag("esquerda")) SpawnarWallhit(); if (collision.gameObject.CompareTag("boss") || collision.gameObject.CompareTag("miniboss")) SpawnarWallhit(); if (collision.gameObject.CompareTag("virusPortal")) { if (isOnline) { if (!isFireBall) { DesativarDestruir(); } } } } void SpawnarWallhit() { if (!isFireBall) { Instantiate(WallHit, transform.position, Quaternion.Euler(0.0f, 0.0f, Random.Range(0.0f, 360.0f))); if (isOnline) { if (!isFireBall) DesativarDestruir(); } else { Destroy(this.gameObject); } } } And this is on the Enemys: void DesativarDestruir() { if (GetComponent().IsMine) PhotonNetwork.Destroy(gameObject); else Destroy(this.gameObject); } private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Bullet")) { GameObject p = Instantiate(particulaTiro, transform.position, Quaternion.identity); Destroy(p, 0.8f); TocarSomMorte(); if (isOnline) { ExitGames.Client.Photon.Hashtable PropriedadesPlayer = new ExitGames.Client.Photon.Hashtable(); Player player = collision.gameObject.GetComponent().Owner; if (player != null) { PropriedadesPlayer.Add("kills", ((int)player.CustomProperties["kills"] + 1)); player.SetCustomProperties(PropriedadesPlayer); } DesativarDestruir(); } else { HordasStats.qtdKills++; Destroy(collision.gameObject); Destroy(this.gameObject); } } }

"'AudioSpeakerMode.Raw' is obsolete"

$
0
0
Hi! I'm using the latest stable Unity version (2019.2.0f1) and the latest PUN 2 + Voice 2 (my build target is Android). All works fine, except I'm getting this single error:
Assets\Photon\PhotonVoice\Code\WebRtcAudioDsp.cs(43,14): error CS0619: 'AudioSpeakerMode.Raw' is obsolete: 'Raw speaker mode is not supported. Do not use.'
Out-commenting the line in question, {AudioSpeakerMode.Raw, 0}, fixes the issue. I did wonder though what this was. Thanks!

Determine If Message Was Reliable

$
0
0
My Unity app involves a lot of networked rigidbodies in a scene, most of which are at rest. As a result, I think that the ideal Observe Option is unreliable on change. This way, if an object is at rest, it won't be utilizing bandwidth. One issue that I have been having is that the client simulation might not realize that a PhotonView is at rest. It receives the reliable message, but due to non-determinism in the physics engine, it continues to move slightly. Is it possible for the client to know if the message received was reliable or unreliable? This way, the client code could be written so as to "lock" the rigidbody until a new message is received.

VR Avatar not syncing

$
0
0
Hi all, I'm building a multiplayer demo for the oculus Quest. I have follow the VR avatar guide provided by Photon and i can see the avatars joining the session, so far so good. My problem is that they are not synced, i can t see the movements of the other players. I'm testing using a Rift on unity editor and an oculus Quest to join. I´ve noticed that the Registered PhotonView its not exactly the same in the editor and the device. I got: Unity editor: - Registered PhotonView : 1001 - Registered PhotonView : 2001 Device (debugging with ADB) - Registered PhotonView : 3001 - Registered PhotonView : 1001 I'm i doing something wrong? First time using Photon.

Self hosted server with PUN 2

$
0
0
Hello, I'm using PUN 2 for my game. I want to host it on my server using self hosted server. What will be the Photon Server Settings for it? I'm using PUN 2 so please guide me as per that. Thanks in advance.
Viewing all 8947 articles
Browse latest View live


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