Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all 15755 articles
Browse latest View live

Instantiated object moves to fast?

$
0
0
Hey there,
heres a code of a photon instantiaded object. Other players can just see it in the moment it spawns but then it starts to move really fast and the other players can't see it anymore.



So.. what's wrong?


How to kick players?

$
0
0
So i know that you use PhotonNetwork.CloseConnection(PhotonPlayer kick) to kick players. But how do you kick players using their player name.

Performance and memory allocations

$
0
0
I know this may be a lot to ask, but is it possible for you guys to make some performance and memory improvements in Photon Voice? Right now, it appears *everything* happens on the main thread and memory is allocated every time voice data is encoded/decoded.

First, I would ask that you *please* use some buffer pools rather than allocating memory since that can lead to some spikes every time someone speaks. I was going to add this myself, but I wasn't 100% sure if the sendFrame immediately uses the buffer (or copies it, or serializes it), or if it is queued to go out on another frame. If it is immediate, then I can acquire a buffer, send the frame and then release the buffer. If it goes out "later", then it gets more complicated.

Second, would it be possible to move the encode/decode calls from the Opus wrapper to a background thread? I know this introduces some added complexity, but since this is happening on the main thread, it can eat up ~9ms everytime voice data needs to encode. For most people, that may not seem like a big deal, but we're working on a VR app and need to maintain at least 90fps.

All of these little spikes and wasted ms add up and these improvements would help significantly. I can probably make these changes myself, but it will make future integrations more of a pain.

Thanks!
Mike

The connection to the master server does not work.

$
0
0
Please help me.
The connection to the master server does not work.
"PhotonNetwork.ConnectUsingSettings(“v1.0“);" in the place of, "PhotonNetwork.connected: False " comes out error that.
In fact, even when you use the "MasterServer.ClearHostList()", I get an error that "Failed to connect to master server at 67.225.180.24:23466".
Was examined various, information is in trouble not found.
Will not you help.

How to serialize a custom class to send to clients via RPC?

$
0
0
Each player has a PlayerControl class, and I want every client in a room to have each player's instance of their PlayerControl class. This will allow the game's GameRules class to send RPC's and affect the values of each player's PlayerControl class. I want to send the PlayerControl via RPC when starting the game, but I don't know how.

I have looked at forum posts from many years ago and also studied the CustomTypes.cs script. At first I followed the answer in https://forum.unity3d.com/threads/pun-serialization.405031/ , marked my PlayerControl class as serializable, and used my newly created Serialize and Deserialize functions, but came up with an error.

I'd like to try out the CustomTypes.cs method of serializing a custom class and registering the type as it seems more straight forward. Anyone have any tips on how to convert the examples in CustomTypes.cs to allow serializing a custom class? In the custom type examples, they are mostly dealing with float values when serializing Vectors and quaternions. How would it be different if I wanted a custom class to be serialized? I appreciate the help in advance.

customize player offline and instantiate online

$
0
0
Hello everyone :) i try learn photon in unity (i'm intermediate in unity ) and i have a little probleme. I have a offline (no connecting to internet & server) scene and online (play with 2 playesr 1vs1 ) scene. In my offline scene, i would like customize my player (add different weapon, helmet,...) and instantiate this in my online scene (PlayerA =/= PlayerB). How to make this please.. ?
(for more understand i insert a pictures :) )

thanks so much

IPv6 for Unity iOS Exports

$
0
0
Apple now requires iOS apps to support pure IPv6 connections.
We tested PUN v1.75 and it supports IPv6, including the "Best Region" setting.

If you use the Photon Cloud, you only have to make sure your PUN version is up to date.
If you run a Photon Server, you might have to update.

Test All Builds

Unity's support for IPv6 begins with 5.3.4p4. They posted about adding IPv6 support.

Several versions of Unity do not successfully support IPv6, so you should test each build.

If you get a client-side error like this, your client needs an update;
Connect() to 'x.x.x.x' failed: System.Net.Sockets.SocketException: Network is unreachable in a IPv6 network.

Test Procedure

Read "Test for IPv6 DNS64/NAT64 Compatibility Regularly" to learn how to test IPv6 support easily.

We do this for PUN before release.
Make sure there is not some other plugin failing!

Handling Rejections

