Author Topic: RFC not being sent to the other members  (Read 647 times)

scornflake

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 15
    • View Profile
RFC not being sent to the other members
« on: April 06, 2017, 05:05:46 PM »
I've a puzzling behaviour.

I two clients on a dedicated network. I have an iPad connected, and am also running via the Unity Remote 5.

There are two clients in ch1: iPad:16 and Neilos:17.

iPad asks both itself and Neilos to join a match (ch2), like so:

  1.                 // Ask self to join
  2.                 tno.Send ("PleaseJoinMe", tno.ownerID, Constants.FIGHT_CHANNEL, tno.ownerID, target.ToDataNode ());
  3.                 if (opponentPlayer) {
  4.                         // If we have opponent, ask them to join as well
  5.                         Debug.LogWarningFormat ("Ask the opponent '{0}' ({1}) to join", opponentPlayer.tno.name, opponentPlayer.tno.owner.id);
  6.                         tno.Send ("PleaseJoinMe", opponentPlayer.tno.owner.id, Constants.FIGHT_CHANNEL, tno.ownerID, location.ToDataNode ());
  7.                 }
  8.  

The RFC is:
  1.         [RFC]
  2.         public void PleaseJoinMe (int channelID, int requestingPlayerID, DataNode targetLocDN)
  3.         {
  4.                 // Update target state for this player
  5.                 NamedLocation newTargetLocation = NamedLocation.FromDataNode (targetLocDN);
  6.  
  7.                 Debug.LogFormat ("{0} received join request. {1} has asked us to join {2}, targetting {3}.",
  8.                         ToString(),
  9.                         TNManager.GetPlayer (requestingPlayerID).name,
  10.                         channelID,
  11.                         newTargetLocation
  12.                 );
  13.                 targetLocation = newTargetLocation;
  14.  
  15.                 // Join and leave the lobby
  16.                 TNManager.JoinChannel (Constants.FIGHT_CHANNEL, "Game", true);
  17.         }
  18.  

The logging on the iPad says:


   LobbyPlayerUI: Ipad, id: 16 is starting the match against LobbyPlayerUI: Neilos, id: 17
   Ask the opponent 'LobbyPlayer(Clone)' (17) to join
   LobbyPlayerUI: Ipad, id: 16 received join request. Ipad has asked us to join 2, targetting [Neilos -41.1068840026855,174.889251708984 @ 34.3732681274414].
   Lobby UI for Ipad destroyed
   Lobby UI for Neilos destroyed


Which is as expected, as the iPad, through RFC, is asking itself to join the fight channel.

Yet I never see the RFC message for Neilos (17) on the other side.

I *do* see what I think is an incorrect message.
The RFCs in this case are sent to specific players. iPad is sending a request to Neilos (17).
Yet, what I see on Neilos is:


   LobbyPlayerUI: Ipad, id: 16 received join request. Ipad has asked us to join 2, targetting [Ipad -41.1069030761719,174.889312744141 @ 37.5763320922852].


That seems ... incorrect. The client (Neilos) receives a single message, but it appears to be sent to an object who's owner is iPad, not Neilos.
That isn't what iPad had asked for, on it's original tno.Send, directed at client 17 (Neilos). Why would the RFC be called on a TNBehavior that isn't owned by playerID=17 (Neilos)?

'Neilos' receives no other messages.

I do note that the LobbyUI (TNBehaviour) for Neilos is destroyed because a new level is loaded (as part of joining ch2) at the end of the RFC. iPad loads a new level as soon as it receives it's own RFC call. However, before this happens iPad has already sent the "PleaseJoinMe" RFC to the other client. I even said please :)

It seems the RFC to 17 is being sent to the wrong object on the other network member (Neilos).

Even when I remove the code that joins ch2, and don't leave ch1..  that is, when I make it not load the new level, and just sit there, no other messages are received by Neilos.


Ideas?
I'm out of them myself.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: RFC not being sent to the other members
« Reply #1 on: April 07, 2017, 07:02:33 PM »
  1. tno.Send ("PleaseJoinMe", opponentPlayer.tno.owner.id, Constants.FIGHT_CHANNEL, tno.ownerID, location.ToDataNode ());
So... you're sending a message to the opponent specifying object's player ID as the 2nd parameter, assuming that tno.owner is that player. Was that object created by the player? Why are you not sending TNManager.playerID instead? And who owns the actual object? Is it dynamically created, or is it something local?

I also don't know what "location" is. Your getting data from that class, yet don't provide any info as to what's inside this class. Where does the player's ID come from in it?