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

JoinRandomRoom failed

$
0
0
@vadim @Tobias

hello ,

with help of your many solution now times come to live my game. but there are some network related issue when i connecting room with matching property. i got such error like "onRandomRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster."

this error not arise every time but some times and when this error fie my app goes on dead state and room not created or joined.

i have checked many solution like :- deselect best region option from setting but in my setting there are no any check box to unchecked it.

in one of question @Tobias has suggest that check that you are currently on some room and trying to connect ion another room but i have also check this with PhotonNetwork.inRoom but there is no room joined before i created or joined.

Please help me to solve this.
is there any method to connect game server to master or joined lobby. if yes than guide me to write it. so i can remove this error and go for a live game.

and one question also that currently i am using free version than there is possibility of such error to connect server???

Thank in Advance.

PUN with mobile Devices

$
0
0
Using Unity 5.3.4f1 and PUN Free, we can't connect using mobile devices. Only with PC we can. Is this normal, do we need to get the Pun+ version to make it work?

PickupDemoGUI script

$
0
0
Hi! I'm trying to do two lists including the members of a team. I just used the PickupDemoGUI script, which was relatively simple, but the main rule of unity "it can't be easy" hit me again. Without modifications the script works perfectly and shows all the members of each team, but when I change the way to display it: GUILayout.Label () replaced by TextMesh.text = (), there is only one member appearing on this textMesh. Is there a way to display the same thing that appears with the GUI? Thank you

Rigidbody not being assigned

$
0
0
Hello, I have an object that when collided with by another object that has a particular tag becomes the child of the first object. In the script on the first object there is a rigidbody variable that begins as null and is then assigned the rigidbody of the second object upon childing. The script shows this rigid body assignment occurring but I get an error back when I attempt to engage (fire) with this rigidbody indicating that there was no rigidbody and to make sure one is assigned in the editor. When I look in the editor is shows the assignment as occurring. Why might pun not be recongnizing this assignment? My script looks like this

public Rigidbody rbAmmo = null;
//on collision parent and acquire rigidbody
void OnTriggerEnter(Collider other)
{

if (other.gameObject.tag == "dart") {
rbAmmoGo = other.gameObject;
rbAmmo = rbAmmoGo.GetComponent();
rbAmmo.isKinematic = true;
rbAmmoGo.transform.parent = transform;

}
}
//when trigger pressed fire is called
public void fire()
{
Debug.Log("fire");
rbAmmo.isKinematic = false;
rbAmmo.AddForce(gun.transform.forward * popForce, ForceMode.Impulse);
rbAmmoGo.transform.parent = null;
rbAmmoGo = null;

rbAmmo = null;

}

PUN wont work on android

$
0
0
I am currently new in using PUN. I tried to use the DemoRPGMovement-Scene to help me with a game that Im making for a school project. It was working fine in the Unity Editor, but when i tried to run it on an android device, it wont work. It's stuck in Connecting to a peer. Please help me. Thanks !

Is PUN right for me? + some questions

$
0
0
I am planning to do 2D competetive top-down shooter. I want to have 16 players on a server. From the website calculator it shows me that just with 5 messages per player & second it will require 1,280 total per second per room. This is nearly three times more than what free plan offers. I don't want to invest into paid plans untill the game is ready.

From what I understand, 1 message will be player pos, another player rot, so even if I could manage 1,280 per second per room I would have only 3 other messages left for custom stuff?

Does RPC count as a message aswell?

If I want players to leave blood on the floor when hit, should I do it via RPCs?

What if I wanted to have NPCs? Thats way much more messages for tens of them at once. (If I understand it right)

Will be glad for some clarification.

Matchmaking Teams Logic

$
0
0
Hello,

I'm trying to make a matchmaking system similar to the one league of legends has.
What I have so far is a host that can invite his friends into a room he has created and the he can start the matchmaking by leaving the room and trying to join a random room and saving slots for his party friends. Photon chat is used to send the room name to the party when matched.

My problem is that I want to keep the parties in the same team when they join the random room (10 vs 10 game). Let's say 9 players started matchmaking as a party and found another 9 players that are matchmaking as a party and another 2 players as a party, this would mean that the 2 players as a party won't join the same team.

