Error on leaving room

Hi,
I am trying to write a simple challenge mechanism such that Player 1 will send a challenge request to Player 2, and after Player2 accept the challenge they both will join another (unique) room.

But one of the players fails to join and also destroys the containing object. I am getting these errors:

Error, cannot remove cached RPCs on a networkview thats not ours! scene: True
NullReferenceException: Object reference not set to an instance of an object

I have written a test script for better explanation. I couldn't get where I am doing wrong :(

Thanks for help

Comments

  • Thanks for the script.
    We will take a look as soon as possible (right now, we're a bit busy but we'll try to squeeze it in).
  • First some remarks:
    - instead of passing playerIDs, just pass the PhotonPlayer instead, this simplifies things.
    - you dont need to switch to a new room after the handshake. Just close the room instead and continue your game from there (load a new scene..or whatever you need). This would already solve your problem in a nicer way.
    - furthermore, if you need a challenge system, you might be better of creating a webservice OR to code this in the Photon server logic so that invites can be send in the lobby stage.
  • Thank you for remarks Leepo they are helpful.
    Unfortunately the problem still remains unsolvable :( I am not sure but I think it's a kind of bug or something.

    Moreover, I consider writing a custom server application but I couldn^t find any document or tutorial about Unity Networking Plugin and Photon Server integration.

    If you have any suggestions, it would be gladly accepted.
  • I'm trying to do exactly the same and I'm having several problems. I don't know if those problems come from the unity plugin or because I'm not using it properly. I'm working with the Photon Cloud.

    The main is problem is that each time a leave or create a room the game disconnects from the photon server. I'm forced to have a code that reconnects each time a disconnection happens. Besides, even when the PhotonNetwork says it's connected if I try to join a room, for example, I'm getting an error and the program crashes. To avoid this, I have to wait a few seconds after the program reconnects. Is this behaviour normal? Why is it desconnecting each time I create a room or leave one?

    There are other problems I'm having, and I don't know if they are related with the problem explained above. Basically, the performance of my game is very poor compared on how it worked with the basic unity networking solution. Sometimes, when the main scene starts I'm getting this error in the console: Received unknown status code: QueueIncomingReliableWarning. My game uses several PhotonViews (around 110) that is far from the maximum per player (1000), are 100 photon views a problem for photon?

    Thank you.
  • PUN implements some high level logic for communication with the serverside LoadBalancing application, which is running on the Cloud: On a connect call, PUN will connect you to the masterserver and on creating/joining a game, it will ask the master for the address of the gameserver, where it should create the game room (the master determines this by checking which gameserver has most resources avaiable, least games running / players in them, etc.) or where the game is already running, on response (if there wasn't an error) it will disconnect from the Masterserver and automatically reconnect to the gameserver, which url it ha been given by the master and then creating/joining the room there on the gameserver.

    So yes, a disconnect is expected internally while switching to the gameserver, but this should not trigger a public disconnect callback or show up in the public API at all and the client should not reconnect in response to it, which would bring it back to the master, where the ingame logic will not work, a reconnect should not even possible while this create/join and server-switch process is running, but I am not sure, if checks, to instantly return form connect without doing anything in this case are already implemented in the current release.

    The QueueIncomingReliableWarnings mean, that the underlying Photon core client is receiving way more incoming data packets, than you are processing. Normally this indicates, that you are not calling service() often enough, but in your case it could be a follow up problem from the issues with connection or from the high amount of PhotonViews, too.

    About the PhotonViews:
    This is a theoretical max-value, determined by datatype-sizes, but way above the amounts, to which hardware will normally limit you too.
    I can't give you any numbers, on how many views are save to to use performance-wise on current hardware.
    It's best, when you wait for an answer from Leepo or Tobias on this topic, as they are more familiar with the PhotonView-code than myself.
  • First of all, please verify you have the latest PUN version. I believe the asset store has the latest public version ATM.
    If you have some simple repro projects that you could easily share for us to fix the problem, that's always very appreciated.
    The main is problem is that each time a leave or create a room the game disconnects from the photon server. I'm forced to have a code that reconnects each time a disconnection happens.
    Internally PUN indeed disconnects from the master server and moves to the game server. In my implementations that use PUN this is not a problem at all.
    Are you relying on PhotonNetwork.connectionstatedetailed or something? This switch shouldnt even need to be noticable.
    Besides, even when the PhotonNetwork says it's connected if I try to join a room, for example, I'm getting an error and the program crashes. To avoid this, I have to wait a few seconds after the program reconnects. Is this behaviour normal? Why is it desconnecting each time I create a room or leave one?
    "even when the PhotonNetwork says it's connected if I try to join a room" - This should not be possible on the latest PUN version.
    There are other problems I'm having, and I don't know if they are related with the problem explained above. Basically, the performance of my game is very poor compared on how it worked with the basic unity networking solution. Sometimes, when the main scene starts I'm getting this error in the console: Received unknown status code: QueueIncomingReliableWarning. My game uses several PhotonViews (around 110) that is far from the maximum per player (1000), are 100 photon views a problem for photon?
    110 views does sound like a lot, especially of all 110 of them are active at the same time and constantly sending. Even when using PUN, you will need to be aware of what you are sending and how often. We still want to improve on the "QueueIncomingReliableWarning" situation, but in the end you'll possibly also need to optimize your messages some more.