Giter Site home page Giter Site logo

Comments (7)

merowin avatar merowin commented on September 25, 2024 2

Please go ahead and land the PR (when you are ready). All in all, I think It'll be easier to fix it afterwards.

And sorry for breaking it 😬

No problem! 😆

from govariants.

benjaminpjones avatar benjaminpjones commented on September 25, 2024 1

I believe the second issue "two players time out in the same round" is a race condition. It is very easy to trigger if it happens in the first timed round, but otherwise shouldn't happen often.

To repro:

  1. Set up 4 player parallel game (or any parallel variant with >2 players).
  2. Finish round 1 to start the clock
  3. play moves for player 0 and player 1
  4. Wait for player 2 and player 3 to timeout

Results:

It appears that the timeout for player 3 is overwritten or never occurs. If there is a race, it means that neither timeout will detect that the round ends.

Timeout in round two, simultaneous, BAD:

    "forPlayer": {
      "0": {
        "clockState": {
          "remainingTimeMS": 30000
        },
        "onThePlaySince": "2024-04-14T20:29:43.452Z",
        "stagedMoveAt": "2024-04-14T20:30:03.660Z"
      },
      "1": {
        "clockState": {
          "remainingTimeMS": 30000
        },
        "onThePlaySince": "2024-04-14T20:29:43.452Z",
        "stagedMoveAt": "2024-04-14T20:30:05.363Z"
      },
      "2": {
        "clockState": {
          "remainingTimeMS": 0
        },
        "onThePlaySince": null,
        "stagedMoveAt": null
      },
      "3": {
        "clockState": {
          "remainingTimeMS": 30000
        },
        "onThePlaySince": "2024-04-14T20:29:43.452Z",
        "stagedMoveAt": null
      }
    }

On the other hand, if the timeouts happen at different times, the round will get reset accordingly:

Here's a timeout in round 3, GOOD:

"forPlayer": {
      "0": {
        "clockState": {
          "remainingTimeMS": 26840
        },
        "onThePlaySince": "2024-04-14T20:38:37.323Z",
        "stagedMoveAt": null
      },
      "1": {
        "clockState": {
          "remainingTimeMS": 23038
        },
        "onThePlaySince": "2024-04-14T20:38:37.323Z",
        "stagedMoveAt": null
      },
      "2": {
        "clockState": {
          "remainingTimeMS": 0
        },
        "onThePlaySince": null,
        "stagedMoveAt": null
      },
      "3": {
        "clockState": {
          "remainingTimeMS": 0
        },
        "onThePlaySince": null,
        "stagedMoveAt": null
      }
    }

from govariants.

merowin avatar merowin commented on September 25, 2024

About the Scenario with 4 players, one times out <- I've tested this in the past, and it used to work. I'm not sure what exactly is going wrong, it looks like all 4 players time out at (almost) the same time for some reason.

from govariants.

merowin avatar merowin commented on September 25, 2024

I have found out the reason for this bug. The new function MakeTransition takes the move as input parameter. However in parallel time control, a move from any player may trigger a round transition. At this point we don't know the moves of other players, and it seems that the transition (with this move) is used for all players. In the event that the move is "timeout", the transition sets all player times to 0. Then all players immediately time out.

from govariants.

merowin avatar merowin commented on September 25, 2024

I'm not sure how to fix it without disrupting your bigger PR.

from govariants.

benjaminpjones avatar benjaminpjones commented on September 25, 2024

Ohh oh no! Thank you for root causing. And sorry for breaking it 😬

I'm not sure how to fix it without disrupting your bigger PR.

Should I go ahead and land it then? Or I am also okay with dealing with some merge conflicts if we need to fix before landing

from govariants.

benjaminpjones avatar benjaminpjones commented on September 25, 2024

Linking related issue #226, which also needs a solution to race conditions

from govariants.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.