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

How to use Join random room with filter

$
0
0
I have two working maps that i want users to be able to join , however i am currently using joinRandom so users just join rooms they are not supposed to join.
Can you please help me with a simple script that only uses the max players as a filter because one map should have only 2 max players and the other 4

I am building using the DemoVoice-push to talk scene...the one with the baby and teddybear looking characters showing how to use photon voice (max 4 players)

and the other scene was built using the punBasics scene from the photon realtime (max 2 players)

Please help me

Instantiating Objects in Wrong Scene

$
0
0
This is a recent and weird issue, but here's the layout of the game and where the problem lies.

Player 1
Scene 1: Players log in
Scene 2: Players choose character
Scene 3: Objects instantiate here into the game.

Player 2
Scene 1: Player logs in
Scene 2: Player chooses character, but the other players character is shown instantiated and animating in this scene?
Scene 3: In the same map where the other player is, there appears to be no one.

How can I make sure instantiated objects STAY in the map they instantiate for everyone?

Question regarding large 2D Arrays

$
0
0
Hello everybody, :)

I'm curious how to deal with synchronizing large 2D integer arrays across clients. From what I've read, I think the best way is to somehow serialize them into a byte array and send them through an RPC, but I'm wondering how much data can be sent through one RPC.

Here is some information:
- they would be anywhere from 100x100 to 200x200 in size
- each player would have their own 2d array
- the array would not be updated very often, maybe once every 10-15 minutes

Does anyone have any experience with something similar? Any ideas are appreciated. Thank you.

Photon SDK Authentication failed. Check AppId.

$
0
0
when i try to connect to local Photon 3 server client says
Authentication failed. Check AppId.

how to fix that?

tried Photon 2 there no errors in console but it still offline

ah fixed, in your example was differend port

dont use photonnetwork.instantiate (my asset from cloud,so i cant instantiate gameobject in Resour)

$
0
0
my asset from cloud,so i cant instantiate gameobject in Resourcse flolder.i see doc said that you can manually Instantiate and assign PhotonViews.i add PhotonView component.but it not work.i think my way is worng. who can help me?thank you.hope you can know my word.thank you thankyou

Getting SocketException: ConnectionReset when loading level

$
0
0
Hi!

I'm getting the error message "Receiving failed. SocketException: ConnectionReset" in some cases when loading a level (big scene, it takes like 10 secs to load).

I have a PC, a laptot and the PhotonNetwork.automaticallySyncScene flag set to true. If the laptop creates de room everything goes alright but if the PC creates the room and the laptot joins I get that error message.

The laptop is way slower than the PC but I don't know if that's relevant since Photon automatically load the level and handle the sync thread.

Any ideas?

Cutting Off New Players

$
0
0
I'd like to refuse new players from connecting, or even seeing the room as a candidate for JoinRandomRoom etc., after the game launches. I've tried reducing PhotonNetwork.room.maxPlayers to zero, which still doesn't prevent new connections. Proper way?

Thanks.

Avatar Masks - remote animations not masked at all

$
0
0
Hello,

I am working on a first person demo that uses mecanim animations. I have a single Avatar Mask assigned to my animation controller. The Avatar Mask targets the characters head, and I am using the orientation from a mobile device to position the character's head, but it seems the Avatar Mask is just not there for some reason. If I disable the Animator manually in the editor for a clone, it's head will animate/move as expected.

Has anyone run into this issue? Am I missing something really basic??

I am assuming that an Avatar Mask associated with an animation layer will be instantiated with a prefab when PhotonNetwork.Instatiate() is called. Is this correct?

Thanks!

Unity Ownership Transfer

$
0
0
Hello everyone, I noticed that PUN provides the ownership transfer service - http://doc.exitgames.com/en/pun/current/tutorials/ownership-transfer - However I'm having trouble with the actual request code. When I try to store the PhotonPlayer as a variable in the requesting script, I get an error in Unity: [GetComponent requires that the requested component 'PhotonPlayer' derives from MonoBehaviour or Component or is an interface.]

What I'm trying to do is have objects in a scene that can be controlled by a specific player. Instead of instantiating it for automatic ownership I would rather be able to change object ownership at runtime for various things: Let's say there's a turret in the scene, I would like a player to be able to 'hop on' and start using it.

Also, if there is a better and/or more efficient way to do this I would like to hear those suggestions as well. I'm new to networking and I'm having a lot of trouble.. thankfully there are a lot of great resources online for this stuff! I've read a lot about RPC stuff but I feel that since the objects I want to control are moving around a lot that I would like them to be treated as controllable with the PhotonView updating position + rotation.

