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

Any callback from when a room closes? Or webhook?

$
0
0
I keep a database of matches -- it'd be nice to cleanup for games that never actually get started (in a matchmaking environment). Is it possible to trigger a webhook when the room closes somehow?

Or, more intuitively, if the master leaves and is the LAST one to leave, it'd be nice to have a special callback to perform cleanup tasks and what not.

OnLeftRoom()
OnLastPlayerLeftRoom()

EDIT: ...although client-side wouldn't work if the last player dirty-disconnected. So yeah, I suppose a server-side callback/webhook would be best.

Strange numbers of CCU in the dashboard

$
0
0
Hello!

I'm using the PUN for my game Armored Squad.

Due to low number of concurrent users I used to connect everyone to server "Europe". I had about 200-300 concurrent users depending on the day of the week.

But due to hight latency of some groups of players I decided to allow connection to servers "us" and "asia". I.e. all of the users I had earlier are now divided between these three servers. The problem is that dashboard is now showing me numbers that are way higher than the summ of players on all three servers.

I wouldn't worry, but sometimes these numbers exceed my plan's CCU limits and I even have this warning: https://www.dropbox.com/s/08ve7wzv2e3b6wx/CCU2.png?dl=0

But as you can see on the graphs, the real summ of CCU from all servers are not even close to shown numbers:
https://www.dropbox.com/s/clh2z9o00cffpaq/CCU.png?dl=0

I have the remote setting to allow or disallow the connection to "us" and "asia" servers. Whenever I enable or disable it the picture is always the same: when only "eu" server is used, I have "real" amount of CCU. When I allow "us" and "asia" I get something about "summ of all CCU multiplied by 2.5".

Is this a bug? Or is the number of CCU are being calculated other then "summ of all users on all servers at the time"?

Thank you!

offlineMode internal state bug

$
0
0
(Please note, in the following scenario, we never connect to the server. )

When we switch offlineMode to true, followed later by offlineMode to false, and then again offlineMode to true, an error occurs:

Can't start OFFLINE mode while connected!
UnityEngine.Debug:LogError(Object)
PhotonNetwork:set_offlineMode(Boolean) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:488)
OnlineSessionController:StartOfflineMode() (at Assets/Scripts/Behaviours/Controllers/OnlineSessionController.cs:149)
GameSessionController:InitGameSession() (at Assets/Scripts/Behaviours/Controllers/GameSessionController.cs:97)
ActivityController:StartSpecialGameMode() (at Assets/Scripts/Behaviours/Controllers/ActivityController.cs:163)
MainMenuUiBehaviour:OnMapSelect(String) (at Assets/Scripts/Behaviours/UI/MainMenuUiBehaviour.cs:284)
MapSelectUiBehaviour:OnButtonClick(Int32) (at Assets/Scripts/Behaviours/UI/MapSelectUiBehaviour.cs:45)
UnityEngine.EventSystems.EventSystem:Update()


The reason for this is pretty simple, but a small fix will be needed within PUN.

When setting offlineMode to true, the PhotonNetwork.connected property becomes "true".

Next, when setting offlineMode to false, the PhotonNetwork.connected property remains "true". I don't think this should be the case.

Finally, when attempting to set offlineMode to true again, the error occurs because Photon thinks that the game is currently connected to a server.

I managed to partially work around the problem by doing this:

PhotonNetwork.networkingPeer.State = ClientState.Disconnected;