My question is the following: Is there any best practice to randomly join parties into rooms while splitting the teams and keeping the parties in the same team? Or am I obliged to randomly join the 9 players party to a room of a maximum of 10 players until it is full and then rejoin the 10 players randomly into another room of max 20 players? (That's the best way I could possibly think of that could make this work)

P.S.: I am writing this logic on the client side. Can I write it in some way into a cloud script?
Note: I am using PlayFab as a backend

Thanks in advance!
Elie

Connect() to 'ns.exitgames.com' failed: System.Net.Sockets.SocketException: No such host is known

$
0
0
I keep getting this connection failed error in my unity. Am using the free version of PUN to develop my game and it creates alot of issues while testing. It doesnt always happen, but its pretty common. Could anyone help.

How often is PhotonNetwork.time update?

$
0
0
Hi!

I've got a game called Multiroids which currently runs on Windows Store (Windows Phone & Desktop):
https://www.microsoft.com/en-us/store/p/multiroids-online-2d-space-battle/9nblggh30w5w

In the game you can shoot bullets that travel quite fast so I decided to use RCP calls when a bullet is fired. The RPC contains a time based on PhotonNetwork.time when the bullet should arrive at the destination.

Then I lerp the position of the bullet locally on each client using PhotonNetwork.time which works.

But the problem is that sometimes the bullet starts a bit off even on the local client and it has a bit of jerky movement. I suspect that this might be caused by the fact that PhotonNetwork.time is only updated when a message arrives on the client, is that correct or do you update it even if there are no messages using a prediction algorithm?

If that is the case then I guess I could use a function to sync the local time with PhotonNetwork.time instead or is there a better way?

ipv6 Connect() to 'ns.exitgames.com' () failed:

$
0
0
Hi. I am using latest Unity 5.4.0p1 and latest PUN 1.7.3 free but when i try to connect via ipv6 only network i get this error.

Connect() to 'ns.exitgames.com' () failed: System.Net.Sockets.SocketException: No such host is known
at System.Net.Dns.hostent_to_IPHostEntry (System.String h_name, System.String[] h_aliases, System.String[] h_addrlist) [0x00000] in :0
at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in :0
at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) [0x00000] in :0
at ExitGames.Client.Photon.IPhotonSocket.GetIpAddress (System.String serverIp) [0x00000] in :0
at ExitGames.Client.Photon.SocketUdp.DnsAndConnect () [0x00000] in :0


How to make local changes to other players?

$
0
0
Hi,
In my project I have the main player connecting on PC to stream motion data and any one else that connects(Mobile devices) are only able to observe. What I'm trying to do is be able to switch between 2 meshes on the main character to show body or muscles. I can observe the player no problem but I cannot work out how to get the body components to be able to modify them and change whether they're enabled or not.

Should I stream the gameobjects or transforms I want to change? Can I use CustomPlayerSettings to make the settings for the parts accessible? Any info or pointers would be greatly appreciated.

Player won't spawn with PUN

$
0
0
I am new to this, so sorry if i am leaving out info or i sound like a noob.

Hello, recently i have been following "image" this tutorial pretty much exactly however i am using the built in Unity FPSController. After following the tutorial, i was met with a few problems. Bearing in mind i have no errors that are popping up, but when i click play nothing happens at no so no player spawns, which i found really weird. I tried to tick the box "AutoJoin Lobby" I heard that helped in some cases but for me it didn't and I have been having this issue for a while now. Any help what so ever will be greatly appreciated. Thanks for your time.

This is the script i used, but again apparently there is no errors.

using UnityEngine;
using System.Collections;

public class NetworkManager : MonoBehaviour {
const string VERSION = "v0.0.1";
public string roomName = "VVR";
public string playerPrefabName = "FPSController";
public Transform spawnPoint;

void Start () {
PhotonNetwork.ConnectUsingSettings(VERSION);
}

void OnjoinedLobby() {
RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 4 };
PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);

}



void OnJoinedRoom() {
PhotonNetwork.Instantiate(playerPrefabName,
spawnPoint.position,
spawnPoint.rotation,
0);
}
}






I also created 2 empty's one for a spawn point and one for a network manager which i assigned this script too and then i assigned the spawn point transform to it too.

Regions Ping Always 0

$
0
0
I'm connecting to the NameServer to get a list of all severs and list it to the player with each current ping, but the ping value that i get is always 0.

public override void Show(bool p_show)
{
foreach (Region __region in PhotonNetwork.networkingPeer.AvailableRegions)
{
RegionBar __regionBar = Instantiate(regionBarPrefab);

__regionBar.regionLabel.text = __region.Code.ToString();
__regionBar.pingLabel.text = "Ping: " + __region.Ping; //Always 0
__regionBar.region = __region;

__regionBar.transform.SetParent(regionBarGrid.transform);

_regionBars.Add(__regionBar);
}

base.Show(p_show);

_displaying = true;
}

void Update()
{
if (!_displaying)
return;

foreach (RegionBar __regionBar in _regionBars)
{
__regionBar.pingLabel.text = "Ping: " + __regionBar.region.Ping; //Always 0
}
}
What am i doing wrong, do i have to manually send a ping command ? If so, how do i do this ?

Photon View ID

$
0
0
Hello,

I'm using PhotonNetwork.AllocateViewID() to generate unique viewID. But it is returning a value of 0 the first time, and this is generating an error due to a condition checked by photon if the viewID is less than 1.
I was wondering why the viewID shouldn't be 0 while the AllocateViewID() generates a 0? And how can I evade this error?

Thanks!

Rotation not synced correctly

$
0
0
Hey guys, I am currently having a problem with getting the correct avatar rotation to sync across players.

(note; I am using Unity 5.4 with SteamVR with HTC vive)

