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

Is there a way to save all game data (PhotonViews, PRCs, Events) to replay the game later?

$
0
0
Hello,

We're trying to implement a "replay" feature to allow players to share replays of exciting games that can be viewed later.

We're hoping to get the complete game data in a large string (or JSON) - which would be about 200KB per game, according to our calculations - upload it to our custom server, download it when a player wants to watch the replay, and replay the complete game with dummy-actors. We have the upload and download part figured out, the problem is just getting the game data and replaying it.

Is there a way to get the data of all OnSerialize calls from custom PhotonViews, all RPCs and all Events along with the timestamps? How would we replay the game?

Thanks in advance,
Sebastian

Dose Quantum support ACT Game

$
0
0
We are currently making a ACT Game.
And Im looked Quantum Doc before.
(Sorry I dont have quantum forum authority right now)
And I didn't find how to implement the following features.
1. How to combine Physics3D to Custom Animators Bone Transform. (let collider move along bone transform automatical)
2. Does custom Animator support BlendTree + RootMotion? (RootMotion I know is supported)
3. What this line mean at Custom Animator Known Issues : "No support for hierarchical states"

Reconnect a match with old rpcs but remove the objects spawned?

$
0
0
So the problem prior to this was when players reconnected to a match, all rpcs(casted by him) were not recalled when he rejoined the match. So to further explain that,
If I am in a match with several others and i leave the match. All rpc calls i made prior to leaving is cleaned off.
When I rejoin that same match, I dont get those rpc calls back or atleast doesnt redo those RPCs causing issues in game.

However a new player could join the on going match with no issues at all.

Now to the problem we are facing now after sort of fixing it.
After several contact with the photon devs via email, we sorted to use
roomOptions.CleanupCacheOnLeave = false
, Now this works in the sense if I rejoin I get back all those calls that I made prior. However now there is another issue. When I spawned in prior to leaving I had my player model spawned in via photon. Now as I reconnected, that model was not removed and instead now there is 2 player models spawned instead of just 1.

Any way I can keep the feature of the RPC calls remaining even after I leave but deleting the objects I spawned prior to leaving a match? It is a major issue for us and any assistance is very much appreciated. Thank you

As a side question, can we use interest groups with RPC?

Please can someone help me with this connection error

$
0
0
I keep getting this error in console and I have no idea what it means? Thanks: Operation failed: OperationResponse 225: ReturnCode: 32760 (No match found). Parameters: {} Server: MasterServer UnityEngine.Debug:LogError(Object) NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1146) ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[]) ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)

I have an Error and I dont know what to do. Please help me!

$
0
0
Hello

I keep getting this Errors when I start the Game and I dont know what to do. Can anybody help me?

1.
TimeoutDisconnect while connecting to: 92.38.154.34:5055. Check if the server is available.
UnityEngine.Debug:LogWarning(Object)
NetworkingPeer:OnStatusChanged(StatusCode) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2328)
ExitGames.Client.Photon.<>c__DisplayClass109_0:<EnqueueStatusCallback>b__0()
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:161)

2.
Can't execute Disconnect() while not connected. Nothing changed. State: ConnectingToMasterserver
UnityEngine.Debug:LogWarning(Object)
NetworkingPeer:Disconnect() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:891)
NetworkingPeer:OnStatusChanged(StatusCode) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2356)
ExitGames.Client.Photon.<>c__DisplayClass109_0:<EnqueueStatusCallback>b__0()
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:161)

this is my Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class NetworkManager : MonoBehaviour
{
GameObject mainMenu;
//Server Verbindung Aufbauen
public void Connect()
{
Debug.Log("Connecting");
PhotonNetwork.ConnectUsingSettings("v01");
}

void OnConnectedToMaster()
{
Debug.Log("Connected to Master");
PhotonNetwork.JoinLobby();
}

void OnJoinedLobby()
{
Debug.Log("Connected to Lobby");
mainMenu.SetActive(false);
PhotonNetwork.JoinRandomRoom();
}

void OnPhotonRandomJoinFailed()
{
PhotonNetwork.CreateRoom("null");
}

void OnJoinedRoom()
{
Spawn();
}

public void Spawn()
{
float randomX = 0; //Random.Range(-8f, 8f);
float randomY = 0; //Random.Range(-8f, 8f);
PhotonNetwork.Instantiate("Player", new Vector3(randomX, randomY, 0), Quaternion.identity, 0);
}
// Start is called before the first frame update
void Start()
{
mainMenu = GameObject.Find("MainMenu");
}

// Update is called once per frame
void Update()
{
Debug.Log(PhotonNetwork.connectionStateDetailed.ToString());
Debug.Log("Other Players: " + PhotonNetwork.otherPlayers.Length);
}

public void SaveNickName()
{
string nickName = GameObject.Find("NickNameText").GetComponent<Text>().text.ToString();

PhotonNetwork.player.NickName = nickName;
}

public void LoadScene(string sceneName)
{
PhotonNetwork.LoadLevel(sceneName);
}
}

