Looking to limit the max players and max messages per room from the Dashboard.
Seems like this should be an option in the Dashboard but could not find it.
I don't really want to set up self-hosted servers as this is the only real limitations I need to set.
↧
Possible to limit max players and max messages per room from Dashboard.
↧
Use Photon Pun on the external server as MasterClient?
I was wondering if it is possible to use Unity Headless on my own server as if it were a MasterClient? Using the Photon Pun (not the self-hosted Photon). I can program a good one in Photon Pun, it's very simple and easy to move, but I can not use the self-hosted Photon in any way, so I thought it was possible to use the Unity Headless being the MasterClient and creating a ready room to players, thus becoming authoritative! What if there is still the question of opening doors to the server and other things for example if I hosted it on Azure or Amazon?
↧
↧
How to PunRPC a new weapon on a character if Photon is mine OnTriggerEnter?
Hi,
In my multiplayer game, the player can get a new weapon by flying through a crate that contains the new weapon.
I realize I'm doing two different things that aren't working in my code below for examples sake here it is:
Code (CSharp):
[PunRPC]
void OnTriggerEnter(Collider other)
{
if (photonView.isMine)
{
if (other.tag == "BeeSting")
{
photonView.RPC("BeeStingMissileNew", PhotonTargets.Others, beePrefab);
bee.SetActive(true);
beePrefab.SetActive(true);
}
I check if photon is mine on trigger enter. If it is, the "bee.SetActive(true);" (which is an icon in the top right corner) and "beePrefab.SetActive(true);" (which is the actual missile prefab that is an inactive child object on the player) become active. They don't show to anybody else in the game, but the beePrefab should.
The other thing I'm doing is trying to RPC the "BeeStingMissileNew" which is the prefab in the Resources folder to all other players in the game so they can see my weapon, but I'm not specifying its position and that's not the prefab I'd like to show all other clients.
How do I PunRPC the child object prefab called "beePrefab.SetActive(true);" so that all players can see that it is now active?
I hope this makes sense and that someone can tell me what I'm doing wrong. Thank you
↧
Client is on MasterServer (must be Master Server for matchmaking)
This is the error that shows up:
JoinRandomRoom failed. Client is on MasterServer (must be Master Server for matchmaking) but not ready for operations (State: Joining). Wait for callback: OnJoinedLobby or OnConnectedToMaster.
I am currently on unity version 2019.1.11f1, and when i try to run my server in unity it crashes, but when i build and play it works perfectly fine. Any ideas on what could be causing this issue?
My Very Basic Script:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using Photon.Pun; public class Launcher : MonoBehaviourPunCallbacks { public GameObject ConnectText; public GameObject OfflineText; public void MultiplayerStart(){ ConnectText.SetActive(true); PhotonNetwork.AutomaticallySyncScene = true; Connect(); } public void OfflineStart(){ PhotonNetwork.OfflineMode = true; Create(); } public override void OnConnectedToMaster(){ Join(); base.OnConnectedToMaster(); } public override void OnJoinedRoom(){ StartGame(); base.OnJoinedRoom(); } public override void OnJoinRandomFailed(short returnCode, string message){ Create(); base.OnJoinRandomFailed(returnCode,message); } public void Connect(){ PhotonNetwork.GameVersion = "0.0.0"; PhotonNetwork.ConnectUsingSettings(); } public void Create(){ PhotonNetwork.CreateRoom(""); } public void Join(){ PhotonNetwork.JoinRandomRoom(); } public void StartGame(){ if(PhotonNetwork.CurrentRoom.PlayerCount == 1){ PhotonNetwork.LoadLevel(1); } } }
↧
Cross Platform Connecting Demo
I built the Asteroids demo for Android and PC just to see if it worked. They do not see each others' rooms. What do I need to do to have them be able to be in the same room?
↧
↧
PUN2 Chess game instantiation problem
Hi, I made a chess game, it works perfectly in single player and wanted to add a multiplayer mode, so I found PUN2. Originally all chess pieces are instantiated on start, When I tried not to change it, so I just added a photon view and photon transform view classic components and built the game, when I move a piece it shows on one side only. So I tried PhotonNetwork.Instantiate and it worked on both sides well, but it instantiated every piece twice, so there are two white teams and two black teams.. Then I tried PhotonNetwork.InstantiateSceneObject and it didn't instantiate every team twice, and it transmitted the movement on both sides, but I can move the pieces on only one side, on the other client it just doesn't work. Also when using InstantiateSceneObject all pieces have "Controlled Locally" turned off in the photon view component.. while using PhotonNetwork.Instantiate all pieces have it turned on and on the doubled pieces it is turned off. Problem: How can I use PhotonNetowrk.Instantiate without doubling teams. or how can I use PhotonNetwork.InstantiateSceneObject but control the ownership of teams, so that one client owns white team and other owns black team, or even both I think I can work around it if both can control both teams.. Thanks :D.
↧
InvalidCastException: Specified cast is not valid.
When I have more than one characters in game this error occurs.
I tried all sync combinations disabled, discrete and continuous. It changed nothing.
NullReferenceException: Object reference not set to an instance of an object
Photon.Pun.PhotonAnimatorView.DeserializeDataContinuously () (at Assets/Photon/PhotonUnityNetworking/Code/Views/PhotonAnimatorView.cs:370)
Photon.Pun.PhotonAnimatorView.Update () (at Assets/Photon/PhotonUnityNetworking/Code/Views/PhotonAnimatorView.cs:150)
↧
Tutorial section 5 - Object reference not set to an instance of an object
Hi all,
I am currently working on section 5 of the PUN basics tutorial (https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/pun-basics-tutorial/player-prefab), and everything went rather smooth up until now.
In this section, you are asked to create a PlayerManager script and attach it to your My Robot Kyle prefab. My code is as follows, and please see a screenshot of my UI as well (showing My Robot Kyle prefab, that it is in the Resources folder, etc.). The error I get is: "NullReferenceException: Object reference not set to an instance of an object
Com.MyCompany.MyGame.PlayerManager.Update () (at Assets/Scripts/PlayerManager.cs:55)"
Could you please help me out?
using UnityEngine;
using UnityEngine.EventSystems;
using Photon.Pun;
using System.Collections;
namespace Com.MyCompany.MyGame
{
///
/// Player manager.
/// Handles fire Input and Beams.
///
public class PlayerManager : MonoBehaviourPunCallbacks
{
#region Private Fields
[Tooltip("The Beams GameObject to control")]
[SerializeField]
private GameObject beams;
//True, when the user is firing
bool IsFiring;
#endregion
#region Public Fields
[Tooltip("The current Health of our player")]
public float Health = 1f;
#endregion
#region MonoBehaviour CallBacks
///
/// MonoBehaviour method called on GameObject by Unity during early initialization phase.
///
void Awake()
{
if (beams == null)
{
Debug.LogError("Missing Beams Reference.", this);
}
else
{
beams.SetActive(false);
}
}
///
/// MonoBehaviour method called on GameObject by Unity on every frame.
///
void Update()
{
// we only process Inputs if we are the local player
if (photonView.IsMine)
{
ProcessInputs();
}
// trigger Beams active state
if (beams != null && IsFiring != beams.activeSelf)
{
beams.SetActive(IsFiring);
}
}
///
/// MonoBehaviour method called when the Collider 'other' enters the trigger.
/// Affect Health of the Player if the collider is a beam
/// Note: when jumping and firing at the same, you'll find that the player's own beam intersects with itself
/// One could move the collider further away to prevent this or check if the beam belongs to the player.
///
void OnTriggerEnter(Collider other)
{
if (!photonView.IsMine)
{
return;
}
// We are only interested in Beamers
// we should be using tags but for the sake of distribution, let's simply check by name.
if (!other.name.Contains("Beam"))
{
return;
}
Health -= 0.1f;
}
///
/// MonoBehaviour method called once per frame for every Collider 'other' that is touching the trigger.
/// We're going to affect health while the beams are touching the player
///
/// Other.
void OnTriggerStay(Collider other)
{
// we dont' do anything if we are not the local player.
if (!photonView.IsMine)
{
return;
}
// We are only interested in Beamers
// we should be using tags but for the sake of distribution, let's simply check by name.
if (!other.name.Contains("Beam"))
{
return;
}
// we slowly affect health when beam is constantly hitting us, so player has to move to prevent death.
Health -= 0.1f * Time.deltaTime;
}
#endregion
#region Custom
///
/// Processes the inputs. Maintain a flag representing when the user is pressing Fire.
///
void ProcessInputs()
{
if (Input.GetButtonDown("Fire1"))
{
if (!IsFiring)
{
IsFiring = true;
}
}
if (Input.GetButtonUp("Fire1"))
{
if (IsFiring)
{
IsFiring = false;
}
}
}
#endregion
}
}
↧
How to make work Photon with VRTK
Hello,
I'm making a game with Photon and VRTK.
I have a problem of synchronization of my object in the game.
I explain : I have a gameObject with a component VRTK-interactableObject on it. I want to put it on a dropZone on my playerprefab. This works on the local player but the object in the other player rest on initial game and not in the first player.
You can find here 3 images on my settings :
https://drive.google.com/drive/folders/1xlgvEiGlU2xM-HiKTfYjJhOEC3tmfvGv?usp=sharing
best regards
Ryu
↧
↧
Own server for photon unity networking
Hello,
I'm creating multiplayer game. I want to use photon unity network classes for multiplayer. Is there anything possible so I can use my own server for it not photon server?
Thanks in advance.
↧
SQL Lobby RoomListUpdate
I want to import the roomlist of SQL Lobby. Is it impossible?
Is there any way to display a list of rooms classified as SQL Filter?
Is it only possible in the Default Lobby?
I am going to make a project to open and close a room not join room.
Is there a way to stay in the room and get outside room list?
↧
Callback for PhotonNetwork.Instantiate
I have the following code:
Debug.Log("1");
_dmgDestroy = PhotonNetwork.Instantiate(pathTodmg + dmgDestroy.name, new Vector2(currentPos.x, currentPos.y), Quaternion.identity, 0);
Debug.Log("2");
_dmgDestroy.GetComponent().AwakeInstantiate(gameObject);
The issue is that I want the AwakeInstantiate to be called AFTER I know the object Instantiated was spawned.
The main goal of this is to get the spawned object a handle of the object that spawned it. Is there a better way to accomplish this task?
↧
Create an Object and Synchronize Object Transform
A user creates an object > When changing the position of an object, use photonTransformView
B user sees that the object position has changed.
However, if the user B changes the position of the object, the position of the object in user A isn't changed.
Is there a way to synchronize when I move an object that I did not create?
The owner type is Takeover.
↧
↧
Launching a ball
Been struggling with this for a few days. In my game, the player can walk up to a ball and collect it, then hold down left click to charge a shot and launch the ball. Everything works in single-player mode. The ball is a rigidbody and getting launched via changing velocity. I've tried quite a few things but what happens is that the ball gets picked up by the player, moves to correct position for the player to hold it. When the player launches it, the ball stays in that position for the other players, nothing is being updated for its position.
I've tried using OnPhotonSerializeView(), I've tried having my kick logic in an RPC that sends the velocity change to other players as well. What would be the best way to go about synching the ball to all players in the room?
Can post any code you need to see, just ask!
↧
Question about a game procedure
Hi there :)
I'm making a session based multiplayer (like brawl-stars / clash royal) where a game has a very specific procedure:
1. declaring players.
2. starting game.
3. game ends.
4. declaring winners.
5. receiving rewards.
My question is who manages the game procedure..
Is the admin of the room managing the procedure and everyone is saving the state in case the admin quits and they'll be picked as an admin? or how do most developers implements this stuff?
Thanks in advance :smile:
↧
Sending joystick inputs
I'm sending joystick inputs using OnPhotonSerializeView(). I'm using a bit mask for the inputs so each send is a single integer. I'd like to run this at 30hz and have set PhotonNetwork.SendRate = 30; and PhotonNetwork.SerializationRate = 30;
The stream.IsWriting calls run like clockwork every .033 seconds. The stream reads calls in OnPhotonSerializeView() on the receiving end however are being batched together. I'm basically getting 5 aggregated batches per second. I get the first read after a .2 second delay from the last batch, then the rest of the reads in the batch follow after at .001 seconds each. So i'm basically getting a .2 second lag followed by a quick blast of the batched reads. This makes for a gittery mess of the controls that are looking for things like how long a button has been held down. I can run a timer to space out the batch reads that are happening to fast, but that's just adding more lag.
Is there a way to stop the batching? Is there a better way I can do any or all of this? I hoped by only sending a single integer per write i could get away with a higher send/receive rate. But, between the batching and my correction timer i'm seeing lag of up to a .35 seconds on the input.
↧
Script on Photon
Hello Is it possible to write any script on photon to make server logics ?
↧
↧
ERROR: "JoinRoom failed. Client is on MasterServer"
Hi.
I recently updated to the latest PUN Version on the Unity Asset Store.
Now i get the error Msg "JoinRoom failed. Client is on MasterServer (must be Master Server for matchmaking)but not ready for operations (State: Joining)." when i joining to a room.
But the thing is, it joins the room and i can also play normaly my game.
Any ideas what cause the error msg?
(sorry for my english ;) )
↧
Carry Data in differents scenes using Photon
So I am kind of stuck in one problem that may seems easy.
I have the first scene that you may put your nickname and then join a room. The problem is that I can't save the name and pass it to another scene (the lobby).
I tried to use static variables, but I didn't get a good result and I presume that it's not good to use "shared" static variables in a multiplayer game.
I also tried to create an object that comes from a prefab "SaveInfo" in that way I use DontDestroyInLoad , So I could acess it in the others scenes. The problem is that it seems it always creats only one prefab in a room, not one for each player that gets in.
I also tried using PlayerPrefs.SetString, but I did not know how to acess easly the information.
How would you solve this problem?
Thank you for your help!
↧
Can a game room be opened forever?
Like the title, can a game room be opened forever as long as users are inside?
If so, is it OK for networking-performance?
Since I'm about to launch a game app using PUN, I think I should prepare for it.
Thanks in advance for your time.
↧