I have developed a online multiplayer HTML5 card game. This game can be played by four players.

Now I am having this confusion on what to do when a player left the game in the middle.

Possible strategies

  1. If player left the game intentionally(like pressing 'quit' button)
    1. Notify other players about this event and stop the game(This will be hated by other players as they have invested their time in this round of game)
    2. Notify other players about this event and assign bot to the position of this player. Penalize the player who left the game.(I think, this step will also decrease interest level of other players about the idea of playing with the bot)
  2. If player left the game unintentionally due to network glitch and he may reconnect to game.
    1. Wait for that player indefinitely(not a good strategy)
    2. Wait for that player for finite duration, if he/she is not reconnected then kick out that player and assign bot in his/her place.

Also, from technical point of view, it will difficult to know on server end that if player left due to network issue or simply he close his browser(or switch off his network)

Any suggestion on how I can handle this scenario ?

  • \$\begingroup\$ It sounds like you accurately understand your options. Which do you prefer, based on your understanding of your game and its audience (which is much deeper than ours — you're the expert here)? Have you hit any specific difficulty in implementing that preferred strategy that we can help you with? \$\endgroup\$
    – DMGregory
    Commented Sep 7, 2019 at 14:31
  • \$\begingroup\$ @DMGregory quite honestly I have not played many online multiplayer game, so am I missing any obvious strategy which I am unaware of ? \$\endgroup\$
    – Bhushan
    Commented Sep 7, 2019 at 14:36
  • 1
    \$\begingroup\$ "Is there anything I'm missing" usually doesn't get great answers on StackExchange. If you could be overlooking it, then so could your readers! So there's no way to give you a confident "no, this is everything" answer. StackExchange works better when you present a specific problem: "My situation is A, I'm trying to do B, but I have this unwanted outcome C. How do I make it more like D instead?" — then we can suggest ways to mitigate the undesired outcome or approach the desired outcome. This tends to get more deep, constructive, actionable answers. \$\endgroup\$
    – DMGregory
    Commented Sep 7, 2019 at 14:40
  • \$\begingroup\$ You should definitely have the player be replaced by a bot if he leaves on purpose, as it's no fun to have one person quit and end the game. \$\endgroup\$
    – Millard
    Commented Sep 7, 2019 at 16:44
  • \$\begingroup\$ It is possible in your game for one person to "lose" and be removed from the game, while the rest of the players are still playing? \$\endgroup\$ Commented Sep 9, 2019 at 10:03

5 Answers 5


It's just a matter of time until the players notice that they can avoid the rage-quit penalty by killing their web browser through the task manager. So you shouldn't try to differentiate between these cases.

Replacing the player with a bot is a good idea. It allows the other players to resolve the game in a satisfying manner.


Intentionally and unintentionally leaving should be treated the same, as it's impossible to be sure which scenario happened in every case (e.g. a user plugging out their network cable versus the connection dropping). The only exception is to not wait for them if they were to explicitly select a "concede" option (but otherwise treat this option the same).

Apart from that, I would say there isn't really a "right" answer to this. Some options just may not make sense for some specific game. Other than that, different games treat this differently for different reasons, and they may also have special cases (e.g. allow players to concede in tournaments, but not in regular play). Even games that are very similar treat this differently (e.g. League of Legends allows conceding most of the time while Dota 2 only allows this in some tournaments).

Note: Some of the below may be specific to 2-player (or 2-team) games, where one player losing automatically means the other wins, or was at least framed in terms of such games.

The main options I see (which aren't exclusive)

  • If a player disconnects:

    • Allow them to return indefinitely, for some time (after which you can go with one of the below options) or not at all.
    • Either pause (for a few minutes) or keep the game going while waiting for them to return, or give remaining players the option to pause (even when no-one disconnected, perhaps).

      Note: It should not be possible for a player to start a new game if they are being waited for in another game.

  • Allow a player to concede, after which they cannot return (and they can start a new game).
  • Replace the player who left with a bot (possibly without telling the players, which can be seen as deceptive and players may despise this if they find out or it's obvious). You may or may not want to give them a win either way.
  • Just end the game.
  • Allow players to choose whether they want to play with a bot or stop playing (with the game recorded as a win either way, even if they end up losing against the bot).
  • Just let the player who left either idle or "die" while keeping the game going.

To decide between the options, there are a few factors to consider

Note: A number of the factors listed below may indicate another problem with your game which would be best address directly instead of treating this one effect of that problem.

  • How much fun and how fast is ending a game (for each player)?

    If ending the game is the most enjoyable part of winning (which it often is, for a lot of people), you want to allow them to continue until the end.

    But an option to end the game (from either the losing players in the form of conceding, or the remaining players) may be useful if:

    • Ending the game is mostly a chore for both players.

    • A losing player is able to easily significantly delay the end of a game without really giving themselves a better chance of winning.

    • A winning player can indefinitely keep control of the game without ending it (which would be frustrating for the losing player).

  • How long are the games? How far along is this game?

    Players may prefer finishing games if they've already committed a lot of time to the game and it's almost done.

    They may prefer ending it if the disconnect happens after they barely started.

    If the games only take a few minutes, you probably don't want to wait for disconnected players nor give remaining players a choice in terms of what happens (in order to keep the pace going). But either replacing them with a bot or just ending the game could make sense.

  • How many other players are there?

    When there are multiple players in the game that needs to agree on something (whether it's the decision to concede or wait or continue with a bot), this could make things complicated and make players angry at other players or you. So one should be careful when implementing things like that.

  • How often do players leave? At which point in the game do they leave?

    Why they leave could depend on a number of factors, including which device they're playing on, which country they're in, what penalties there might be for leaving and a number of other things specific to the game. But the bottom line is how often they end up leaving. You'll probably need to look at the data of your game, or at least your target audience, to determine this.

    If the average player leaves often, anything other than silently replacing them with bots is likely going to be a huge irritation for the remaining players.

    If players very rarely leave, you could make a good argument for waiting for them.

  • The effect on the game, and teammates

    If there are just 2 players in the game, just ending the game could be a good option. But this is significantly worse when there are more than 2 players.

    You really, REALLY want to avoid having a tie any time a player leaves or telling players they lost while the game is still ongoing (in case of team games or if you just pick the leading player as the winner).

    If it's a team game, this would heavily favour a waiting option. Also, players may prefer to have their disconnected teammate just idle or die instead of being replaced by a bot which does "dumb" things.

  • Can players join a game as a team?

    If players can form a team with friends, you'd almost certainly want to at least give the option to wait for disconnected players, and you probably don't want to replace them with a bot.

  • What's the penalty for losing versus simply leaving a game?

    You may or may not want to treat these differently.

    If simply leaving is heavily punished (either in terms of bans or just significant ranking changes), that would make a good case for giving a disconnected player some time to return to the game.

  • Is the game "casual" or "serious"?

    In a "casual" game, it could make more sense to replace disconnected players with bots, whether silently or by asking the player first. You probably don't really want to do this with a game people are extremely passionate about, where they spend a lot of time trying to improve and there are tournaments and rankings and so on. For the latter, waiting for players would also make more sense.

  • What do your players think of playing with bots?

    If players choose to play with other players, it stands to reason they prefer this above playing with bots (obviously).

    How strong of a preference this is, however, and how this compares to other factors, would depend on the individual player, so this is something you could potentially A/B test.

  • How good are the bots?

    This is especially important to ranked play, where players would have a certain expectation for the skill level of their opponents and you almost certainly don't want to replace players with bots, or at least this should be recorded as a win regardless of the actual result. But this may also be applicable to unranked play.

    Having a bot that plays reasonably at all skill levels would likely be really difficult to achieve for a heavily skill-based game.

    The bot should ideally be slightly worse than the player who left, and preferably play somewhat similar to how a human plays.

    If they're better, this could suddenly make the game a lot harder, which will frustrate remaining players. If they're much worse, the game might become trivial to win, which may also frustrate players.

    If they don't "act human", the switch between a human player and a bot may be rather jarring for the remaining players.

    If they're either much worse or they don't "act human", silently replacing players with bots probably isn't a good idea.

  • What happens if players idle or "die"?

    If a player can idle, die or have anything they control be removed from the game entirely without it making extreme changes to how the game is played for the remaining players, this might be a good option.

    If the player has teammates, it might make sense to give any resources they might have or get to the other players instead, or allow their teammates to control their units.


we have standards for this. for both conditions there are solutions.

for intended disconnect, you can make any scenario based on your theme or game-play. for example in head ball 2 when a opponent exits, you receive the message that opponent was afraid of you and quit. or you can give winning score to opponent.

for un intended disconnect, most fair scenario is to give time to return. for example about 20 seconds to return. if that did'nt happen, just run the intended scenario.


If player quit intentionally: -assign a bot but don't notify other players, penalize the player. If player quit due to network: -assign a bot but don't notify other players, don't penalize the player, but allow him to rejoin if he get back online. And philipp said that the players could just close browser to avoid penalty, but what if you check if a player left the game from the other players ? I mean a script always run to detect if one of the player is a bot, if so find the player who left and give penalty.


This is actually the same problem as what you do if the player chooses not to act

Good game design in an online multiplayer turn based game will time out the player if they do not take their turn in a timely fashion, because otherwise a losing player can simply walk away from the game and force their opponents to wait it out or concede. You will have to decide what to do when this happens. In games based on traditional card games there is usually a requirement to act, so you will need to choose an action for the player anyway when they time out. If they don't need to act, you simply pass their turn.

All you need to do for the missing player is repeat this action each round, probably with a sharply reduced time out after the first missed round.

If they resume their connection while the game continues, they can be re-introduced into the game and take their action. If not, the game finishes without them and they take whatever penalty results from losing. If you think this can be abused, you can apply an additional penalty if they repeatedly disconnect during active games.

This model is successfully used in online 2-player games such as Hearthstone, but there's no inherent reason it cannot scale to more than 2 players.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .