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

Unreliable Transform View

$
0
0
Hi,
We have a live product and we did lots of testing but in some players, synchorize position and rotation stops working. We haven't seen this problem even once in our tests of hundreds so we have no idea what is going on with some players. The clue is that actually the player changed position on the other side because it shoots from the changed position but it does not change transform position on current player. Basicly the transform view does not sync on current view at all.
You can see the attached image for our setup and also we have a video in the link below:
https://everyplay.com/videos/47801131 (Normally the player rotates and runs to other directions. You can see it can throw knifes and other stuff so PunRPC commands work well.)
Can you please help us what can be the problem that some players of the same version experiencing?

Thanks


What is call order of PUN messages when players join in.

$
0
0
I have a 2 player 2D side scroller game where two players join in across the PUN. Whenever a player dies I have to reset both to their original positions, but I having a lot of problems doing the same. So, I wanted to what the LocalPlayerInstance means. Also. what is the call order of Photon Messages whenever a player joins? etc. etc. Also, are there any coding/design patterns to respawn players in a Multiplayer game. where the players holds some info from previous games?

Help! Newbie level instantiate question.

$
0
0
I am very new to photon, apologies if the questions are extremely basic.

1. I am making a game in which most of the elements are created in random positions. I assume the objects need to be instantiated on the server(host) side and use photonview so everyone sees the same objects. Is that correct? I don't want more information going over the server than needed.

2. I also can't seem to figure out how to get it to only happen once. Each player has the script to instantiate the objects. How do I make it only spawn the one time?

3. How do you differentiate from one player and another? I want one player to be chosen at random and be given a different prefab to start the game with. Everything I find is about all players starting with the same prefab.

Thank you for any help. I greatly appreciate it.

Synchronize variable for all players playing the game (include the players in different room)

$
0
0
Hello !

I make a simple 2D game in unity with PUN. In my game i have a feature like 'Jackpot'. When player lose the round, the variable of the Jackpot increase by 1000. I can let other players in the same room to update the jackpot but not other players on other rooms or in lobby.
Is there a way to tell other players not in the same room or currently in lobby to increase the jackpot value by 1000 ? Please help. Thanks !

OnJoinedLobby() isn't called after first login for the session

$
0
0
"Called on entering a lobby on the Master Server."

"OnJoinedLobby() or OnConnectedToMaster() are called when PUN is ready"

The callback works after failing to join a room or every other time it's supposed to. Everything else seems to work if I wait a few seconds to enter lobby. However, the point is -- OnJoinedLobby is never called on init!

Am I missing something? :pensive: autojoinlobby is true

Having troubles handling pre-game room disconnections with TTL (to reconnect in-game)

$
0
0
We need to either kick an inactive person, or change TTL before we change from pre-game to in-game.

Our situation is this:
* We start in a pre-game lobby to gather players in a room with 12 min TTL with in-game reconnections in-mind
* When a player is disconnected in a pre-game room, they "linger" for 12 mins.

So we had 2 ideas to resolve this:
* Simply kick them on activity changed callback ONLY while in pre-game. Disconnected in pre-game? Bye. However, you can't kick inactive players, for some reason (why?)

* You can set tons of room options after created, so start with 0 TTL and change the TTL to 12 mins just before the game. However, it seems we can't change TTL after the room is created (why?)

Suddenly, all ideas become complicated no matter what we do past here. This leads to some questions:

1. How come we can't kick an inactive player? This makes sense during pre-game "staging".
2. Why can't we change the room TTL post-creation?
3. Any alternatives or recommendations?

The "last resort" workaround sucks:
* We have max 16 players. Instead, we allow max 31 players.
* We'd have to change all UI to reflect a # of inactive players.
* Upon activity change, we'd have to hide the UI as if they actually disconnected (show 1 less player, remove their name from the playerlist), even though they are still "there", lingering.
* If the player queues up for a game normally (randomly), we'd have to check somehow upon failure to join if it was because you were unable to REJOIN. Then rejoin instead of join (otherwise the player will create a room since he can't join the same room he's inactive inside).
* In-game, we'll need to initialize checking based on inactive players and handle awkwardness of a player over our limit that "rejoins".

Overall ,it's super awkward, all because we can't kick an inactive player or change the player TTL :pensive:

I am getting DisconnectedByServerLogic when raising a custom event

$
0
0
Hello,

I've tested and if I send an int or null with this RaiseEvent I don't get disconnected, but I do when I send a custom event. The event has a content of just 14 bytes, so I understand it's not due to the packet being too huge. I can reproduce this 100% of the times. How can I know what's the reason to be disconnected by server logic?

