Ok so, after some testing I ended up going with the following solution (for now):
My realtime script has a variable totalPlayers, which I populate the following way:
RTSession.onPlayerConnect(function(player){ var sessionId = RTSession.getSessionId(); var playerId = player.getPlayerId(); RTSession.newRequest().createMatchDetailsRequest().setMatchId(sessionId).setPlayerId(playerId).setRealtimeEnabled(true).send(function(response) { if (typeof response.opponents != 'undefined') totalPlayers = response.opponents.length + 1; else totalPlayers = 1; RTSession.getLogger().debug("Setting total players to " + totalPlayers); }) })
With this, every time a new player sends a "Player Ready" message, I add them to a "readyPlayers" array and when the readyPlayers array is as large as "totalPlayers", I start updating the game for everyone... now... seems to be working with the very very limited testing I did... but part of me doesnt think this is the smart way of doing this? lol
Allan Smith
Hi,