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

Unity CallBack Photon

$
0
0
Hello, I have below unity (2019.2.14) editor callbacks and I do not know why. Could you please help me? Thanks in advance, Cheers, PhotonManagerLog: Player connected to master. 0x00007FF7EC14290C (Unity) StackWalker::GetCurrentCallstack 0x00007FF7EC145DE1 (Unity) StackWalker::ShowCallstack 0x00007FF7EA9D4665 (Unity) GetStacktrace 0x00007FF7ECCFA85B (Unity) DebugStringToFile 0x00007FF7EC176D94 (Unity) DebugLogHandler_CUSTOM_Internal_Log 0x00000211A91B94FB (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object) 0x00000211A91B912B (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) 0x00000211A91B87C1 (Mono JIT Code) [Logger.cs:61] UnityEngine.Logger:Log (UnityEngine.LogType,object) 0x00000211A91B7E60 (Mono JIT Code) [Debug.bindings.cs:99] UnityEngine.Debug:Log (object) 0x00000211B4D20F0B (Mono JIT Code) [PhotonManager.cs:74] PhotonManager:OnConnectedToMaster () 0x00000211B4D20C78 (Mono JIT Code) [LoadBalancingClient.cs:3418] Photon.Realtime.ConnectionCallbacksContainer:OnConnectedToMaster () 0x00000211B4D01FE3 (Mono JIT Code) [LoadBalancingClient.cs:2240] Photon.Realtime.LoadBalancingClient:OnOperationResponse (ExitGames.Client.Photon.OperationResponse) 0x00000211B4CC4DE4 (Mono JIT Code) [PeerBase.cs:620] ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer) 0x00000211C178BCE6 (Mono JIT Code) [EnetPeer.cs:552] ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands () 0x00000211C17886AC (Mono JIT Code) [PhotonPeer.cs:1548] ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands () 0x00000211C1787E3F (Mono JIT Code) [PhotonHandler.cs:205] Photon.Pun.PhotonHandler:Dispatch () 0x00000211C1786A33 (Mono JIT Code) [PhotonHandler.cs:139] Photon.Pun.PhotonHandler:FixedUpdate () 0x000002119D425178 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) 0x00007FFE4B81BFB0 (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke 0x00007FFE4B7A2142 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke 0x00007FFE4B7AB13F (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke 0x00007FF7EC0CCB32 (Unity) scripting_method_invoke 0x00007FF7EC0C67E1 (Unity) ScriptingInvocation::Invoke 0x00007FF7EC07F8CB (Unity) MonoBehaviour::CallMethodIfAvailable 0x00007FF7EC07FCB6 (Unity) MonoBehaviour::CallUpdateMethod 0x00007FF7EB7811C8 (Unity) BaseBehaviourManager::CommonUpdate 0x00007FF7EB789A34 (Unity) FixedBehaviourManager::Update 0x00007FF7EBBA22AC (Unity) `InitPlayerLoopCallbacks'::`2'::FixedUpdateScriptRunBehaviourFixedUpdateRegistrator::Forward 0x00007FF7EBB8C288 (Unity) ExecutePlayerLoop 0x00007FF7EBB8C369 (Unity) ExecutePlayerLoop 0x00007FF7EBB911DB (Unity) PlayerLoop 0x00007FF7EA14888B (Unity) PlayerLoopController::UpdateScene 0x00007FF7EA14633C (Unity) Application::TickTimer 0x00007FF7EA9DBB80 (Unity) MainMessageLoop 0x00007FF7EA9DE59F (Unity) WinMain 0x00007FF7ED695452 (Unity) __scrt_common_main_seh 0x00007FFEA3BF7974 (KERNEL32) BaseThreadInitThunk 0x00007FFEA687A271 (ntdll) RtlUserThreadStart

Lerping position?

$
0
0
Hi, I've seen some examples of how to lerp from a start position to an end position which is supposed to make the movement appear smoother in a multiplayer game, however it seems it's all for automated or AI movement and not for players moving the players themselves. Here's the movement part of my characters controller script: I rotate the camera/character with the mouse: rotationX += Input.GetAxis("Mouse X") * lookSpeed; rotationY += Input.GetAxis("Mouse Y") * lookSpeed; transform.localRotation = Quaternion.AngleAxis(rotationX, Vector3.up); transform.localRotation *= Quaternion.AngleAxis(rotationY, Vector3.left); And then I've got gradual acceleration in the direction the camera is facing with AddForce: if (Input.GetKey(KeyCode.W)) { player.AddForce(transform.forward * speed2 * 98 * Time.deltaTime); } How am I supposed to "Lerp" position to achieve the completely smooth movement/position Update seen by all players during gameplay so as to lower the message sendrate which is now 60/30 and still not perfectly smooth?

PhotonNetwork.CountOfRooms Problem

$
0
0
Hello, In a unity scene, the below code returns weird output and I do not undertand why. Do you have any idea? Btw, my main problem is, although I create a room, client can not join the room with JoinRandomRoom, I gues somehow cannot see the room, instead creates another room. if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom.IsOpen) { Debug.Log("Room Count: " + PhotonNetwork.CountOfRooms); Debug.Log("Max Players for Room: " + PhotonNetwork.CurrentRoom.MaxPlayers); Debug.Log("Current Player No in Room: " + PhotonNetwork.CurrentRoom.PlayerCount); Debug.Log("Visible: " + PhotonNetwork.CurrentRoom.IsVisible); } Room Count: 0 Max Players for Room: 4 Current Player No in Room: 1 Visible: True Thanks in advance, Cheers,

PUN2 Can't create or join room

$
0
0
i upgraded from pun1 to pun2 and now when i try to create a room nothing happens. i am using unity 2017.4.29f1. The code worked with pun1 and seems correct. When I try to make a room isconnected is true and inlobby is true. After I try to create the room, inlobby becomes false, but inroom is still false. OnCreateRoomFailed is never called. i imported pun2 free and used my old 100ccu subscription from pun1.what could be the cause?

Unity Invoice doesn't work for Coupon Code

$
0
0
Hi, i've purchased the Photon Plus+ for unity from the assets store and i tried applying the invoice number as the coupon for my app and it errors out claiming the following. "The code or appId do not seem to be valid, please re-enter." Can anyone assist with this?

Question about object transfer control and item ownership

$
0
0
Does there exist a photon pun functionality that is built into photon that would allow for example, a client to request that they are dropping or throwing an item (giving up ownership) that would send out say, the item's location and a typeID, but then photon pun would return to the handle method with an additional parameter like some kind of hashed ID or photonviewID? I.E. say, 9 parameters are sent over the network to the relay, but 10 are returned?

The Photon Analytics page appears to be broken! Help!

$
0
0
So, I was trying out a new method of message reduction, and thought it would be a great idea to check my message analytics counter to see how my fix was working. So I signed in to check my analytics, and sure enough, the page was updated with new colors and a new layout, but I found that the only counter available was the CCU counter, which was working properly. The linked page discussing the counters seems to point to more counters being available upon upgrading your liscense, and also points to there being a "filter" setting to turn certain counters on or off. I am completely stumped here, and I would be grateful for any help. Thank you.

RPC , PhotonNetwork instantiate, order of things

$
0
0
Hi, I’m creating in my space game multiplayer. The single player is finished so now I’m working on the multiplayer. I’ve got a few issues, most of the things I found googling, YouTube or in this forum but couldn’t figure out some of the issues I have that don’t work as expected. 1. When I load the scene from a created room in a lobby, the scene loads for all the players in the room, but in different tests different issues occurs: A. PhotonNetwork.instantiate didn’t create the objects, because the objects had firing mechanism with RPC , only saw the shots being fired.(both loaded the scene almost the same time with no delay) B. The photonNetwork.instantiate did work, but the first function didn’t work for one side of the client, specifically the one loaded the scene last. I tried doing RPC for each player entering the scene so it will assure me that the function will occurs after each player loaded and for every client - didn’t work I tried to activate the function with a delay (Invoke)on start so all players will be inside for sure - didn’t work The instantiate is for AI spaceships , each player do the instantiate so the AI will be on his side and under his control, so that’s why I needed them to be an entity. Than if photonview of that AI is not mine, I change their status to enemy so the client controlling them see them as they created as allies, and the other client see them as enemy because he changed their status. 2. I need to track the speed of the AI not under my control, so if he is mine, I set custom properties with its view ID as key, and if he is not mine I get that data with the view ID and set it back on the script controlling him so the data is always updated(I do this for the player also not only AI and it works there), but not working either. 3. When I kill a player I use RPC to say who killed who and set it for the player who killed and the player killed by, I send through RPC the killer actor ID and the killed actor ID, debug shows the right actors, the RPC function check if the photonview owner actor is the killer or killed and set on screen the proper message, but it works only for the player got killed. Those are my issues, hope to get them solved, if needed specific functions I use I’ll add them.. hope someone can help, tnx

Player Teleport

$
0
0
Hi guys! I have a quick question. I'm quite new to PUN and am currently working on a blink mechanism in my game. Do I have to look out for something special if I want the move (Teleport) the player around the world, or can I just normally set the transform.position to a new Vector3 and everything works. What do you guys think, ? (I'm using the PUN2 PhotonTransformView)

