Hi guys,
So basically I’m working on a turn-based game that uses Photon RPC messages for all game functions.
What I’m currently doing is when both clients connect they both open the scene with their own Game Managers. Basically nothing is network instantiated or synced.
When Player A moves, the move is sent via RPC using RpcTarget.AllBufferedViaServer.
So far everything works perfectly fine, but the reason I’ve used Buffer is because I want a player that reconnected to then receive ALL moves made again on reconnect so that his/her client ends up back where the game left off. It kind of works since some moves are executed when I connect back into the room but I believe that buffer sends them all as a bundle which could explain why although some moves are made, it’s not doing it in the correct sequence. I thought ViaServer would send it in order but maybe it’s just sending everything too fast…
Question 1
So my question is, would there be a way to see how many messages are in the queue by *disabling the RPC queue at the start and enabling it when everything is loaded, and then execute them one by one, disabling and re-enabling the queue in-between each call?
So when Player B reconnects, x moves are waiting to be sent in the queue, move 1 is sent and the queue is disabled until that RPC has been sent through, then RPC number 2 executes and repeat until all are through.
*PhotonNetwork.IsMessageQueueRunning = false;
Question 2
I’ve noticed that if a move is made and one client isn’t responding - the RPC call doesn’t get received. So far I haven’t been able to test my “fix” for this as none of my clients have failed to respond yet… (Usually good but when I need it to freeze it won’t. >.>)
So what I’ve done is:
a) Add PhotonNetwork.SendAllOutgoingCommands(); after every RPC call.
b) Used OnApplicationPause to disable and re-enable the RPC queue so that RPC messages are queued while the client isn’t responding.
The question is, will OnApplicationPause execute before the application stops responding? Is there a better built-in method to use that will work better? I know it’s a tricky one because if the application fails to respond then it’s probably not going to be executing anything since it’s an unplanned situation…
Thank you in advance,
Michael.