We know that some apps got rejected, despite using PUN v1.75.

If your app gets rejected, please get in touch with the Apple review team. Point out that you're using PUN and that we and you both tested the netcode versus their own test procedures.

Explicitly point to their own test-description page. If our tests fail and theirs doesn't, we have to figure out what we have to test! At the moment, it's unclear.

Cloud and Server

The Photon Cloud itself will not be directly available via IPv6 in the short term. Apple's requirement is that clients can cope with IPv6 addresses, if there is a "IP translation", as described in their article.

For anyone using Photon Server (OnPremise), this means, you can likely continue to run it as IPv4 service.
If you want to setup a true IPv6 server, we have some docs for that.



Get Photon Unity Networking in the Asset Store.

Friends and channels questions

$
0
0
Hi, I'm adding the Photon Chat API to my Shiva engine plugin, and I'm wondering how these friends and channels stuff works actually.
When you connect to the chat server (region -> nameserver -> front-end server) you use an username (userid), questions:
1) how do i assert or check that username is unique?
2) if I add a friend, where is the friendlist saved?
3) is this friendlist from (2) a forever list or just for this chat session (for that username)?
4) what happen if i disconnect or i change the username?
5) why when i subscribe to a channel then this channel does not appears (not in another client nor in the same client who subscribe) using the get public list function?
6) users from photoncloud server and photonchat servers are different, the find friends function uses a list of friends, that implies i have to save it somewhere from the first time a client start the game and each time it adds or remove a friend and keep it synched with all the platforms this user may use, is that a proper method to do this stuff?


LAN with PUN?

$
0
0
Hey, im trying to make a LAN setup with PUN.

Im trying to use the method "PhotonNetwork.ConnectToMaster", cause to my understanding, I cant use the Photon Cloud for a LAN setup, cause they still need to be connected to the internet, however, as long as Photon can actually connect to some type of server (in this case, something local, like the users computer or router), then it can use them as the "master server and client", so that other computers on the same network can connect and see eachother run around.

I tried 127.0.0.1 (localhost), and my computers IP, and my routers IP, but they all give me the same error...
ERROR: Receive issue. State: Connected Exception: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host.

WARNING: InternalReceiveException while connecting to: 127.0.0.1:144. Check if the server is available.

Maybe im looking at it wrong, im new to using PUN, so does anyone who might know how to setup a LAN with what im trying to achieve, mind explaining to me what I might be able to do, if what I am doing is wrong? And if not, provide a possible solution to setting one up?

Reconnecting on mobile after backgrounding

$
0
0
Hello!
I'm trying to catch the situation of our game getting foregrounded after some time in the background and reconnecting to master (and possibly game server). At the moment, in Unity, I add the hook OnApplicationPause to a monobehavior and check we are unpausing. This triggers as normal, but when I check the LoadBalancingClient.IsConnectedAndReady it returns true regardless of the actual state. Not until I actually try to send data or trigger an API call do I get a 'peerstate: disconnected' error. At this point the boolean IsConnectedAndReady now reflects the true state of the connection.

What should I do to be able to query connectivity?

Hosing "Best Region" issue

$
0
0
I am developing an app for Android phones.

I notice that if I set Hosting to "Best Region" and Enabled Regions to "Everything", then the app running on my development PC does not see the same set of rooms as the app running on the phones. When this C# code is called on the PC, it prints out the message "zero rooms seen from lobby"

RoomInfo[] rooms = PhotonNetwork.GetRoomList();
bool inLobby = PhotonNetwork.insideLobby;
if ((rooms.Length == 0) && inLobby)
{
Debug.LogWarning("zero rooms seen from lobby");
}

