Author Topic: Player id strange problem when connecting multiple clients...  (Read 3392 times)

chiblue

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
Player id strange problem when connecting multiple clients...
« on: September 06, 2013, 09:09:00 PM »
When I start 2 clients,  the first clients gets a player id say 1,  then when I start the second client player id 2,  the first client creates the remote object for the second client,  I.e. the client player id is 1 and the remove player object has a id of 2,  but on the second client the client player id is 2,  but the remove client id is also 2,  when it should be 1.

It seems that any client I connect after the first creates the remote object with the same player id as the local client,  this happens the same for 3,4 etc... only the first client gets the correct id...

Below is how I create the client object,  the remote objects are created for me... I am obviously doing something wrong,  but what?

  1.        
  2.         void OnNetworkJoinChannel(bool success, string error)
  3.         {
  4.                 // create FPS player...
  5.                 TNManager.Create(networkPlayer,false);
  6.                
  7.         }
  8.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Player id strange problem when connecting multiple clients...
« Reply #1 on: September 06, 2013, 11:17:29 PM »
What is "networkPlayer"? TNManager.playerID is your own ID. OnNetworkPlayerJoin gives you a Player struct containing info on that player, including their ID.

chiblue

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: Player id strange problem when connecting multiple clients...
« Reply #2 on: September 09, 2013, 10:04:04 AM »
Thanks,  I found the problem I was checking the player id on all RFC functions,  but when I removed this and assigned the correct instance to the calling of the send everything worked...