FB

$
0
0
Hi guys, We have finished a football free kicks game and it's time to think about the online multiplayer PvP implementation. Would anyone have an estimate on how long it takes to implement that option with 1 to 2 devs working on it? We would be looking into online PvP random users (one user being the shooter and the other one the goalie), online PvP choosing your opponent (friends, etc...), online race (2 users competing to hit the most amount of targets), rankings and learderboards. Thanks everyone for your help

Send game invite to friend

$
0
0
I am using Photon PUN in Unity for a PS4 game. I really can't figure out how to invite a friend to a game. I know you can use FindFriends to see if he is online and in a room, but that still doesn't help me send an invite. I've seen some people say you can use Photon Chat for it, but that would mean i would have to pay for a services for one simple task? I would greatly appreciate if someone had a simple projekt to show an invite system or some way to send a simple message, or anything that helps really. Thanks in advance :)

Sharing Gameobjects over Photonetwork

$
0
0
Hello Everyone, I am just a beginner in Unity. I have been trying to create a VR Multiplayer application with Photon. My application requires runtime creation of GameObject and syncronizing those GameObject over all the players. I tried using Instantiate but the problem is I have components such as MeshRenderer which is applied to the GameObject in run time. Can someone help me how can I update my GameObject run time and share its properties over the PhotonNetwork? Thank you in advance