Thank you very much!

connect photons from 2 difrent unity projects

$
0
0
hey working on build control so i made 2 unity projects to test but it seems i cant connect from 2 different builds is this true or did i miss a setting or something

100 CCU

$
0
0
Hi, how do I get the 100 CCU, I have owned Pun for a few years, but rarely used... I was wondering how I can get the 100 CCU, for the cloud. It says to add a coupon, but I was not able to find it. Please let me know what I can do here.


Also question, I use BOLT, alot. are we able to use the 100 CCU with Bolt ? or does it have to be with PUN for the Cloud and the Photon Server?

Apple Reviewer cannot connect to Photon - DisconnectedByClientTimeout

$
0
0
I have submitted my App like 5 times, swapping server from Europe to US, changing this and that
Triggering the small Checkbox in Unity Build Settings "Requires persistent WiFI".

Submitting on iOS 10 with Xcode 8, submitting on iOS 11 with Xode 9

building just for iPhones, building for Universal and all I get is the same answer from Apple Reviewer Team

DisconnectedByClientTimeout



Their Internet connection must be working because my own written Login Process is working just fine but then after connecting to Photon it does not work.

I cannot reproduce this because it is working perfectly for me since ever.


. . . has anyone an answer?


Also I tested with PUN and with RealTime

However, both are just free plans, is this maybe the issue? Do you block connections to deployed in production apps?
I am sure you can somehow distinguish between testing apps and in real deployment apps.




The only possible explanation I can think off is that Photon does not allow two different App ID in PhotonSetting for same game in production.


I have game A with CCU 100 released under following game package aaa.bbb.ccc.ddd for Android.

Now I planned to release for iOS the same game with the same package name aaa.bbb.ccc.ddd
but using a new different App ID in PhotonSettings.

Maybe Photon is somehow blocking this connection but only for real production because it is working perfectly fine when I test it.








Animator disappears if not set to "Always Animate", Skinned mesh "update when offscreen" not helping

$
0
0
Hello, issue is as described above. After a playing for a tiny but and losing sight of the other player and then looking back, the other player becomes invisible. In editor if the GameObject is selected and "focused" with the F key the other player will reappear (very strange, like it is waking up the component or something). Setting the animator to "always animate" fixes the problem but I wish there was a better solution or some insight as to why the player is getting culled despite their skinned mesh bounding box updating and being within sight. Any thoughts?

Ownership transfer of SceneObjects on disconnecting MasterClient

$
0
0
Hello,

i am using PhotonNetwork.InstantiateSceneObject("BrickWall", t.position, t.rotation, 0, null); to let the MasterClient instantiate the destroyable world.
In Unity this SceneObjects are shown on MasterClient as
- Owner: Scene
- ViewID: 1
- Controlled Locally (master): yes

After the MasterClient is disconnecting, looks like the ownership of the SceneObjects get automatically transferred by PUN. After this the Ownersship is not anymore Scene for the new MasterClient:
- Owner: 2
- ViewID: 1
- Controlled Locally (master): yes

How to solve this problem? This should not be normal?