Problems with photonView.IsMine

$
0
0
Hi everyone, apologies in advance if I'm asking simple questions, I'm still very new to this and to coding in general.

I was able to get things working following the basic tutorial from Photon, but now I'm trying to implement it into my game, specifically getting other players to see each other while using the First Person Character Prfefab from the standard assets. From what I can find on the tutorials and on this forum, I have to use:

if (photonView.IsMine)
{player controls}

However, I'm not sure what part of the script needs to be enclosed by the if statement, or if my understanding of the process is even correct. I've added using Photon.Pun and Photom.Realtime. Do I need to write a customer character controller script?

Can we have separated masters for different interest groups?

$
0
0
I want to split my connected players in different maps, most of the data won't be shared between each map. I'm think in using interest groups for this, but each map needs a master to decide things. So when using interest groups is there a separated master of each group? Or they share the same Master?

Photon Resources RAM Usage

$
0
0
Hello,
I have 15 car and 15 prefab in resources folder. I'm spawning single car but memory profiler show all car textures uses RAM. How can I prevent that? Thank you.

How to create room using Button onClick listener?

$
0
0
Disclaimer: I just started with Photon 2 so yes, this question is totally stupid.

Here is what I am trying to do:

1. Create a script with the following code:
public override void OnConnectedToMaster() {
    Debug.Log("Connected to Master");
    PhotonNetwork.CreateRoom(roomId.GetComponent<Text>().text);
}

public override void OnCreatedRoom() {
    Debug.Log("Room Created");
    // code after room created successfully;
}

public override void OnRoomListUpdate(List<RoomInfo> roomList) {
    Debug.Log(roomList.Count + " Rooms");

    foreach (RoomInfo room in roomList)
	Debug.Log(room.Name);	
}

void CreateRoom() {
    Debug.Log("Connecting...");
    PhotonNetwork.ConnectUsingSettings();
    Debug.Log("Connected");
}

void Start() {
    GetComponent<Button>().onClick.AddListener(CreateRoom);
}

2. Attach this script to the CreateRoom Button.

When I click the the button, The output in the console is
Connecting...
Connected

The OnConnectedMaster() callback subsequently the other callbacks OnCreatedRoom(), OnRoomListUpdate() are not called after ConnectUsingSettings(). What am I doing wrong?

Also, I am looking for code examples for PUN 2. If you have any resources please share.

Centralised transform views

$
0
0
Hey! I'm new to all of this so if this question is dumb feel free to say so. :smile:

I want to enable multiplayer on a map that contains moving objects. In this case, those objects are autonomous cars that players could collide with when crossing the street.

From what I've learned watched some videos so far is that someone needs to own that object and tell everyone where it is and what it's doing.

I don't want to have a dependency on a user and would much rather have this work even when the owner leaves.

So I suppose ownership could be transferred to another player for example. But if this player has a crappy connection it'll ruin the experience for everyone.

Is there a way to make this managed by something other than a player? So a server decides what goes where for example?

As a follow-up/bonus question, is there a way to preserve state? So when everyone leaves and then comes back you still see everything where it was?

I hope these questions make sense.

Thank you for your time.

One big server not rooms [SOLVED]

$
0
0
Found my answer. You can delete this.

Event/RPC Sequence

$
0
0
Hello!
Apologies if this has been asked before - couldn't find anything. I'm using manual instantiation via Events and running into an issue where my RPCs are being received before my Event. Hopefully this demonstrates the problem,

'Sender':
- Raises event with instantiation/ photonView data.
- Other components also send any additional 'initialisation' data via RPC after this event was sent.
- Other components also start sending OnSerialization.

'Receiver':
- Receives RPC calls. Can't handle them since we haven't set up the object.
- Receives OnSerialization for viewIDs it doesn't have.
- Receives event, sets up the object.
- Future OnSerialization calls work fine.

I incorrectly assumed that these events/ rpcs would be sent and received in a sequence. So I'm wondering what would be your recommended way of handling this?

Personally I'd rather have the RPC calls be cached until the events have been handled, this seems like the option that creates the least extra data to be sent across.
Another option is to send any additional initialisation data along with the event. Kinda difficult to do nicely since there could be any number of components with additional data.
Last option I could think of is having the 'receiver' send a message back to the 'sender' saying "hey im ready to receive stuff now" and then send all the initialisation data. Creates a bunch of delay and overhead but quite simple.

Any input would be appreciated!

Is there any way to debug AsyncRandomLobby?

$
0
0
Hi,