Custom type Problem with serialization

$
0
0
My problem: The information that there in the API is very confusing and I can not understand how to create a custom class, in my opinion I am doing well, without any writing error in code, but when I am going to serialize more than 1 data I get an error that apparently I can't solve in any way My code:
 void Awake()
    {
        PhotonPeer.RegisterType(typeof(WeaponDamageStruct), (byte)'S', WeaponDamageStruct.SerializaME, WeaponDamageStruct.DeserializaME);
    }

 public void ShootIng(WeaponDamageStruct WDS)
    {
        
        photonView.RPC("Damage", RpcTarget.All, WeaponDamageStruct.SerializaME(WDS));
    }
public static byte[]SerializaME(object wds)
    {
        var WDS = (WeaponDamageStruct)wds;
      
        byte[] Info = new byte[]
        {
             byte.Parse(Convert.ToString( WDS.Damage))
            ,byte.Parse(Convert.ToString( WDS.Jugador))
            ,byte.Parse(Convert.ToString( WDS.IdGun))
            ,byte.Parse( Convert.ToString( WDS.LookAt.x))
            ,byte.Parse( Convert.ToString( WDS.LookAt.y))
            ,byte.Parse( Convert.ToString( WDS.LookAt.z))
            ,byte.Parse( Convert.ToString( WDS.HitPoint.x))
            ,byte.Parse( Convert.ToString( WDS.HitPoint.y))
            ,byte.Parse( Convert.ToString( WDS.HitPoint.z))
            ,byte.Parse( Convert.ToString( WDS.Receptor))
            ,byte.Parse( Convert.ToString( WDS.HitSite))
            ,byte.Parse( Convert.ToString( WDS.MatType))
        };
        return Info;
      
    }
