Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server lost player priority on lagged games aka all players wait each other #4448

Closed
JayDi85 opened this issue Jan 27, 2018 · 1 comment
Closed
Assignees
Labels
bug Bugs and errors server

Comments

@JayDi85
Copy link
Member

JayDi85 commented Jan 27, 2018

Client-server connections can be de-synced if the game have too slow or lagging players. E.g. there are possible weird error "all players wait each other priority" (players can only concede).

Broken code examples (player 2 must take action)...

Ideal (works fine):

server got new priority step (e.g. main phase);
server send player 1 message about priority;
server send player 2 message about priority;
server send player 3 message about priority;
server send player 4 message about priority;
server wait answer from player 2;
player 2 send answer to server;

If player 2 too fast to answer or player 3 or 4 got connection lags then server will stuck on sending process and do not switch to wait mode. That's why player 2 answer will be ignored. But after that player 2 can't answer again -- only "concede" can work (it's non priority command).

Bad (broke the game):

server got new priority step (e.g. main phase);
server send player 1 message about priority;
server send player 2 message about priority;
server send player 3 message about priority;
player 4 got lagged;
player 2 send answer to server;
server send player 4 message about priority;
server wait answer from player 2;

Load testing can help to find out that bad things -- I'm rewrote that tests (see mage-tests->load folder), they are was broken and do not work (e.g. got priority errors and other things).

Now that load tests works fine and you can test server stability and performance by run test_MultipleGames test (change MAX_GAMES to max parallel games).

Code example for player's request/answer sync:

prepareForResponse(game);
if (!isExecutingMacro()) {
  game.fireChooseChoiceEvent(playerId, choice);
}
waitForResponse(game);
public void setResponseString(String responseString) {
  waitResponseOpen();
  synchronized (response) {
    response.setString(responseString);
    response.notifyAll();
    logger.debug("Got response string from player: " + getId());
  }
 }
@JayDi85
Copy link
Member Author

JayDi85 commented Feb 3, 2018

Fixed in v2.

@JayDi85 JayDi85 closed this as completed Feb 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs and errors server
Projects
None yet
Development

No branches or pull requests

1 participant