Thanks in advance,
Zach

Reconnecting to a Photon room after client timeout

$
0
0
Hi,

I am trying to re-establish a connection to photon for players when they lose connection to the server. I'm only roughly starting out with this so far, but hit an issue I'm not sure about. So when I get notified that Photon has disconnected due to client timeout, I have tried making a call to ConnectWithSettings() again to reinitialise everything, but I'm getting an warning message from Photon:

ConnectUsingSettings() failed. Can only connect while in state 'Disconnected'. Current state: 6

I've looked all over the documentation, but I have no idea what state 6 is or why it's set to this.

I'm assuming this isn't the way to reconnect to the server anyway judging by this output, so what should I be doing? I have cached the room name already and will call PhotonNetwork.JoinRoom(_roomName); once I have reconnected again.

Can you add distance based messaging?

$
0
0
Hi
I'm pretty sure after searching on the forum that it's not possible to send messages only to certain players based on distance. You only have the option of all, others and specific variable.

This is bs, because if you have 100 players on a terrain and you only want to get messages from the ones that are 100 meters near you, you can't. You can try to work around it using grids, but that's bs too. Why? Because you could be 1 meter away from each other but on a different tile and you won't see each other until it steps into yours. Then you have to do all kind of fancy stuff to be able to trick the system and simulate a distance based messaging.

This on the server literally takes 1 second to implement. If x-player < distance from location, send message to this player.

So please, unless i'm mistaken and this is already possible on photon cloud, could you add it as an option when we send events?

Switching from mobile data to WIFI causes disconnect

$
0
0
Hello folks,

As the title says, whenever I switch from mobile data to wifi the game keeps going normally and then I get disconnected after about 45 seconds.
Is there anything in photon that might cause this problem?

Any help is much appreciated.

Thank you

How do I track position and rotation for giant 3D rigidbody every player can affect?

$
0
0
Imagine 3D team based soccer with a huge ball with a Rigidbody on it. Every player can hit the ball. How do I make this work out in Photon?

Thoughts on how to approach creating a billiards (ball pool) type game

$
0
0
Hey all,

I have been playing about with PUN and TrueSync trying to get a feel for Photon. I was thinking about how one might create a multiplayer pool game. If TrueSync is deterministic when calculating physics, would this be the better approach to creating a pool based game seeing as there would be a lot of things bouncing around?

As far as I see things, I don't mind if the master client is the one that calculates everything and the remaining clients are updating from this? Is this possible and how might I go about it or could anyone point me to any resources I can read into further.

Thanks in advance,

Michael

Is it possible for room.PlayerCount to be the same for two joined players

$
0
0
Hello, i am making a 4 player board game, in which depending on your id (a value between 0 and 3) you are the blue player or the green player etc.
The id of the player is set in the method OnJoinedRoom.
Here is a segment of the code:


public override void OnJoinedRoom()
{
int playerId = PhotonNetwork.room.PlayerCount - 1;
SetCustomProperties(playerId);
}

private void SetCustomProperties(int playerId)
{
EXTHashtable customProperties = null;
customProperties = new EXTHashtable() { { "id", playerId }, { "username", username }};
PhotonNetwork.player.SetCustomProperties(customProperties);
}


Ok what happened while testing is that two players were controlling the same color, which could only happen if they had the same playerId value.
Also ,I don't know if it helps, some players could see tha name of the double controller player as either the username of the one player (which is the value from the "username" property) or the other player. The two aforementioned players saw the other person's name in their device.

1. One assumption I have is that for some reason both players when they joined, had the same PhotonNetwork.room.PlayerCount value. No one had exited the room in the meantime, the playerId is fixed accordinlgy when a player exits.
2. The second assumption is that while testing these clients were already in a room before (everything was working there), which they left and then joined another room. Is it possible that the new PhotonNetwork.player.SetCustomProperties(customProperties) did not change the previous "id" property with the new one for some player?

Furthermore, one of the two players had some slow internet issues, i don't know if that would affect anythting.

Also:
This does not happen often, in fact I cannot reproduce it after an hour of testing, trying to click the join room button simultaneously on two clients in order to reproduce this problem. Furthermore, after almost 2 months of development it is the first time i have encountered this problem.

Any help would be appreicated

Dedicated Master Client vs Photon Server

$
0
0
(Sorry for long looking post, It is actually really short in context)