The apps running on the phones can see rooms (each other's rooms). And if I build the app with Hosting set to "Photon Cloud" and Region set to "US" then the PC is able to see the same rooms as the phone apps, and the above message is not printed.

I would not have expected this behavior because both my PC and my development phones are in the same place and connected to the same WiFi network. Is this the expected result, or am I doing something incorrect?

Thanks

- David

Bolt and VR?

$
0
0
I've been able to get PUN working with the Vive in Unity, but I'm having trouble moving over to Bolt. Are there any simple samples/examples out there? The thing that makes it complicated is that either the player object needs to be a child of the VR rig camera, or vice versa.

Thanks!

Multiple scenes loading ontop of eachother

$
0
0
Using PUN 1.75

This is an odd bug. In my game there are 3 scenes. The MainMenu, LobbyRoom, and Game. The game boots up in the Main Menu. When a user "Creates a Room" they make a Photon Room and load into the LobbyRoom scene. Once all players ready up it loads into the Game scene. In the Game scene all players can vote to "Restart". If they do they load back into the LobbyRoom scene.
The issue is that if the player(s) "Restart" and a new player joins the Photon Room (or a player leaves and re-joins) all of the players who were in the room before the new player joined "Freeze" (run very slowly) and get messages in their console that "QueueIncomingReliableWarning. This client buffers many incoming messages...".
And the new player (and only the new player) that joins sees both the LobbyRoom scene & Game scene loaded on top of each other. (The "QueueIncomingReliableWarning" might only be happening because we have quite a few objects that spawn in in the same position and are trying to re-orient themselves).

I don't actually see 2 scenes loaded in the "Hierarchy", but all of the objects that were loaded in the Game scene are loaded in.

My first guess was that it was remembering both scenes being loaded and syncing both scenes. But as I'm writing this I have a second guess. All of the objects that we load in we use PhotonNetwork.InstantiateSceneObject(). Is it possible that these objects are still in memory after we switch scenes? (but for some reason when we actually LoadLevel for the players in the room they are "destroyed")

We have this variable set in the MainMenu: PhotonNetwork.automaticallySyncScene = true;
And to transition between scenes only the MasterClient loads the next scene: PhotonNetwork.LoadLevel(SceneNameRoom);

GameObject Structure needs to be set the photon view in a child...

$
0
0
Hi you,

i got a big problem and need support. I programmed and build a very special car with car physics.
Meshes and the Visual part is seperated from physics and physics are also seperated to the body-part.

That means for a short, easy graphical overview:

- Car
- - Car Body (with Rigidbody, Controller,Lights,Checkpointscript,....)
- -Car Physics
- -Car Suspension
- -Car Wheels

and some joints, ....

My car is working very well, physics are phantastic - and i am ready to build the first network version with photon.
And now i run in troubles.

The beginning of problem is that photon needs a photon-view in the root of this prefab.
For sure.... of course i will add a photon-view in the root (\Car).

Cars are spawning of course- but nothing appears. why?
Because the root-Gameobject is not moving.....its the only a holder for the child-gameobjects.

So the photonview is syncing nothing......
Of course i read the manual and checked out that the root of a prefab is needing a photonview - but in my case the "car body too".

So ive tried to add a empty photonview to the root (\Car) and add a second one (with observed movementsmoothing) to the car-body.

That works.... but not really perfect - because the physics, the wheels and the suspension are not sync now.
Crap - and completly clear.

But what should i do now?
Any Ideas?




mike

No master client in Photon Turn Based (Unity 5.4)

$
0
0
Hi! I use Photon Turn Based for my project and faced with the following problem :
2 players in room (max 2 players), one of them is MasterClient nothing special.
Then master client player close the application and sometimes master client does not switch to another player(OnMasterClientSwitched don't call) So now we have a room with one player and no master сlient... If a new player will go into the room, it will have two players and no master client.

I tried to switch the master client before ApplicationQuit, but the bug is still there.
 void OnApplicationQuit()
{
if (PhotonNetwork.room != null)
{
{
PhotonNetwork.SetMasterClient(PhotonNetwork.otherPlayers[0]);
}
PhotonNetwork.networkingPeer.SendOutgoingCommands();
PhotonNetwork.SendOutgoingCommands();
PhotonGameManager.I.SendSuspend(true);
PhotonNetwork.LeaveRoom();
}
}

Photon Server and PhysX.Net cant find DLL file

$
0
0
Hi,
I have been working on a projekt for awhile now and everything works fine until the server side AI implementation. The idea is to run PhysX.Net (Wrapper for PhysX) to handle collision detection and so on.
I installed PhysX.Net it with NuGet and made a basic test, everything compiled just fine. When i tried to run it with Photon Control, once i create the PhysX.Net objects and let it run for a short amount of time i get this error:

"ERROR [ApplicationBase][ 1171] [(null)] - System.IO.FileNotFoundException: Could not load file or assembly 'PhysX.Net.DLL' or one of its dependencies. The specified module could not be found.
File name: 'PhysX.Net.DLL'
at RegionServer.Implementation.PhysX.PhysXManager.SetupPhysX(Single gravity, Boolean enableDebugVisualization) ... ..."

So my first thought was that i need to add the DLLs to the bin folder, which i did which did not help. Since i have successfully run PhysX.Net in another C# project i remember that i had to get "msvcp120d.dll and msvcr120d.dll" so i tried that too. I still get this same error. After an hour of trying to figure out whats wrong i ended up putting the dlls in all relevant folders, i even put them in System32. I still get this error...

Any idea what can be wrong?

Problem with respawn

$
0
0
Hey there,
i got a problem with respawn. I'm developing a game for vr so you'll understand that it's not recommend to use the common way.

Every player has got a localplayer which is already in scene and does not get instantiated. When a player joins a room he gets two hands and a head. On the head there is a value for healtpoints.

When the healthpoints are <= 0 the LOCAL player should go to a specific position.

Here's the code:

void PlayerDeath()
{
if (curPlayerHealth <= 0)
{
GameObject localPlayer = GameObject.FindGameObjectWithTag("Player");
localPlayer.transform.position = new Vector3(0, 15, 0);
}
}

So this code is on the networked head. If MYhealthpoints fall down to 0 i get teleported to the position but if i kill another player nothing happens.

How can i solve this problem?

Periodically throwed exception when in a room

$
0
0
Hello!
I use PUN 1.76 with Photon Cloud.
When in a room it periodically throws exception (not permanent but very often):

IndexOutOfRangeException: Array index is out of range.
PhotonStream.ReceiveNext () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonClasses.cs:1006)
PhotonView.DeserializeComponent (UnityEngine.Component component, .PhotonStream stream, PhotonMessageInfo info) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:378)
PhotonView.DeserializeView (.PhotonStream stream, PhotonMessageInfo info) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:340)
NetworkingPeer.OnSerializeRead (System.Object[] data, .PhotonPlayer sender, Int32 networkTime, Int16 correctPrefix) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:4102)
NetworkingPeer.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2394)
ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (System.Byte[] inBuff)
ExitGames.Client.Photon.TPeer.DispatchIncomingCommands ()
ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands ()
PhotonHandler.Update () (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:156)