My Log:
FormatException: Input string was not in a correct format. System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) (at <7d97106330684add86d080ecf65bfe69>:0) System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <7d97106330684add86d080ecf65bfe69>:0) System.Byte.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <7d97106330684add86d080ecf65bfe69>:0) System.Byte.Parse (System.String s) (at <7d97106330684add86d080ecf65bfe69>:0)

oculus avatar sdk tutorial help

$
0
0
I've been trying to get my head around the Oculus Avatar SDK tutorial, https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/oculusavatarsdk and have gone through a number of previous questions on this topic in the forum... but still blocked. I'm very new to Unity and PUN, but have an average grasp of programming. I'm looking to create an Oculus GO/Quest demo, with just 2 avatars (local first person, remote third person) in a basic area with head movement etc over the network from the 'remote' avatar. I made the assumption that the tutorial above covers everything that is required to get me to that point through PUN connection, Oculus Avatar etc. Maybe my first question should be, is that a correct assumption? Or does this tutorial build on other tutorials? My current Unity hierarchy setup consists of a simple 'plain' to stand on, a network Manager Object with the NetworkManager C# from the tutorial, a RemoteAvatar prefab linked to the AvatarPhotonView script from the tutorial, a OVRPlayerController (instead of the main camera) with an eventual child LocalAvatar prefab again linked to the AvatarPhotonView. I've setup PUN and Oculus User and App ID's. When I build and run, the avatars are present - The local avatar - I can see and move the head and hands, however the remote avatar while visible does not move when I have two copies of the app running (Go and Quest). No errors are showing which is partly why I want to clarify that my assumption about the tutorial is correct. Am I missing something important? or have just hooked it up incorrectly. Does anyone have the basic avatar tutorial unity project running or available? Thanks for your time D

Unity Ball Syncronization

$
0
0

I am coding a animated ball multiplayer mobile game. The ball animation is quite fast (speed around 25-30) and there are 5 balls at the same time.

Initially, I tried to the physics are run on masterclient and synced in clients via pun2 network. However, the ball animation on the clients are not very smooth which will annoy the player.

Secondly, I tried to run each physics on each client separately with below function, however, the physics simulation is different between the android client and unity editor client.

Finally, what should I do?

The script on the ball;

Rigidbody rb;
float t1 = 0.0f;
float scale = 2f;
float maxVelocity = 20f;
bool collided = false;
float limitSpeed = 30f;

float cooldown = 1;

void Start()
{
    rb = GetComponent<Rigidbody>();        
}

void InitialKick()
{
    switch (GameObject.Find("GameManager").GetComponent<GameManager>().ballCount)
    {
        case 1:
            rb.AddForce(new Vector3(20, 0f, 20), ForceMode.Force);
            break;
        case 2:
            rb.AddForce(new Vector3(-20, 0f, 20), ForceMode.Force);
            break;
        case 3:
            rb.AddForce(new Vector3(20, 0f, -20), ForceMode.Force);
            break;
        case 4:
            rb.AddForce(new Vector3(-20, 0f, -20), ForceMode.Force);
            break;
        case 5:
            rb.AddForce(new Vector3(10, 0f, 30), ForceMode.Force);
            break;
    }
}

private void FixedUpdate()
{
    if (!collided) InitialKick();
    if (collided & rb.velocity.magnitude < maxVelocity) rb.AddForce(3f * scale * rb.velocity.normalized, ForceMode.Force);

    t1 += Time.deltaTime;
    if (t1 > 1.0f)
    {
        scale += 0.5f;
        t1 = 0.0f;
    }

    rb.mass += Time.deltaTime * 0.01f;
}