Hello, I am new in network programming and concepts. However I have worked with PUN before, several times. I am familiar with PUN way of synchronizing things. RPC and Serialization etc.

I want to achieve a full-authoritative and future scalable server architecture that works in dedicated servers and manages room/lobby services for clients.
The server architecture that I am planing is, similar to the games like Rust/ARK/Hurtworld etc. However the game will consist 7v7 matches, (not 100ish like them, 15 max), but will also have mechanics that alters the world. (like building something to world or altering terrain by mining etc). Gameplay would resemble Rust in visuals, but the mechanics would differ. However server architecture should be very similar to those games. Meaning it won't be Peer to Peer.

To start: "I know" that I have to use Photon Server for these type of things. So I can code server side logic right? The authoritative architecture, the persistent world, user&world databases, server management all these should be done in the server side if I am not mistaken. However as i said in the beginning I have only worked with PUN before, and only client-server architecture I know is that: one trusted client (user) hosts the game and others joins to him.

Now. I can learn Photon Server and server side programming. (hell, even started learning it now. It is kinda similar how PUN does it's work. Operations and Events instead of RPC's etc.) However, to create a sustained server architecture, I have to learn and practice it in depth. Meaning: I need profound knowledge to create a commercial product server.

So for the initial prototyping phase of the game, I don't want to focus my workload to learning and creating the Photon Server. Instead I have come up with an idea.

What if I create Unity instances in dedicated servers, that creates(hosts) rooms with PUN (cloud). And other players around the world join to these hosted matches? Dedicated servers would simply be "non-player" master clients that hosts the games and let other players join to games. And also does server stuff by itself.

So, I would create a standalone "server-only" Unity project file, that can manage servers, manage databases, create and sustain persistent worlds. All the features that won't be in user clients, can be in the server(host/master) client's project. And I can manage all these in the dedicated server inself.

So to clarify: A "special" unity project that runs the game simulation, manage world, manage database, manage players, manage everything and run everything, will be the master client. Will host the game. And "client" unity projects will join to this game, and will "send" inputs for authoritative architecture. Server will "accept" these inputs, simulate it and send it back to clients.

To more clarify: Everything that Photon Server should be handling will be handled by PUN and Cloud relay servers, RPC's and Serialize funtions. So I wont hustle my workload with the server programming. Win-Win. Right?

I know, It is probably not the best solution out there. I haven't found any single document/topic about it. So It may be a really stupid idea to begin with.
But I wonder. If I start with this type of architecture, when I get pass the prototype phase, would it be easy to implement Photon Server to server side? Would it be easy and work efficient to follow this approach? Or should I stop whatever I am doing, and start learning Photon server?

PhotonNetwork.Instantiate vs RPC Instantiate

$
0
0
Hi there,
I'm curious as to what the main advantages would be for using one over the other and when should each of these be used. I could spawn an object using PhotonNetwork.Instantiate or I could just call a RPC that spawns that object for all clients locally. What's better and why?

Problem in Unity5

$
0
0
I was using my PUN plugin without any error, until I upgraded to Unity 5.

Now I have the following error when I build for Windows Store (Phone 8.1)
Plugin 'Photon3Unity3D.dll' is used from several locations:
Assets/Plugins/Metro/Photon3Unity3D.dll would be copied to <PluginPath>/Photon3Unity3D.dll
Assets/Plugins/Photon3Unity3D.dll would be copied to <PluginPath>/Photon3Unity3D.dll
Please fix plugin settings and try again.

UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.HostView:OnGUI()

&
Plugins colliding with each other.




Please help ASAP

Synching scene objects that don't move often?

$
0
0
I have a game with environmental objects like rocks that can move around from time to time.

When new players join a currently running room the rocks are seen where they were instantiated and the last update to their position before the player joined the room is not seen. The objects are set up as "unreliable on change" and their correct position is only seen to the new players if the object is moved while they are in the room.

Is this intended behaviour or am I missing something in the settings somewhere?

If it is intended behaviour what can I do to make sure scene objects that move rarely are seen in their real position to new players that join a room?

Does the last OnPhotonSerializeView get cached somehow so that new players that enter a room that is in-progress can get the latest game state?

Thanks.

Unity profiler: SendOutgoingCommands 98% CPU Usage.

$
0
0
Hi devs. I have one big problem, last time my game have bad freeze, my profiler write: "SendOutgoingCommands" Use 98.4% CPU. I not understand why. Need help. Thank and sorry my English.
I am use Unity 5 (5.0.1f1)
Please see attached image.
Viewing all 8947 articles
Browse latest View live


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