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

Detect Number of players in specific rooms

$
0
0
Hello,

Is there a way to detect number of players in specific rooms.

I know there is PhotonNetwork.GetRoomlist() function which will give me a list of rooms. However I have to be connected to the master for that function. Is there an ability to do something like it without being connected to the master?

Basically I want to display the number of players that are in similar matches to the player that is already in a room. Maybe there is another way to do this?

Thanks!

Issue in IsFInishedByMe

$
0
0
Making a turn based game in unity for 2 players (Host and Client let say),
Problem - Turn is of host (and to make a move it uses a boolean value of turn manager - IsFInishedByMe to be false),Now Client gets disconnected and then rejoins the room within specified time, the host gets the "IsFInishedByMe" value to be true now and the game gets hang.

Note : when the client is disconnected, host is not making any move till the client rejoin the room, but when client rejoins, the host gets stuck because of the IsFInishedByMe is true for host.

bullet owner

$
0
0
hi everyone :) , I would like to have a kill count on my game,I know how to do it, I have to know who shot the bullet,it's right? but the documentation says it is better not use a photonview for each bullets,so.. how can i get the bullet shot owener? thx

RPC AllViaServer Order

$
0
0
When we send RPCs with target of AllViaServer it says in the document that order is maintained but is that order only for that particular RPC? Or this is all the RPCs for the photonView? Say I have two RPCs in a class for a photonView, the RPC methods are: "RPC1" and "RPC2". If I execute "RPC2" then "RPC1" will it execute in that order for all the clients?

iOS iPad problem, app not passing the App Store review

$
0
0
I've been struggling with this for a couple of weeks now and desperately need some help. First things first, I am using Unity version 2019.3.14f1
Pun 2.17
Photon lib 4.1.3.0
Xcode 11.4.1

Important: My app works completely fine when I test it on my iPhone and iPad mini, both running iOS 13.5. I am testing in the US (in case that matters).
In my first game screen I have a button that needs to be clicked for a user to connect to the photon server (I am not connecting to the server on app start). I connect to the photon server using PhotonNetwork.ConnectUsingSettings(). I am pretty desperate and running out of ideas on how to go about testing this. Is there anyone out there (who does not live in the States) with an iPad with the latest iOS willing to test my game for me. I would have to assign a role to you in my itunes connect account as the app is not passing the beta review either, so no external testers are allowed.

Or, can I get some photon events displayed on the device as the device tries to connect? That way when the app connect review team rejects my app again and sends a screen shot back, I would be able to see what stage of connection the app is stuck on.

Additional info: I keep Fixed Region, Server and Dev Region fields empty in my project before I build the app.

PUN2 Score Extensions Problem

$
0
0
I have been using Pun2's score extension, but I cannot update the score correctly. For example, I cannot make multiple calls to AddScore(X) in a row. It does not sync up. The score at the end of these calls will remain the same. How can I fix this problem?

Error Photon View

$
0
0
Good morning, I have a problem with the multiplayer of NWH Vehicle Physics 2. I have made a separate scene where if you hit the button, it connects to the PUN master and loads a room, when it loads it creates a prefab of the car with the components of photon view, etc. The problem is that if I am not the master the other players do not load but if I am in the master I see the other players. I have created a text where I indicate the players that are in the room (master, guest) and it indicates that there are two but not from the guest window I do not see the other players

Woldspace UI Object(text) problem!! need urgent help, admins please