This is a problem for me because: If a bullet hits anything, i check if it hits the player itselfe, to ignore himselfe. (In my game the owner of the bullet should not be hit by it).
if (bulletOwnerId == other.photonView.ownerId) { //ignore }
In this case after the MasterClient disconnects and the ownership of the SceneObjects is transferred automatically, the new MasterClient can not hit any SceneObject anymore, because all SceneObjects have now the MasterClients OwnerID,

OnUpdatedFriendList => No UserId?

$
0
0
Seems that we get isInRoom, isOnline, Name, and Room --

But where is the UserId? I am a bit surprised that I can't find this. I provided a list of UserId to get friends, so it seems that it would make sense to provide it on the other side since my list won't match the callback (unless 100% of my friends are playing 100% of the time) and comparing by Name is unreliable (and probably inefficient if the user has thousands of friends, such as streamers).



1 - Is there a way to get the userId here?

2 - Any suggestions outside of comparing by Name?

PS -- The word "Name" seems a bit inconsistent to the other naming conventions -- as a minor suggestion, should this probably be "NickName" to match Player.NickName (as player.name is deprecated and player,Name doesn't exist)?

PUN Disconnects

$
0
0
Hi, We are using Photon Unity Networking FREE version and everything was working fine .Since yesterday we have noticed that once players join the room and the master performs some action that gets broadcast-ed to the room, Photon gets disconnected automatically for the master. OnDisconnectedFromPhoton callback from PhotonObserver class is invoked right after master raises event to other players.

Can anyone tell what is the issue ?

PUN Version : 1.87

TimeoutDisconnect while connecting to 159.8.35.122:5055. Check if the server is available.

$
0
0
Hi.
My app is running fine with PUN on Nexus 5x and HTC M8 from Pakistan. But I'm getting the following error on a BlackBerry Priv from Turkey:
TimeoutDisconnect while connecting to 159.8.35.122:5055. Check if the server is available.
DisconnectByClientTimeout

On the BB, I have already confirmed that the app can access the internet. Moreover, when Photon tried to check for Best Region, it got 4000ms for each server and then Photon selected 'eu' as the Best Region. I think all regions are timing out.

I'm running PUN on Best Region, All regions enabled, Udp protocol, Auto-join lobby and Run in Background.

Any help is appreciated.

Color not being unique to every player.

$
0
0
Hello, I'm amking a guess the drawing game where players can choose the color of the pencil they use. It works with this script but the problem is, say one of the players chooses black and draws, and if the second player chooses red on his device, and draws something. Then again if the first player draws something I need it to stay black, but the new line color is Red.

Questions regarding Rigidbody collision synchronization

$
0
0
Hello there,
I am very new to the Photon engine and to multiplayer programming in general. After watching and reading a lot of beginner tutorials I believe to have a good understanding of the very basic concepts now. However there is one thing I can’t get my head around. After searching for answers on google and in this forum I came to the decision to ask my questions explicitly.

I am working on a little project where the player has a third person character that he can move with the mouse. Like Diablo or Sacred. I am using the Third Person Character of Unity’s standard assets. I managed to set up Photon correctly so the players can join to the same room and see each other. Even the smoothing of the movement synchronization worked pretty good. I used the TransformationView and RigidbodyView scripts that came with Photon.

But there are still some problems I can’t find a solution for. The main problems occur due to the rigidbody component on the player characters. If Client1 runs into Client2 he is able to push him away from his position. The movement only occurs on Client1’s computer. Client2 himself does not receive the collision force and does not recognize he is being pushed away. That leads to the problem that the character of Client2 can have two completely different positions on both clients. Of course when Client2 moves his character himself the position will be corrected immediately due to the observation of the transform, which leads to teleporting of Client2’s character on Client1’s side. For better understanding I made a video of this: image

I am not really sure how to handle this situation. I guess I either have to make sure the force of the collision is synched correctly or to prevent the characters from colliding with each other at all. As you may saw the rotation is not synched correctly as well, although it is observed by the PhotonView. Also the the value of the Y position of the transform of both characters constantly jumps between 0 and a very small number even though no one is moving at all: image I simply can't explain why but I have to admit that I haven't investigate those specific problems any further yet.

I also would like to ask if characters with rigidbody components are a general praxis in multiplayer games. Nearly every singleplayer character tutorial I found uses rigidbody components but most of the PUN multiplayer tutorials don’t. So I am thinking of rewriting the character controller to work without rigidbodies instead of synchronizing them. The downside of this would probably be to lose the current character movement feeling which I like. I took a look at the Unity Tutorial project Tanks! which uses UNet. The tanks use rigidbodies as well and the collision of two clients happened correctly but I can’t see the difference in the implementation.

Do you have any advise how to solve or at least tackle those problems? Is it better to not use rigidbody character controllers? Since I am still learning and try to get some overview of the basics of multiplayer programming I feel like I am currently missing the forest for the trees. Maybe I overlook something really basic.

I appreciate your advice.

Thanks

Jannik Guenther

Oculus Avatar SDK with PUN

$
0
0
Hello everyone,

We're testing out Photon for our new multiplayer Oculus application.

I followed the tutorial on Photon's website "Using the Oculus Avatar SDK" here: https://doc.photonengine.com/en-us/pun/current/tutorials/oculusavatarsdk

I followed every step one by one, but I'm having a strange problem.

The first player that creates & joins the room has no errors, but the second player gives out a NullReferenceException on the PhotonAvatarView.cs attached to the LocalAvatar object. Here's the script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;

public class PhotonAvatarView : MonoBehaviour {

    private PhotonView photonView;
    private OvrAvatar ovrAvatar;
    private OvrAvatarRemoteDriver remoteDriver;

    private List<byte[]> packetData;

    public void Awake()
    {
        photonView = GetComponent<PhotonView>();
        if (photonView.isMine)
        {
            ovrAvatar = GetComponent<OvrAvatar>();

            packetData = new List<byte[]>();
        }
        else
        {
            remoteDriver = GetComponent<OvrAvatarRemoteDriver>();
        }
    }

    public void OnEnable()
    {
        if (photonView.isMine)
        {
            ovrAvatar.RecordPackets = true;
            ovrAvatar.PacketRecorded += OnLocalAvatarPacketRecorded;
        }
    }

    public void OnDisable()
    {
        if (photonView.isMine)
        {
            ovrAvatar.RecordPackets = false;
            ovrAvatar.PacketRecorded -= OnLocalAvatarPacketRecorded;
        }
    }

    private int localSequence;

    public void OnLocalAvatarPacketRecorded(object sender, OvrAvatar.PacketEventArgs args)
    {
        using (MemoryStream outputStream = new MemoryStream())
        {
            BinaryWriter writer = new BinaryWriter(outputStream);

            var size = Oculus.Avatar.CAPI.ovrAvatarPacket_GetSize(args.Packet.ovrNativePacket);
            byte[] data = new byte[size];
            Oculus.Avatar.CAPI.ovrAvatarPacket_Write(args.Packet.ovrNativePacket, size, data);

            writer.Write(localSequence++);
            writer.Write(size);
            writer.Write(data);

            packetData.Add(outputStream.ToArray());
        }
    }

    private void DeserializeAndQueuePacketData(byte[] data)
    {
        using (MemoryStream inputStream = new MemoryStream(data))
        {
            BinaryReader reader = new BinaryReader(inputStream);
            int remoteSequence = reader.ReadInt32();

            int size = reader.ReadInt32();
            byte[] sdkData = reader.ReadBytes(size);

            System.IntPtr packet = Oculus.Avatar.CAPI.ovrAvatarPacket_Read((System.UInt32)data.Length, sdkData);
            remoteDriver.QueuePacket(remoteSequence, new OvrAvatarPacket { ovrNativePacket = packet });
        }
    }

    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.isWriting)
        {
            if (packetData.Count == 0)
            {
                return;
            }

            stream.SendNext(packetData.Count);

            foreach (byte[] b in packetData)
            {
                stream.SendNext(b);
            }

            packetData.Clear();
        }

        if (stream.isReading)
        {
            int num = (int)stream.ReceiveNext();

            for (int counter = 0; counter < num; ++counter)
            {
                byte[] data = (byte[])stream.ReceiveNext();

                DeserializeAndQueuePacketData(data);
            }
        }
    }
}
It gives the error on line:
if (packetData.Count == 0)

