Author Topic: Best Practices: Checking For Player Readiness  (Read 423 times)


  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 18
    • View Profile
Best Practices: Checking For Player Readiness
« on: August 01, 2017, 11:07:32 PM »
I'd like to get some input from others as far as how they go about tracking user readiness when loading a game that requires global synced events. Currently my host and clients all change the level at the same time, then the host instantiates objects, but once the players are ready the game clock should start and the game begins.

I'm looking for techniques to tell when all the players are ready. So far I have a single IEnumerator on the host side that checks for a ready bool on all the clients, but other than tracking object types in the scene, what are some other creative ideas for checking player states?


  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,151
  • Toronto, Canada
    • View Profile
Re: Best Practices: Checking For Player Readiness
« Reply #1 on: August 03, 2017, 04:33:39 AM »
The easiest way is to just periodically (InvokeRepeating) run through players in the channel (TNManager.GetPlayers(channel)) and check each player's data, such as player.GetData<bool>("ready").

Players can mark themselves ready by doing TNManager.SetPlayerData("ready", true);

More efficient way would be to subscribe to player's data changes in the OnPlayerConnect notification, eliminating the need for InvokeRepeating.