$
0
0
I've been trying this for quite a while but haven't figure out anything yet. What I want to do is to instantiate or just write the taken damage to a text object under a canvas which is world space render mode. I can see this text from me but other player cannot see the text. how do we make this displayed for bot players? I'm sure there is an answer but there's no web page laft n google's first search page that I did not check out. Please somebody give me an advice asap.
so far this is what I tried
[PunRPC]
    protected void TakeDamage(float damage, DamageType damageType) //rakip ismi buraya
    {

        if (damageType ==DamageType.Physical)
        {
            float takenDamage = (damage / 1 - PhysicalDefence) * 0.1618f;
           
            string takenTemp= $"{takenDamage:00}";
            GameObject damageText = PhotonNetwork.Instantiate("DamageText",transform.position,transform.rotation);
            damageText.GetComponent<RectTransform>().SetParent(gameObject.transform.GetChild(1).transform.GetChild(0).transform);
            damageText.transform.position = gameObject.transform.GetChild(1).transform.GetChild(0).transform.position;
            damageText.GetComponent<DisplayDamage>().damage = takenTemp;
           
        }

public class DisplayDamage : MonoBehaviourPunCallbacks
{
    public string damage;
   

    
    void Update()
    {
      //  photonView.RPC("DisplayText", RpcTarget.All, damage);
        if(photonView.IsMine)
          gameObject.GetComponent<Text>().text = damage;
        else
          gameObject.GetComponent<Text>().text = damage;

    }
  /*  private void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.IsWriting)
        {
            stream.SendNext(gameObject.GetComponent<Text>().text);
        }
        else
        {

        }
    }*/
   /* [PunRPC]
    public void DisplayText(string text)
    {
        gameObject.GetComponent<Text>().text = text;
    }*/
}

Sync Scene Object for both players

$
0
0
I've a game that is like Pong, two players can hit a ball and try to score points by trowing the ball on the other player area.

Currently i'm using
photonView.TransferOwnership(PhotonNetwork.LocalPlayer)
depeding on who is closest to ball it will have the ownership of it, the problem is that this call can take over 900ms to complete and the game is fast paced.

Is there a different aprouch to solve this problem, or a faster way to transfer ownership of a object?

How to spawn in objects that doesn't disappear with the spawning client

$
0
0
Ok, so as simple as it is, I have two players, one is master client other is not.
Each player can spawn in a toilet paper gameobject with pressing E key.
I use, of course, the PhotonView.Instantiate, and it works almost perfectly...
The toilet paper spawns in but only one client can control the toilet paper, and the toilet paper isn't always synced.
That's not even the main problem here. My problem is that the toilet paper is being disconnected as the client which spawned it leaves the game. I don't want that...
People have recommended using some instantiate in scene thing, through a RPC through the masterclient, but that doesn't work neither, so what should I do to fix these problems?
Thanks in advance my dudes :D

Also, please don't treat me as an idiot because I am a newb ;D

How to switch bodies in a game?

$
0
0
I've a newbie to unity and PUN-2, but I've just successfully finished the PUN2-Basic Tutorial, it was really fun.

I want to implement a body switching game and need some hints, how to implement this. Here is a list of features/requirements I want to implement:
  1. There are ghosts and figures. A player can choose at any time, which ghost or figure to connect or change to.
  2. Ghosts are cameras and a input control without physical body. The control is mainly to move an outside view on the game setting from any angle.
  3. Figures has a camera, a body representing at minimum eyes and orientation.
  4. There at minimum two players with priorities, one game setter (priority 1) and one main player(priority 2), any subsequent players are called other players (priority 3 or lower).
  5. The first two players can add ghosts and figures at any time, after an initialization scene they are positioning the ghost or figure on the game setting.
  6. Each player can have different states:
    • Following Observer: this player follows the view(current camera) of another player
    • Active Observer: this player is just observing the the camera of a ghost or figure
    • Controller: this player controls the current ghost or figure (Highest priority wins during control selection process)
  7. A disconnecting player or a player switching from one camera to the next leaves the previous ghost or figure intact.
  8. At any time, specially at the end, when game setter and main player is logging off, a save of the current setting is needed.
  9. One setting consists of all ghosts and figures on the same game room.
  10. At the beginning it should be possible to restore from a saved setting.
  11. From any camera (ghost and figure) it should be possible to take screenshots.
Not all the requirements are related to networking issues, they are for an almost complete picture.

Any hint is highly appreciated.
Myonara.

Photon performance and messages per room

$
0
0
Hi,

my name is Gregory. For sometime I have been trying to make a 2D top-down MOBA. I use Photon PUN and a free server for 20 players on Photon Cloud.

Classic matches for 10 players in a lobby, 5vs5, however I have read about the recommended 500 msg/per sec/per room and I don't know if 10 players aren't too much?

I use OnPhotonSerializeView to synchronize movement, the rest I do with RPC's. I have launched 4 clients and made tests,
giving the players Photon Stats GUI, but I can't properly analyze what I see there.

d756801ccd70cb79dc057186180417e4.png

Does the average traffic, seen there, means that i.e. the player is sending and receiving 11 messages per second?
If so, then it would mean that for players generate about 60 messages per second, but I'm probably wrong.

I don't know what to think, I don't quite understand how it works and how to count it, so I ask for your help. I want my game properly optimized and without lags.

Are Photon PUN and Cloud appropriate for such a game? How do I understand the data from the picture? Have you got any advice?

I don't if I should continue development on Photon or look for other solution.

Display Created Rooms

$
0
0
Guys hey everoyne,
I want to make a game that we can create room and display them in the lobby.

this is my launcher script(reletated codes):

public string roomName = "testRoom";
RoomInfo[] roomsList;
[SerializeField] public GameObject[] createdRooms;
.
.
.
.
public override void OnRoomListUpdate(List<RoomInfo> roomList)
{
for(int i=0; i<roomList.Count; i++)
{
// I show created roooms.
}
}

Gameobject of createdRooms are consiste of text and one button. Which refers of text of the Room and Join Button. How can I do this? Can you please help to me?

Can't get View ID of GameObject

$
0
0
So I have a player prefab with a PhotonView on it. I also have this code on a collider...
if(other.gameObject.GetComponent<PhotonView>().IsMine) {
            GameObject[] players = GameObject.FindGameObjectsWithTag("Player");

            Debug.Log(players[1].GetComponent<PhotonView>().viewID); //BROKEN HERE
}

Can anyone see why this would not work. I have using Photon.Pun; and MonoBehaviourPun but I get the error....

error CS1061: 'PhotonView' does not contain a definition for 'viewID' and no accessible extension method 'viewID' accepting a first argument of type 'PhotonView' could be found (are you missing a using directive or an assembly reference?)

Thanks

Detect other player disconnect by quit app

$
0
0
Hi I just started using PUN for my unity turn base game for few weeks and I got some problem with detecting player disconnection. Scenario: 1. Two players entered a room of max 2 players 2. One player quit application 3. Check OnPhotonPlayerDisconnected callback in the class extend PunBehaviour, the log inside is not called, use PhotonNetwork.otherPlayers to check player in the room, it show 2 players still inside In order to let the same player rejoin the room, should the player leave room or just let the id keep in the room? if the player need to leave room, how to let the player disconnect and leave room when he quit the application?

How do I send RPC call right before I disconnect from the server? (or leave the room)

$
0
0
Hi, thanks for taking interest in my question. So basically, I am making a multiplayer VR game and I have run into a problem. When I grab an object, I take ownership of it and send RPC call to everyone that now this object is grabbed and do other stuff, like disable gravity. I noticed that if I am holding an object and I leave the game (stop Unity editor play mode), Both my virtual player and the grabbed object disappear. What I would like to do is to Release any objects that I am holding before disconnecting. What I tried to do was to set OnDestroy method on my root VR character script that should release any objects being held (the object itself is responsible for RPC calls, like GetGrabbedRPC and GetReleasedRPC). This doesn't work because I get disconnected before OnDestroy is called. The other thing I tried was to get my VR character tagged upon instantiation (OnPhotonInstantiate). And when OnPlayerLeftRoom, I would get the tagged object and use it to release any held items and then destroy itself, but I probably don't have enough knowledge for that, because what happens is that RPC doesn't get fired and the VR character doesn't even destroy itself, rather it becomes IsMine object of another active player. Any help would be appreciated, I hope you guys understood what the problem is. Let me know if I can provide any useful information!

Help: reconnect and rejoin

$
0
0

When i reconnect and rejoin the game using reconnectandrejoin(), the playerlist.length is 0.

Turn-based Synchronous Board Game

$
0
0
Hello everyone! I'm creating a turn-based synchronous board game like chess in Unity (if you search Quoridor in Google you will see). The gameplay is ready for the single-player, but for multiplayer, I don't know which Photon service to use and how to implement it to my game. I'm a beginner so I would appreciate any advice you can give me! Thanks in advance :)

how i can check that all client has received RPC successfully .

$
0
0
i made a ludo game and sometime it misbehave , and i think maybe some client didn't receive the RPC due to temporary slow net , so how i can check that all player has received the rpc successfully than only i want to continue the game.

Players in Lobby

$
0
0
I'm trying to get a list of all the players inside a lobby, I've searched the internet in case anyone made this system possible but no luck, The only idea that I have is using chat services, whenever a players join a lobby, that players sends a message with their name and level, and the other clients are recieving it, I doubt it's the best option but it's all I got.
Also, some people ask why we need such thing in lobby, it's because while waiting for a room people would love to talk in lobby where more than 10 people can see the message, Any ideas other than chat?
Viewing all 8947 articles
Browse latest View live


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