Players can join Rooms via Photon perfectly fine, when joined they instantiate an avatar prefab. This avatar prefab syncs the position just fine of the players’ head, and the rotation of your own avatar works aswell. But the rotation of the other player is doing unwanted stuff. Because the of the other player is the inverse of my rotation (e.g. when I look right he looks left and vice versa).

This is my script that I used for the avatar prefab:
using UnityEngine;
using System.Collections;

public class AvatarCopyScript : Photon.MonoBehaviour {

// Update is called once per frame
void Update () {
if (photonView.isMine)

transform.position = Camera.main.gameObject.transform.position;
transform.rotation = Camera.main.gameObject.transform.rotation;

}
}

At the avatar prefab I enabled at Photon Transform View: sync position, rotation and scale.

Thank you in advance
Pjtor

SOLVED - PunRPC on WebGL sent, but not received

$
0
0
In the game i'm making, the player actions are being reported by RPCs

All works fine in the editor, and on android. but for some reason, the RPCs are not executed on the WebGL client (chrome browser). The web client can call RPCs on other clients, but fails to invoke it's own.
No errors, or console logs are thrown.

Here's my implementation:
[PunRPC]
internal void MakeMove(string movesDataStr) {
..Log and execute move
}

internal void TransmitPlayerDataToMaster(string movesDataStr) {
PhotonNetwork.RPC(photonView, "MakeMove", PhotonTargets.MasterClient, true, movesDataStr);
}

Any thoughts why?
Thanks

Solution: Better testing :) and don't use encryption.
In all the frustration of compiling to webGL, I've misdiagnosed the problem. The RPCs didn't work both ways. Only when sending them, i got an error that encryption is not implemented yet

RPCs after user reconnects

$
0
0
Hi,

I'm trying to ask 3rd time here, please :)

Is there any possibility in photon to resend all rpc's which weren't received by photon server. Or at least get their list ? For us this is major issue after user lost connection and reconnects back to game. We want those RPC's to be executed.


Thanks

Photon Handler.Update framerate

$
0
0
Hi! I noticed that when I use PhotonNetwork.ConnectUsingSettings or createRoom the game is lowering the FPS for abount 2 seconds.
Using the profiler I found it was because of PhotonHandler update (deep profiler shows that the most of the CPU usage is generated via some calls to photon dlls from PhotonHandler update).

Is there any way that I can place this updates inside a thread only in that cases to avoid this decrease of the FPS?
Thanks

Best way to detect user disconnects

$
0
0
Hi,

we are working on PVP game on iOS. User can turn off his wifi. Problem is that it took almost 10 seconds for client to realize that it was disconnected and getting OnConnectionFailed: TimeoutDisconnect.

We are using those values to set up photon:

PhotonNetwork.networkingPeer.DisconnectTimeout = 5000;
PhotonNetwork.networkingPeer.SentCountAllowance = 9;
PhotonNetwork.networkingPeer.MaximumTransferUnit = 1500;
Immediately after turning off wifi I get this error:

Cannot send to: 159.8.0.205. An invalid argument was supplied.

UnityEngine.Debug:LogError(Object)
NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Plugins/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1444)
ExitGames.Client.Photon.<>c__DisplayClass138_0:<EnqueueDebugReturn>b__0()
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Plugins/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)
Could it be somehow used to detect disconnect faster ?

I know I can use unity to detect if device is not connected to any network and disable any player interaction, but is there any better way to do this ?

Windows Phone Certification failed

$
0
0
Hello guys i have this problem when submitting app to windows store :

Error Found: The supported APIs test detected the following errors:
This API is not supported for this application type - Api=System.Threading.ThreadStart. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.AesManaged. Module=SYSTEM.CORE, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.SHA256. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.SHA256Managed. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.SymmetricAlgorithm. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Console. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Threading.ThreadStart.#ctor(System.Object,System.IntPtr). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Threading.Thread.#ctor(System.Threading.ThreadStart). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Threading.Thread.set_IsBackground(System.Boolean). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Threading.Thread.set_Name(System.String). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Threading.Thread.Start. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Threading.Thread.Sleep(System.Int32). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.SHA256Managed.#ctor. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.AesManaged.#ctor. Module=SYSTEM.CORE, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.SymmetricAlgorithm.set_Key(System.Byte[]). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.SymmetricAlgorithm.set_IV(System.Byte[]). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.SymmetricAlgorithm.CreateEncryptor. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Security.Cryptography.SymmetricAlgorithm.CreateDecryptor. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Console.WriteLine(System.Int32). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Console.WriteLine(System.String). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Console.Write(System.String). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
This API is not supported for this application type - Api=System.Console.WriteLine. Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=Photon3Unity3D.dll.
Impact if not fixed: Using an API that is not part of the Windows SDK for Windows Phone Store apps violates the Windows Phone Store certification requirements.
How to fix: Review the error messages to identify the API that is not part of the Windows SDK for Windows Phone Store app. Please note, C++ apps that are built in a debug configuration will fail this test even if they only use APIs from the Windows SDK for Windows Phone Store apps.

Photon V1.67 on 1.66 its working with no error

@Tobias @vadim

Viewing all 8947 articles
Browse latest View live