One final hurdle after reconnecting

Options
In my RTS game I would like players to reconnect after disconnecting and I am almost there except for one small problem which I hope someone can help me with.

I have a room and have set the PlayerTtl to 60000 and the EmptyRoomTtl to 5 and PublishUserId to true.

The disconnecting computer then runs PhotonNetwork.ReconnectAndRejoin (); which works and it gets all of its Views and ownerships back but one small problem, all the buffered info since the original connection was established comes flooding back and causes all sorts of issues.

Is there a way of when the computer reconnects it doesnt receive all the buffered RPC's since the match started and just continues from where its self off?

The game pauses when this happens so its ok to loose one or two buffered RPCs so no need to get any of those bits of info that it might of missed since it was disconnected.

Thanks
Rob

Comments

  • Hi @HeskethGames,

    Is there a way of when the computer reconnects it doesnt receive all the buffered RPC's since the match started and just continues from where its self off?


    No, the client will always receive the buffered messages. If you want to skip those buffered messages, why are you buffering messages at all? Wouldn't it be easier to have a solution, where the MasterClient in the room can send the state of the game to a reconnected client somehow?
  • HeskethGames
    edited March 2018
    Options
    Because the game does I'm afraid.
    Are you absolutely 100% sure that there is no way to remove the buffered messages that are sent when it reconnects? Seems strange that it gets it all from the beginning of the match rather than where it left off.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @HeskethGames,

    Thank you for choosing Photon!

    Instantiation calls are buffered by default. That's why ALL networked objects created since the creation of the room and which are "still alive" are restored automatically when on rejoin.
    RPCs can be buffered on demand.
    You can also send custom events and add them to event cache (buffer).

    Photon server caches events per sender and expected target.
    It can clean up the cached events of the sender when the actor leaves. (Room.AutoCleanUp or RoomOption.CleanUpCacheOnLeave or PhotonNetwork.autoCleanUpPlayerObjects)

    But it does not keep track of who received a cached event at least once so it does not send it back on subsequent rejoins.
    If you want this behavior you need to implement it yourself using RaiseEvent to add and remove events from cache.
  • HeskethGames
    edited March 2018
    Options
    Hi JohnTube,
    Thank you for the reply and clarifying buffered information, will give your ideas a go.

    I really enjoy using Photon and found it meets the needs of my games and will hopefully continue to use it (and buy more licences as demand increases)

    However when it comes to handling players with dodgy internet connections I found that it is not so straight forward.
    To simply put, when a players connection wobbles/disconnects, trying to handle this and get them to carry on playing is a nightmare which is quite a contrast to how easy most of the other aspects of Photon are to use.

    Wobbly connections I have managed to sort out but disconnects are a lot more difficult. I try and use the ReconnectAndRejoin method but this is where it receives all the buffered information from the begging of the match instead of from where the player last disconnected.

    if ReconnectAndRejoin is the wrong function to use then any info/guides on how to handle such as common occurrence would be much appreciated.

    Cheers
    Rob