Currently, I'm trying to implementing an async turn-based game using photon realtime + playfab.
I've followed all tutorials & discussions I found on how to set up games like this.
Everything works fine except it doesn't follow this behavior:

Room entries stay in the lobby list (available for matchmaking) for one hour after they are removed from game servers. Rooms need to be visible and open to be considered in the asynchronous matchmaking.

Scenario 1:
- Player A creates a new room
- Player B join a random room
- Player B joined successfully

Scenario 2:
- Player A creates a new room
- Player A disconnected
- Player B join a random room before emptyRoomTtl
- Player B joined successfully

Scenario 3:
- Player A creates a new room
- Player A disconnected
- Player B join a random room after emptyRoomTtl and before 1 hour after A disconnected
- Player B can't find a room

Scenario 4:
- Player A creates a new room
- Player A disconnected
- Player A rejoin the room after emptyRoomTtl
- Player B join a random room
- Player B joined successfully

Scenario 5:
- Player A creates a new room
- Player A disconnected
- Player A rejoin the room after emptyRoomTtl
- Player A disconnected again
- Player B join a random room after emptyRoomTtl and before 1 hour after A disconnected again
- Player B can't find a room

I believe both in Scenario 3 & 5, Player B should be able to find the room Player A created because I use AsyncRandomLobby, but this is not the case.

This is super confusing since I believe i've set up everything according to the guides but there's not way for me to debug what's wrong since I can't see lobby stats or anything. I also track the RoomsCount found in app statistics, basically in Scenario 3 & 5, RoomsCount already goes to 0 when player B trying to joins, is this a correct behavior?

LoadLevel/autoSyncScene not working for Editor

$
0
0
Hello,

Have been using PUN 2 for weeks now, everything running smoothly. I'm at the point where I'm starting to change scenes using LoadLevel, and have gotten some mixed behavior. AutoSyncScene is set to true on all clients. And I am calling LoadLevel from the master client. When I build to Android/PC, this is working as expected and the non-master clients follow the scene changes, but, if the non-master client is the Unity Editor, it doesn't.
The regions are the same and the Editor is connecting to the same room completely fine.
(Also, the Editor loads all scenes/clients fine when it's the master)

Has anyone else experienced or know why it might be happening?

Thanks

Is there an official/unofficial Photon Discord server around?

$
0
0
I'd love to join it~ EDIT: Made an unofficial Photon one >> https://discord.gg/uxaRmVq

Not enough power

$
0
0
Hello.We are doing a project that requires the synchronization of hundreds of objects. And when writing the code, I encountered such a problem, even with 20-30 objects between 2-3 players, problems begin. The first problem is that IPunObservable is called but does not transmit anything and the objects just stand still. The second is even if everything works and the server is not buggy, it can simply crash into the console without error.
I have already tried several methods. But the result is still the same.

ClientTimeout when 5+ players

$
0
0
Hi there, I'm getting client timeout errors when a fifth player joins my games in photon 2.19.1. My default maxplayers is set to 5, so I thought maybe it wasn't taking that setting in properly, but when I query maxplayers it definitely shows as 10.

So the fifth player joins, and then two players are kicked from the game with a ClientTimeout error with no more details.

I can't figure out how to debug this; I would really appreciate some help. I am pretty sure I'm not doing anything wrong, but then this is first time I've tried 5+ players since I've updated to photon 2

How to setup game like Elite Dangerous

$
0
0
Hi there,

I'm thinking of developing a game that has structure of Elite Dangerous, with multiple star systems and different users that can be flying around in a specific star system.

How can I use PUN2 to set this up? Can users jump from one room to another (universe to universe)? Or should I use some other pattern?

Thanks in advance!

-Bender-

In PUN 2.20.1 lib 4.1.44 gameobjects have stopped changing their parent in client IsMine = false.

$
0
0
Hello!
Sorry for my English! :)

In PUN 2.20.1 lib 4.1.44 gameobjects have stopped changing their parent in client IsMine = false.

I found this in the code and had to put an additional check, if gameobject did not change the parent - to change it.

If IsMine = true changes the parent of a PhotonView gameobject, so Mine = false leaves this object at the root of the scene.

There was not in previous PUN versions.

Not only that, now the gameobject coordinates are getting lost and I have to adjust the coordinates by RPC.

Please tell me why such amendments were made or maybe I don't understand something?

Where can I enable automatic parent change in PhotonViewObject now?

Thanks!A.png

How to close room so no one can enter

$
0
0
Hi all,

I'm fairly new to the photon engine. Right now, I need to close a room so that no one can enter after a certain point. I've read other discussions about using (room.IsOpen = false;). However, I cant get it to work. Am I missing a namespace or anything?
Viewing all 8947 articles
Browse latest View live


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