9
« on: August 27, 2017, 03:43:20 PM »
In my game, there are 4 players in a match. While players that join have their PlayerID that TNet assigns them, I also need to keep track of a relative player number in regards to being player 1 - 4. (This number is used by an announcer in the game, and for organizing player UI, etc.)
Currently I've been tracking this myself in my GameManager as players leave and join the server, but it has become a big pain as I have to keep this data synced with players that are already on the server, and then players that later join. Also for example, player 2 could leave, and then I would want the next player to join the server to be assigned player 2 for their relative player number. (so I can't just sort by tnets playerID to determine relative 1 - 4 player numbers)
I'm just now learning more about TNet's SetPlayerData method and others, and am hoping I can get some guidance on what the best approach using these methods might be to easily sync this data across all players at all times? I thought as well about modifying tnet's source code to include a relativePlayerID, but am not sure how i'd do that....
any thoughts are appreciated