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

OnPhotonPlayerConnected not called back on non master clients?

$
0
0
Hi!

I have a strange behavior with OnPhotonPlayerConnected event.
The the client who created the room successfully receive OnPhotonPlayerConnected event, but the others who joined the room does not. The log's last few entries are:
Registered PhotonView ...
queueIncomingCommand() ...
OperationResponse 252: ReturnCode: 0.

On the master client the log's last few entries are:
Registered PhotonView ...
OnEvent: Event 253.

Where should I start to investigate the problem?
Thanks!

Array out of index exception?? Photon Animator View

$
0
0
So, i have a player prefab, which has photon view on the root, and the animator on a child of it, so i added and modified, photon animator view, to dont requiere photon view, and changed the photon animator view to do GetComponentInParent , instead of GetComponent as default, but that's giving me array out of index exception, what's wrong?, I can give more details if needed

Photon Server self hosted error

$
0
0
Hello,

I wanted to try photon WebGL client with self hosted photon server. So in the Unity editor i put the server IP address, but when application runs (WebGL) in the editor, it gives error

UriFormatException: URI scheme must start with a letter and must consist of one of alphabet, digits, '+', '-' or '.' character.

using self hosted photon server ver sion Photon-OnPremise-Server-SDK_v4-0-29-11263

but this error is in the Unity editor

Anybody knows why or how to fix that?

Thanks

how to change server side timeout delay?

$
0
0
when one client's wifi go to offline, server call OnDisconnect callback after 10 seconds

how to change this value?

Connect to self-hosted master server and join room (WebSocketSecure).

$
0
0
Hi! I try to connect with WebSocketSecure protocol to my self-hosted server. (there are no problems with Photon Cloud)

I connect to self-hosted server using port 9090 (Master) and it connects to lobby without problems. But when I try to create room after this, I get exception:


This is place in code which calls this exception (NetworkingPeer.GameEnteredOnGameServer(OperationResponse operationResponse)):