There is no my functions in call-stack, so i don't understand what it means. Can you help?

Why is EmptyRoomTtl commented? I Need it!

$
0
0
I want to set EmptyRoomTtl to 0 when PlayerTtl is not 0 in creating game. but RoomOptions.EmptyRoomTtl is commented in LoadbalancingPeer.cs line ~1341.
In other place, i saw this:

if (roomOptions.PlayerTtl > 0 || roomOptions.PlayerTtl == -1)
{
op[ParameterCode.CheckUserOnJoin] = true;
op[ParameterCode.PlayerTTL] = roomOptions.PlayerTtl;
op[ParameterCode.EmptyRoomTTL] = roomOptions.PlayerTtl; //Oops, this line is all my problem!!!!!
}

Communication between several servers.

$
0
0
Hello!

I want to organize communication between several servers (for example using some Main Sql Server).
Target: first friend on server "1.1.1.1" wants to invite second friend to new room. But second friend is on another "1.1.1.2" server (another physical machine with own Photon Server). First friend knows only ID of second friend.

My solution:
{
I think about using Main Sql Server to send/recieve requests to/from servers. And I can't just connect clients to sql server, because it would hard for main server have a lot of clients. It means that I have to change Photon Server to it would:
1)get IDs of current players (who now play on Photon Server)
2)send messages to main server with current IDs
3)recieve messages from main server and send these messages to current players (message smthg like "call method ConnectToFriendRoom(int ID, string AnotherPhotonServerIP, string AnotherRoomName)")

Main Sql Server has to recieve messages between connected servers with properties "ID" (of second friend), "AnotherPhotonServerIP" (of server where send friend has to connect), "AnotherRoomName".
}

Do I correctly made up the solution or there is another solution?
How to solve my target?
Viewing all 15755 articles
Browse latest View live


Latest Images