private void OnCollisionEnter(Collision collision)
{

    if (collision.collider.tag == "Wall" || collision.collider.tag == "Column")
    {
        collided = true;
    }

}
}



Custom Properties and Performance?

$
0
0

Hello,

How does the amount of properties impact performance? Does it just iterate/search through the values normally, or is there network implications for having large numbers of custom properties?

Thanks

[PUN2] Interest group not work

$
0
0
Hello, I am a new user of Photon Voice 2. I tried to create voice groups between players, then in order to test I built 3 versions of the game adding the following code in the Start method of a new script attached to the players where the use case is: Players with interest group 1 can listen between them Players with interest group 2 can listen between them Everybody can listen to players with interest group 0 Players with interest group 1 cannot listen to players with interest group 2 and vice versa The first version have this code:
Player 1:
#Unsuscribe from 1
PhotonNetwork.SetInterestGroups(new byte[0] { 1 }, null);
#Unsuscribe from 2
PhotonNetwork.SetInterestGroups(new byte[0] { 2 }, null);

#Suscribe to 1
PhotonNetwork.SetInterestGroups(null, new byte[0] { 1 });
The second version have this code:
Player 2:
#Unsuscribe from 1
PhotonNetwork.SetInterestGroups(new byte[0] { 1 }, null);
#Unsuscribe from 2
PhotonNetwork.SetInterestGroups(new byte[0] { 2 }, null);

#Suscribe to 2
PhotonNetwork.SetInterestGroups(null, new byte[0] { 2 });
The third version doesn't have any code, this version is for Player 3 with InterestGroup zero. Then I connect to the same room and realize the test: Player 1 and Player 2 can listen Player 3. (That's expected because everybody listen to zero) Player 2 can listen to other Player 2. (That's expected) Player 1 can listen to other Player 1. (That's expected) Player 1 can listen to Player 2. (That's not expected because they belong to different interest groups) I can't figure out how to solve this problem. After searching, I found this: https://forum.photonengine.com/discussion/14829/interest-group-does-nothing There, @JohnTube said a line of code was missing but even adding that line the program doesn't have the expected test between interest groups. I don't know how to fix this or if @Slyp found a workaround. I can share my project if necessary.

My bullet damage myself~ help pls! thank!

$
0
0

My bullet C#

private void OnCollisionEnter(Collision collision)

  {

    if (collision.collider.tag == "Player")

    {

      PlayerData pd = collision.gameObject.GetComponent<PlayerData>();

      pd.TakeDamage(DamageAmount);

 }

 }


I want to make bullet only damage on hit other player, but collision self don't .

(my bullet is a big fire ball, Shoot out from the body)

but my tag is same as other "Player"

cannot find answer... is someone can teach me?

THANKS!

Message fragmentation and PhotonNetwork.ObjectsInOneUpdate

$
0
0

Hi!. Is there a way to tell if a message is being fragmented? I'm under the assumption that it's based on the size of the byte stream that's being populated with my OnPhotonSerializeView's. But PhotonNetwork.ObjectsInOneUpdate is based on the amount of objects being sent rather than their size. If it is based on size, Is there a rough estimate as to what the size of this stream would be before fragmentation occurs? I am asking because I have a moderately large number of objects to send, but I know that their size is fairly small and I would like to increase ObjectsInOneUpdate.

TTL problems

$
0
0

Working on rejoin logic. I set TTL for the room to 5 minutes.

Works correctly if a player crashes or loses internet connection. But if they actually choose to quit the level and PhotonNetwork.Disconnect() is called, they stay in the level for 5 minutes still? That has to be a bug right? If not, i don't understand, how do i get the player to leave a level immediately? TTL should just be for handling unwanted disconnects right? Not intended disconnects?


PUN1 Latest, near to latest Unity.

Viewing all 8947 articles
Browse latest View live


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