However, that in itself causes an error (that I'm just ignoring), because Photon is not actually truly connected.
It does, however, reset PhotonNetwork.connected to false, which is what is needed prior to using offlineMode again.

Side note: if you were wondering about the slightly strange workflow of using offlineMode in this way, I'm happy to describe. Just didn't want to dump too much info here straight away.

Thanks for any help!

TimeoutDisconnect while connecting to ns.exitgames.com:5058

$
0
0
Greetings Photon!

I'm experiencing problems connecting to Photon. I receive the following message:
"TimeoutDisconnect while connecting to: ns.exitgames.com:5058. Check if the server is available."

This is occurring in previously written, unmodified code. I tested firewall by connecting to a total of 3 different networks, no difference. I tested previous revisions of known code releases, no difference. Then, I pulled down the Photon SDK, no difference.

This seems like a case of server downtime, but the server status site reports no outage or issues....

Help!

Rob

Matchmaking System

$
0
0
Hello,
I am working on my new game. I am using PUN to make my game better. I want to make a matchmaking system like CS:GO, Rainbow Six Siege. I checked ur tutorials but i can't find what i was looking for.

I made a lobby system. It works like a room. You are entering to room and inviting friends. Everything OK. But i want to make a system like this;

Started matchmaking with lobby (2-5 players in room) then find how many players you need. When it finds 10 players, start the game.

My real question is i am starting matchmaking from a lobby, then i am making the lobby as joinable i mean visible = true. When some one directly looks for game with RandomJoin, he joins the room. But only who looks for game as solo can join the lobbies. I want to mix the game with other lobbies and start game with 10 players.

I can't find any enough tutorial for this. Please help me,
Thanks!

PUN Custom Types - W V Q P?

$
0
0
So I was trying to figure out what custom type codes/ids are used for PUN, and from what I can gather the only 4 being used (from searching the PUN source code) are casts from capital ASCII W, V, Q, and P....

Mostly I'm just curious, but does anyone have any idea how or why this ended up being the case? I don't think I've ever seen network ID numbers assigned using ASCII codes before, and W V Q and P seem completely random... how did this happen?

Also does anyone know if these are the only 4 ids I shouldn't use? On a related note, are the only event codes that should not be used the ones that are > 200? I can't find either of these (somewhat important) facts in the documentation anywhere, though perhaps I'm looking in the wrong place....

Wrong synchronisation when load a new scene

$
0
0
Hi,

So here's my problem : I have a game with a scene where all players join before start. When the master decides, he loads a chosen scene, nothing complicated.

I used PhotonNetwork.automaticallySyncScene and PhotonNetwork.LoadLevel(), but when the scene loads the master see player B (I tried with only two players) connected, moving, etc., absolutely normal, but player B is in a different place ; the scene where he is, is the good scene but he is alone on it, as if he were on two scenes at the same time (with the other player and not with him).

Can anyone help me ?
Thanks

PhotonView ID duplicate found

$
0
0
I have a gameObject in my menu scene and there is a script on it which it is for RPC methods and I need to not destroy it. Also because of duplication I try to destroy it whenever I leave the room and get back to the menu and create it again. but there is a error for PhotonView ID duplication and I don't know how can I solve it. I've tried to search but didn't find anything useful.

Is it bad to subscribe many interest groups?

$
0
0
Is it bad to subscribe many interest groups or does a bigger byte array (120 subscribed groups) increases the traffic? (I don't ask if that traffic is caused by other players sending things in these groups of course..) And does every player know what other players subscribed? Because each player updates his interest groups in my game at about 30 times per second. I appreciate any help

RPC Master Client Help

$
0
0
Hey guys, I'm working on a project prototype involving physics based characters and interactions.
The challenge I find myself fighting with is to network the ability for more than one player to simultaneously 'grab' and 'pull' physics enabled objects and these changes and forces be applied across the network.

I've tried authority switching for any client interacting with an object, which works for a single interaction, however I'm struggling to figure out a way to do this for multiple clients using RPCs + the masterclient in a somewhat authorative manner.

If anyone could kindly point me in the direction of a stripped down tutorial or example of code whereby a client sends positional information to a masterclient via rpc which then updates that object on all clients. As I cannot get that basic concept to work, let alone send force information from clients interacting with objects via joints across the network.

If this is out side the scope of Photon, I would also appreciate a blunt and honest answer as I am very early in the network development stage and can quite comfortably switch to other networking solutions such as UNET.
As I know Photon is not built with authorative systems in mind, though I only need a semi authorative-esque setup in order to sync positions of rigidbodies which can be pushed/pulled by multiple clients at the same time.

TL:DR Multiple clients moving the same object at the same time via a masterClient RPC, authorative approach. Possible? If so, general direction on how to proceed would help me out a lot.

ExceptionOnConnect for 10% of users on Android

$
0
0
We are getting ExceptionOnConnect for about 10% of out users in the Philippines during Connect on Android.
We are using UDP with the default port.
We have not been able to reproduce it locally, but it may be that our internet connections are too good or that most of our testers are using WIFI and not a Cell connection.
What does this mean?
Also is there anything that we can do to reduce it?

Thanks!

OnDisconnectedFromPhoton not called

$
0
0
Hi, I am having a strange issue where OnDisconnectedFromPhoton is not called. I just disable the WIFI. After around 1 min it throws socket exception but nothing is called. Sorry it is not throwed but printed

Photon RPC doesn't broadcast properly.

$
0
0
I'm trying to sync player's animation through network by using Photon RPC, but it doesn't work.

Player can have 2 weapons and using only one of them once. So when player switch the weapon, I'll broadcast that which weapon have to switch like this:
public void SetWeapon(Weapon weapon) {
	photonView.RPC("RPCSetWeapon", PhotonTargets.Others, weapon);
}

[PunRPC]
void RPCSetWeapon(Weapon weapon) {
	// Switch Animation
	characterAnimator.SetBool(weapon.ToString(), true);
}
It's FPS game so I don't have to set animator in local player, so used PhotonTargets.Others.

Also sync firing and reloading animations has same logic:
public void PlayFireAnimation() {
	photonView.RPC("RPCPlayFireAnimation", PhotonTargets.Others);
}

[PunRPC]
void RPCPlayFireAnimation() {
	characterAnimator.SetTrigger("Firing");
}

public void PlayReloadAnimation() {
	photonView.RPC("RPCPlayReloadAnimation", PhotonTargets.Others);
}

[PunRPC]
void RPCPlayReloadAnimation() {
	characterAnimator.SetTrigger("Reloading");
}
But when I run this game, nothing happens and only I got is these warning messages:

> animator is not playing an animatorcontroller

So I checked which object got RPC like this:
void RPCSetWeapon(Weapon weapon) {
	if(photonView.isMine) {
		print("IS LOCAL PLAYER, SKIP IT.");
		return;
	}
	else {
		print("IS NOT LOCAL PLAYER.");
	}
But it always printing "IS NOT LOCAL PLAYER.". Seriously, I don't know why this happens, am I misunderstanding use RPC or something?

Please let me know how do I fix this, thanks.

[SOLVED] Received RPC...PhotonView does not exist!

$
0
0
I instantiate a prefab over the network and get it to callback via an RPC after it's spawned. I get it to wait 5 secs before calling back just to be sure. Even though I can see the the local gameobject with ViewID 1000 in the scene I still get this error "Received RPC "rpcname" for viewID 1000 but this PhotonView does not exist!".

How can it not exist when I can see it in the scene :?

Like similar issues I'm only having this on second / third room I try to set up. First room after load always works flawlessly.

NCommand.CreateAck excaption

$
0
0
Occasionally, our players would report an network issue and the following call stack would appear in the output_log.txt.

System.IndexOutOfRangeException: Array index is out of range.
at ExitGames.Client.Photon.NCommand.CreateAck (System.Byte[] buffer, Int32 offset, ExitGames.Client.Photon.NCommand commandToAck, Int32 sentTime) [0x00000] in :0
at ExitGames.Client.Photon.EnetPeer.QueueOutgoingAcknowledgement (ExitGames.Client.Photon.NCommand readCommand, Int32 sendTime) [0x00000] in :0
at ExitGames.Client.Photon.EnetPeer.ReceiveIncomingCommands (System.Byte[] inBuff, Int32 dataLength) [0x00000] in :0
at ExitGames.Client.Photon.NCommand.CreateAck (System.Byte[] buffer, Int32 offset, ExitGames.Client.Photon.NCommand commandToAck, Int32 sentTime) [0x00000] in :0
at ExitGames.Client.Photon.EnetPeer.QueueOutgoingAcknowledgement (ExitGames.Client.Photon.NCommand readCommand, Int32 sendTime) [0x00000] in :0
at ExitGames.Client.Photon.EnetPeer.ReceiveIncomingCommands (System.Byte[] inBuff, Int32 dataLength) [0x00000] in :0
Exception while reading commands from incoming data: System.IndexOutOfRangeException: Array index is out of range.
at ExitGames.Client.Photon.NCommand.CreateAck (System.Byte[] buffer, Int32 offset, ExitGames.Client.Photon.NCommand commandToAck, Int32 sentTime) [0x00000] in :0
at ExitGames.Client.Photon.EnetPeer.QueueOutgoingAcknowledgement (ExitGames.Client.Photon.NCommand readCommand, Int32 sendTime) [0x00000] in :0
at ExitGames.Client.Photon.EnetPeer.ReceiveIncomingCommands (System.Byte[] inBuff, Int32 dataLength) [0x00000] in :0

Leaving and Rejoining a room problem

$
0
0
I also posted this on the Unity forums but i need an answer quick.

Just to let you know, I have a network manager with a photon view on it .

I'll explain what is happening visually:
Two people. 1 person on the unity editor, 1 person on a phone.
- Unity editor person hosts a match
- phone person joins and everything works fine, he leaves and then rejoins
- phone person on his side doesn't spawn
- unity editor person sees someone else spawn in the photon ID it says its not controlled locally but the name displayed came from the playerprefs of the unity editor person not the phone person, which means unity editor instantiated it.
-If phone person restarted the whole game and joins again it works fine. Spawns in normally like the very first instance of joining.

what is happening? Is having a photon view on the network manager and the player a problem?

This is what i do when i exit the room -
public void ExitToMenu(){
		PhotonNetwork.LeaveRoom();
		GameObject networkManager = GameObject.Find("NetworkManager");
		Destroy(networkManager);
	}

	void OnLeftRoom(){
		PhotonNetwork.LoadLevel("Menu");
	}
I Destroy the network manager so that there are no duplicates when i re enter the other scene which already has one. I have dontdestroyonLoad on it so i have to get rid of it first.

I can post my network manger script if you want to look at the code.

thanks

PUN Error In Latest Unity Beta (2017.1.0b3) - Hashtable ambiguous reference

$
0
0
PUN has been working fine for me until I upgraded to the latest beta version of Unity.

Now I get lots of errors similar to the following:
Assets/Photon Unity Networking/Plugins/PhotonNetwork/LoadbalancingPeer.cs(431,63): error CS0104: `Hashtable' is an ambiguous reference between `System.Collections.Hashtable' and `ExitGames.Client.Photon.Hashtable'

I know I can workaround this by modifying the Photon scripts to specify either to use System.Collections.Hashtable and ExitGames.Client.Photon.Hashtable, but just wanted to pass this information along regarding this problem with the latest unity beta.

Soneone can help my with RPC

$
0
0
Hi, I posted this a couple of hours ago, but it seems that it was not published: /.

I'm trying use RPC to send a value at a method. When something with tag of Player walks in Trigger2D, this trigger ontriggerenter2d send a value(CambiaPiso.cs) at Method in other script(MapManager.cs), When the value is sended then a switch is execute to set the actives floor in the scene. I made this in code but when a player changes floor in the map, they all change with him.

Here is a video of my test scene:
https://youtube.com/watch?v=K-uZyPJMjl4

the last time that i tried published this I put here the links to IMG because when I tried put images in the button to up imgs I could not find the "OK". But in the video you can see alls scripts and inspector and some pieces of my lasts tries to made it :)(the comments)

Pun 2 - Early Access [May 2018]

$
0
0
Hello Everyone,

We are updating our early access package of the upcoming PUN version (will be referred as PUN 2).
This features major internal changes, API changes, performance and optimization improvements but keeps the same design pattern you know and expect from Photon Unity Networking (PhotonViews, RPC, Cloud, etc).

Download it here:

https://www.dropbox.com/s/swlyi2gfzycy7us/PUN-v2ea2-EarlyAccess-May18.unitypackage?dl=1

Few things to know:

- This version is NOT READY FOR PRODUCTION, use it at your own risk.
- Unity 5.3.7 is the minimal version

Known Issues:

- The Demo Hub is not loading the "Realtime Demo". It does run when loaded directly.

New Features:

- New, cleaner folder structure. A "Photon" folder wraps up everything and there is a folder per Photon product or API.
- New Demos.
- Improved Namespace to avoid clash with other assets.
- LoadBalancing (LB) api has been revamped for a better separation between PUN and LB
- The PUN API changed in numerous place
- Performance and optimization is improved with less caching of data and better memory usage to avoid unnecessary allocations where possible.
- Explicit registration for PUN callbacks is now necessary, although automated when using 'PunBehaviour' ( watch out when overriding OnEnable() and OnDisable() you must call the base or registration will not occur
- Demos now using the Unity UI system instead of the deprecated one which had a very design pattern for coding.
Future Features:
- Documentation overall pass to cover all changes and new features
- Completed Demos
- Network Prefab will no longer be required as a Resource but will need explicit registration
- More optimizations and performances improvements

We welcome your feedback on this :)
Simply post in this thread.

Facebook Photon Authentication

$
0
0
After Facebook Login, one player Join Lobby, When second player join lobby "OnJoinedLobby" event call on second player side and player counts are now 2 on second player side. But first player count is 1. How will first player know other player join the lobby. Is there any event which call on first player side to know other player join the lobby. Is there any other way to start the game between players.

I completed my multiplayer with PUN. But when connected through Facebook i am freeze at this issue. Need help on this. If anyone integrate Facebook using PUN please help me.

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>