ActorCounter = 2 but ActorList contains only one actor !

JohnTube
JohnTube ✭✭✭✭✭
How this happened ? How to avoid it in the future ?
broken_room_1.png

Comments

  • Hi John,

    that is expected - sorry if the variable has bit of a missleading name, but - the ActorCount is a value that always goes up with each player joining the room is used for the "next" actorNr.

    -Philip
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited March 2015
    Hi Philip,

    I don't agree with you. I've been testing, logging and debugging the GameState field saved with Webhooks on Parse for more than 2 months. This was the first time it happened to me and I couldn't reproduce it. The proof that another Actor joined the room but he was not listed is both "IsVisible" and "IsOpen" fields ! I'm only setting them to false when the 2nd Actor successfully joins the Room.

    Here is what a normal Room with 1 Actor looks like :
    normal_room.png

    My guess is that there are two possible explanations :
    1- The Join operation(s) or Webhook requests got interrupted somehow, so the ActerCount got incremented but the 2nd Actor could not be listed.
    2- This is another proof of the existence of the issue (described in this topic and here also) of same Actor rejoining an old Room created with AsyncLobbyType.
  • Philip is on vacation this week. He will respond when he's back. Sorry for the delay.
  • JohnTube
    JohnTube ✭✭✭✭✭
    still on vacation ?
  • Hi Join,

    my apologies - you are right!
    The ActorCount should match with the actors in the list. Don't now where my head was that day.

    We'll have to investigate - we refactored that area quite heavily. And there where some updates
    to the cloud - so I'll need to check on what version this happened.

    What region are you using?

    -Philip
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi Philip,

    Sorry if I sounded a bit rude.

    Mainly "EU"...mainly because instead of a constant/static region I'm connecting the clients to the "best"/"closest" region possible.
    I'm using the the Turnbased SDK v4.0.0.4.

    Thanks,
    HL
  • Hi John,

    > Sorry if I sounded a bit rude.

    np problem at all - now that I'm getting my head back in ...

    There is
    a) "ActorCount"
    and
    b) "ActorCounter"

    ActorCount is sent as part of the CloseGame webhook and should match the number of Actors in the list.
    It evolved historically since it was a way for the first implementation to decide if they had to save the state.
    Where now we send a hint in Type="Save" or "Close". And was meant to disappear - but once you go live its hard
    to turn back - so we left it.

    ActorCounter is the one used for the next actor and is part of the State.

    I'm reviewing the code and I can't see anything obvious. But as I said we refactored this part of the code (we used to have two collections active and inactive) where now we just have one now with actors flagged as active or inactive making a lot of things easier for us, where we used to have some convoluted code regarding some checks during the join.

    And we are about to deploy this code. So I would suggest we keep an eye on the issue.

    Update: just seeing your screenshot - it only includes ActorCounter - not ActorCount!

    -Philip
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi Philip,

    Since the beginning I was talking about "ActorCountER" but I forgot the "ER" in the topic name and I've updated it now, my bad.
    But still I'm not convinced ! See the two screenshots I've provided and you'll get that your definition of State.ActorCounter is not correct and maybe you should invert I don't know.
    - ActorCount // only for GameClose webhook
    - State.ActorCounter // State is available only for GameClose, GameEvent and GameProperty

    Here is a link to what I came out with from debugging/logging args of the different webhooks and I've few questions that I will ask on a different topic. But you need to promise me that I'll get an answer this time as I've asked more than 2 times about this.
  • Here is a screenshot - showing what I mean with the actorcounter and the actorcount:

  • JohnTube wrote:
    Hi Philip,

    Since the beginning I was talking about "ActorCountER" but I forgot the "ER" in the topic name and I've updated it now, my bad.
    But still I'm not convinced ! See the two screenshots I've provided and you'll get that your definition of State.ActorCounter is not correct and maybe you should invert I don't know.
    - ActorCount // only for GameClose webhook
    - State.ActorCounter // State is available only for GameClose, GameEvent and GameProperty

    The ActorCounter is defintly not going to match -

    Please do the following to verify:

    player1 - CreateRoom => will get actornr 1
    player2 - Join => will get actornr 1
    player2 - Leave
    player2 - Join => will get actornr 2
    player2 - Leave
    player2 - Join => will get actornr 3
    player2 - Leave
    player2 - Join => will get actornr 4
    player2 => disconnect
    player1 => disconnect

    Now check your state. You should get something similar to my screenshot.

    Update: hope I was able to convince you now :).

    Update2:
    JohnTube wrote:
    Here is a link to what I came out with from debugging/logging args of the different webhooks and I've few questions that I will ask on a different topic. But you need to promise me that I'll get an answer this time as I've asked more than 2 times about this.

    looking at your link ...
  • JohnTube
    JohnTube ✭✭✭✭✭
    You're definitely using a different version of Photon server, Nickname instead of Username, DebugInfo, empty Region...

    Anyway, I'm good with ActorCount but I still can't get how the State.ActorCounter indicates that next actor is nr 4 and the actorNr 4 is already in the ActorsList ? Does the webhook Type has something to do with this ?

    Can the ActorCounter be higher than MaxPlayers ?

    HL
  • JohnTube wrote:
    You're definitely using a different version of Photon server, Nickname instead of Username, DebugInfo, empty Region...
    eagle eyes :) - but for the purpose of the ActorCounter its the same ...
    JohnTube wrote:
    Anyway, I'm good with ActorCount but I still can't get how the State.ActorCounter indicates that next actor is nr 4 and the actorNr 4 is already in the ActorsList ? Does the webhook Type has something to do with this ?

    Can the ActorCounter be higher than MaxPlayers ?

    HL

    The actorCounter is incremented right before the next actor is added to the room.

    The Type has nothing to do with the ActorCounter - the ActorCount in CloseGame does as I mention above the Type is just used as a hint/help to a webhook developer

    CloseGame has the types
    - "save" : meaning it makes sense to save the state - since there are inactive actors that might want to return
    and
    - "close" : meaning it doesn't make sense to keep the state around at least not for reloading purposes - since all actors left.

    And yes the ActorCounter can get higher as the Max - for instance in the flow above the room can have max=2 and it would work
    since there where never more than 2 player at the same time in the room.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Since I'm closing the Room when MaxPlayers is reached and setting the ActorNr when rejoining the Rooms I've never seen State.ActorCounter goes higher than State.MaxPlayers.

    But hey, now things are clear. Thanks.

    I hope I'll get the same attention next time. You didn't tell me your remarks about that link ? Maybe you can directly answer my questions by leaving comments there.
  • Hi John,
    JohnTube wrote:
    I hope I'll get the same attention next time. You didn't tell me your remarks about that link ? Maybe you can directly answer my questions by leaving comments there.

    You did a great work on your page - I commented all args. State and CreateOptions look fine - but i'll have another look next week.

    Thanks
    Philip