saying:
NullReferenceException: Object reference not set to an instance of an object PhotonAvatarView.OnPhotonSerializeView (.PhotonStream stream, PhotonMessageInfo info) (at Assets/_PhantasyVR/Scripts/PhotonAvatarView.cs:88) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) PhotonView.ExecuteComponentOnSerialize (UnityEngine.Component component, .PhotonStream stream, PhotonMessageInfo info) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:553) PhotonView.SerializeComponent (UnityEngine.Component component, .PhotonStream stream, PhotonMessageInfo info) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:457) PhotonView.SerializeView (.PhotonStream stream, PhotonMessageInfo info) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:352) NetworkingPeer.OnSerializeWrite (.PhotonView view) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:4217) NetworkingPeer.RunViewUpdate () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:4079) PhotonHandler.Update () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:164)

This results in the second player not being able to send packets, therefore while the second player is the one having the errors, it can see both players' head movement correctly, while the first player can't receive the headset movement of the second player.

Any help would be much appreciated.

Playfab integration of pre-existing photon account

$
0
0
Hi,

I have a PUN+ account for photon I want to use with playfab, the thing is, there's only an options to get a NEW app id and such through the playfab add-ons.

They directed me to contact Exit Games in order to tie my existing app id to their cloud.

How do I go about doing that?

Thanks,
Michael.

Photon and Loading Screens

$
0
0
Hi everyone, I'm bit confused on how to create a simple loading screen with Photon.

I have the PhotonNetwork.automaticallySyncScene = true so all the clients in the same room join the same level selected by the master client.

I understand that I must set isMessageQueueRunning = false so PUN won't dispatch incoming messages but how do I know that the level itself finished loading? In normal terms I would use LoadLevelAsync() but I have read that PUN does not make use of that method.

The process that Im taking is this:
1 - Create or join room
2 - OnCreateRoom() I use the PhotonNetwork.LoadLevel() to enter the level
3 - Loading Screen Scene - finishes when the level selected above finished loading -> The problem
4 - Spawn Characters on Awake ( ... )

Am I making a big confusion with this or what? :D
Can some one enlighten this matter?

Thank you. :)
Viewing all 8947 articles
Browse latest View live


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