This is because OperationResponse.ReturnCode == 0. (but I don't know why and what to do)

When I use port 9091 (Game) I connect and join/create room without problems. It would be ok, but using port 9091 I can't get PhotonNetwork.GetRoomsList(), can't use JoinRandomRoom() and others...

When I use Tcp protocol and connect using port 4530 (Master) it connects and joins lobby and creates room without problems. (that's what I want from wss connection)

So what do I have to change on server/client to solve this problem?

This is my SocketWebTcp.cs:


This is my PhotonServer.config WebSocketListeners:
<WebSocketListeners>
<WebSocketListener
IPAddress="0.0.0.0"
Port="9090"
DisableNagle="true"
InactivityTimeout="10000"
OverrideApplication="Master"
PolicyFile="Policy\assets\socket-policy.xml"
Secure = "true"
CertificateName = "WIN-GR1JM6PETN8"
UseMachineStore = "true">
</WebSocketListener>

<WebSocketListener
IPAddress="0.0.0.0"
Port="9091"
DisableNagle="true"
InactivityTimeout="10000"
OverrideApplication="Game"
PolicyFile="Policy\assets\socket-policy.xml"
Secure = "true"
CertificateName = "WIN-GR1JM6PETN8"
UseMachineStore = "true">
</WebSocketListener>
</WebSocketListeners>
This is how I connect to server;
PhotonNetwork.ConnectUsingSettings(Version + "." + SceneManagerHelper.ActiveSceneBuildIndex);

What is the rightest way to set server/client for right wss connection? To I would connect to 9090 and get RoomList() and create/join room (in Tcp it works)
I want to repeat: it connects to lobby, but can't create/join room bcs of exception above.

Thanks a lot.

(I swear, if I solve all my problems with self-hosted server and WebSockets and PUN, I will necessarily write detailed guid of this. :#)

PhotonNetwork.time scale while in offline

$
0
0
In documentation, I found that when in offline mode PhotonNetwork.time returns Time.time.
But when I set Time.timeScale to zero (e.g. pause) Time.time stops, but PhotonNetwork.time still flows.
So clearly PhotonNetwork.time does not return Time.time. Or am I missing something ?

Get Connection State of the ITEM in MMO

$
0
0
Hello, I'm working with the current Unity3DGrid example of the MMO application.

I've noticed that if the player disconnects from the server and is not in the area of interest of other players, they have no way of knowing that the disconnected player is really disconnected.

None Disconnect event is triggered for other players unless they are in the area of interest. This is relatively good. The problem is in the UPDATE process of items referring to players who are no longer connected. In my Unity Editor I can see that the player's Prefab object continues in the scene even though it is no longer connected. In the Script of the player it only knows that it is not active for updates and thus it disables the rendering of the mesh, but the object still exists and its UPDATE continues to consume process.

I'm trying to implement some verifier so I can check if a certain player is actually connected, otherwise I will effect the destruction of his components on the scene.

Currently in my script of players in Unity I have how to know if the player should be processed, from the following script:
if (this.item.IsUpToDate == false)
{

ShowActor(false); //Desactive mesh render
return;
}
Maybe it would be interesting if I had so mething like this to know that this object is no longer connected:
if(this.item.isConnected==false)
{
DestroyMe();
return;
}
And even if the OnDisconnected event or OneWorld Exit triggered for all online players regardless of interestArea .

I'm working with the Photon.MmoDemo.Client.Unity3D source , but I'm not having success.

Issues With Photon and WebGL Unity

$
0
0
Hi,
I'm new here so sorry if this is the wrong place for this.

I have a built a costume photon server to run an MMO style game. The game is built in Unity. The server and project work fine when you play it in the unity editor, but when we compile it to WebGL and attempt to run it we get this error:


blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:1 Uncaught Assertion failed: 0 && "The target platform does not support Sockets", at: C:\Program Files\Unity 5.4.0b20\Editor\Data\il2cpp\libil2cpp\os\Generic\SocketImpl.cpp,50,SocketImpl at Error
at jsStackTrace (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:1:22874)
at stackTrace (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:1:23057)
at ___assert_fail (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:1:261781)
at YKn (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:22:577281)
at JIn (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:22:552497)
at XAn (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:22:417981)
at wuh (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:14:1038026)
at XAh (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:11:33162)
at Array.WAh (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:11:32946)
at Array._kk (blob:http%3A//localhost/6f801906-3dfb-4efd-a47b-7f09948339c8:9:818273)

What does this mean? Can it be fixed?
I am fairly advanced with programming and networking so please feel free to be technical.
Thanks for any help.

Issue building local game menu with PUN-Optimized Player Object

$
0
0
Hi,

my game is running fine in Multiplayer using PUN. Now I wanted to implement a local Main Menu where the player can select the gamemode to play, search for other players, etc.

I'm struggeling a bit because I need to spawn a very complicated player object (it's a VR game) which is being build during runtime facilitating Photon.Instantiate and RPC calls. When I created this, I was expecting I could always just switch to offline mode and execute RPC calls whatsover.

However I learned that I cannot just simply Instantiate this player object in an non-PUN scenario but require at least a joined room.

However, when switching or leaving rooms (which I need to do to e.g. switch gamemodes), the player gets destroyed.

I really don't wanna go the route to check if I'm in a room for every call that is done when the player object is setup and call a local function / local instantiation instead an RPC call / Photon.Instantiate.

is there a cleaner way?

No rooms founded on android build

$
0
0
Hello there! Updated PUN to latest version today (1.80). I have my game combined "PC + Android" builds (imagine PC car racing game with dashboard displayed on mobile device). And currently my android version says "0 rooms founded". If I run it in editor (and +1 separate window) - everything is fine, 1 room founded. Is it a bug ? also, in previous PUN version "room.name" started to work in weird way - gave me something like "ryuig4-245jg2-fssdf4" instead real room name I used (again - only on android build - if I run same on PC in debug - everything was fine). Thanks for any advice !

my code to create room:
RoomOptions roomOptions = new RoomOptions() { IsVisible = true, MaxPlayers = 4 };
roomName = "SEAT - 1";
PhotonNetwork.CreateRoom(roomName, roomOptions, TypedLobby.Default);

this says "0 rooms":
int n = PhotonNetwork.GetRoomList().Length;

GetRoomList not working

$
0
0
Im using the latest version of PUN and the getroomlist isnt working properly even when using the DemoWorker scene.

[Best way to sync projectile]

$
0
0
Hello, I'm actually developping a weapon like in HL1. The principe is simple :

- Instantiate a projectile with his own script
- This projectile follow the mouse cursor with a certain velocity and a lerp rotation
- Destroy on hit





How it work?

So I join the server with 2 players.

I instantiate my projectile, request the ownership to the one who shot and send a RPC to every other player in game.
As you can see on the projectile object, the PhotonView is observing the script and there is a OnPhotonSerializeView() function in it and this one inherit from Photon.PunBehaviour...

But nothing is send or receive...

If someone could help me :D

Thanks.

~Nyudeb

How do I change the child inside a Photon Network instantiated gameobject?

$
0
0
How do I change the child inside a Photon Network instantiated gameobject so that the change is observed by all other users too?
This snippet doesn't work as expected:

user =PhotonNetwork.Instantiate("User", new Vector3(0, 1, 0), Quaternion.identity, 0);
if (PlayerPrefs.HasKey("username"))
{
user.transform.GetChild(1).GetComponent().text = PlayerPrefs.GetString("username");
}
What's wrong here and how do I correct it?

Shared object synchronization in a 2d game.

$
0
0
All game mechanics are ready, now I am trying to embed it for the multiplayer gameplay. But I am having some issues with synchronization over network. I am using Photon Cloud and bought PUN+ to achieve multiplayer.

To briefly mention, 2 bubble head characters are playing as rivals with one ball, characters are jumping and moving around to make the ball embrace the opponent's net.

Problems I am facing with are:

1. Ball cant be synced properly
2. Ball object can be controlled and shot by MasterClient easily (because he creates it) while other client can not. (I already tried sending an RPC but it lags much and because this game must have a fast gameplay it doesnt meet my requirements) When I try to move with the ball with nonMasterClient, ball is passed through then it appears in front again. (I cant figure out how to visualize or sync it)
3. I tried to transfer ownership, I measured the distance between characters and the ball, I transferred the ball's ownership to the closer one, but it just transports the ball and make the ball move insanely for a second. I couldnt handle it properly.

I am sure you guys already grasped what issues I am dealing with here. Some friends adviced hosting my own server, but I dont want to deal with writing API's and Physic behaviours.

Just showing a path or mentioning an approach can be very helpful for me.

Thanks.

Fetching Friends Status

$
0
0
Hello,

I've implemented PUN to my game. But I don't use any kind of authentication at this moment. Players assign themselves a GUID to use as PhotonNetwork.playerName, connect to Photon Cloud, then they randomly match. And after the match, they can add each other as friends. The problem is; when I fetch friend status with PhotonNetwork.FindFriends(), it shows all the friends offline (info.isOnline = false), although they are clearly online and in the lobby (with state of "JoinedLobby") at that moment. Is this because friend feature doesn't work without authentication? Is there a solution to this?

Thank you.

How to use RPC here to change child of photon instantiated prefab so that it's seen in all clients?

$
0
0
this snippet doesn't work. The change doesn't appear in other client's system.


void Start()
{

if (photonView.isMine)
{
this.transform.parent = Camera.main.transform;
this.transform.localPosition = new Vector3(0, 0, 0);

if (PlayerPrefs.HasKey("username"))
{
photonView.RPC("updateusername", PhotonTargets.All);
}

}
}
[PunRPC]
void updateusername(PhotonMessageInfo info)
{
transform.GetChild(1).GetComponent().text = PlayerPrefs.GetString("username");
}

Sync data without whole scene loading

$
0
0
Hello !

Let's say I'm working on a PC 3d racing game and I want to show Speedometer / RPM on a mobile device's screen connected to the game. I don't want to sync whole scene, just to send/receive few float values. How is it possible to be done? Thanks !

help with multiplayer card game

$
0
0
Hello
first sorry for my poor English

I'm now develop my first multiplayer game ever and trying to learn Photon

I will give you a brave idea about my game and where i have problem

when game start there are 4 player each one get 8 cards and rest of cards in drow , first player start ask any other player about any number he have in has deck

now in offline mode I made a four 5 lists , for each player one and one for drowing card when game start first shuffle the deck and put in every list 8 cards and put the rest in drow list and update it every turn

now in online mode I don't know how to assign every player one list and update it and how to switch turn to next player

Thank you for helping

Best regrets.

Feature Request: send RPC to specific Component

$
0
0
Enjoying Photon a lot! I'm mostly using it to send RPCs to the "paired" GameObject on the other clients.

One thing I ran into this morning (and can't find a natural solution to) is the following. Imagine I have two copies of a behavior on a GameObject, like so:

WizardGameObject
- WizardBehavior
- CastFireBallBehavior
- CastHealBehavior (for expensive burst heals)
- CastHealBehavior (for cheap slow heals)

In other words, along with various behaviors, a wizard has two copies of CastHealBehavior with different params. When one of these sends an RPC like "StartHeal", the paired GameObject errors (correctly) that both instances of CastHealBehavior are receiving the RPC on the other side. This is leading to some hack code on my part for now (and errors in the log on each call).

I think that if I could send RPCs between behaviors, not just gameObjects, I'd use it even when I didn't have to. :wink: Then I could have a generic RPC like "fire" and all my behaviors could send/receive it without confusing each other.

[I'm imagining and implementation where the behavior id is sent under the covers along with photon's viewId. The receiver can use this to find the correct behavior.]

Thanks!

How to show Player's name along with the Photon Network model instantiated for them?

$
0
0
I have tried doing the same with RPC.
What I tried doing:
Whenever a player is instantiated it sends a RPC to everyone telling them his/her name.
However the new players will never get to know the name of the old users because only the new players are sending the
RPC to the old users.
How do I actually do it?
Viewing all 8947 articles
Browse latest View live


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