Multiplayer network problems go unnoticed

Bug #1434875 reported by Teppo Mäenpää
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Undecided
Unassigned

Bug Description

If there are network problems, desyncs, or alike problems in a networked multiplayer game, a notification is put to chat window but apart from that, the game continues as before, AI takes over the tribe of the player that dropped out.

This is a problem:

1: The whole message might go unnoticed, if the attention of the host is elsewhere.

2: Even if this is noted, it usually takes a dozen seconds or so (wallclock time; many games run >1x speed) before the game is saved, and then reloaded. During that time, the AI aggressively modifies the economy of the tribe towards its own way. The resuming player then has a false impression of the state of hist tribe, and might later find his economy to be crippled, as the AI dismantled buildings he assumed to still be there.

Possible fix:

In multiplayer, whenever a player (not observer) leaves, the game is paused and there is a pop-up offering a pause->save->return to lobby and assign-AI->then-continue. If this a question that must be answered before continuing, the situation would surely not go unnoticed. Also AI would not have its half-a-minute gametime to mess things up.

Related branches

tags: added: multiplayer network savegame
Revision history for this message
Albert Einstein (w-aaaaa) wrote :

For me it should be like message: "you can continue a game with AI or save and exit" It will be just fine for most people :) Restarting the game always takes lots of time.

Revision history for this message
TiborB (tiborb95) wrote :

I am just curious - such disconnected player can go on with playing without noticing anything?

In regard to the bug itself, the host should at least trigger the game save, before initializing the AI.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

A player that has been disconnected will not go on, but the others do.

Revision history for this message
TiborB (tiborb95) wrote :

So f.e. gametime on his screen is stopped?

Revision history for this message
Teppo Mäenpää (kxq) wrote :

quite right, the gametime stops progressing.

The gametime of other keeps progressing, and AI takes over the tribe of the disconnected player.

Revision history for this message
Teppo Mäenpää (kxq) wrote :

(other -> others)

GunChleoc (gunchleoc)
Changed in widelands:
status: New → Confirmed
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Yes had just this same Problem, too, when I found #1542905

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

There is a general Problem with Error Hanlding in that networking code, but I think we can postpone this after rc19.

e.g. the lists will will be inconsistent after a disconnect.
But this requires a _complete_ testcase mocking the sockets etc. and will take quite some effort.

GunChleoc (gunchleoc)
tags: added: desync
Revision history for this message
Teppo Mäenpää (kxq) wrote :

Players leaving multiplayer game are such a rare event that nobody's playing experience is crippled by this question.

Should only the host get this question, or everybody?

I could imagine that in some situations the host is actually an observer, and is not vigorously monitoring the screen all the time.

Notabilis (notabilis27)
Changed in widelands:
status: Confirmed → In Progress
assignee: nobody → Notabilis (notabilis27)
Revision history for this message
Notabilis (notabilis27) wrote :

I started working on this and would like some feedback/opinions regarding my current state.

On the host, if the connection to a client is lost, the host does:
- Pause game
- Save the game
- Display dialog (see attachment)
- Wait for the decision of the host and execute it
- Unpause the game

The host can select whether to replace all disconnected clients (might be multiple at the same time) with a Normal/Weak/Very Weak/Empty AI or to abort the game.
This only happens if a player disconnects, no action is done when an observer disconnects.

I haven't changed the client side, there an already existing "autosave + messagebox + continue with AI action" is implemented.
For now, I ignored the "host player is not on computer right now" case mentioned in #9. I think with the introduction of the relay for internet games this doesn't happen often any longer.

Two problems I am having currently (hints are appreciated):
- The dropdown button is much darker than the other buttons. Is it possible to change that?
- I would like to not display the dialog for defeated and/or victorious players but silently replace them. Does anyone know how to find out if a player is defeated?

Revision history for this message
GunChleoc (gunchleoc) wrote :

1. Use PanelStyle::kWui in the dropdown's constructor call, then have a look at BaseDropdown::BaseDropdown to go bug hunting and find out why it's still dark. Styles are defined in data/templates, there might also be a bug there.

2. Shift the code from LuaPlayer::get_defeated into the Widelands::Player class. Whether a player has won gets triggered by the win condition script, which calls report_result in the game controller. Maybe you can use some of that.

Revision history for this message
Notabilis (notabilis27) wrote :

Thanks for the hints, they were quite useful.

1. As far as I see it, there isn't really any bug in the code or template. Only two styles are supported by BaseDropdown and both of them are defined as dark. Since supporting more styles would lead to other problems, I decided to live with the dark color for now. Its a small issue, anyway.

2. As it turned out, this leads to the state of the player being stored in some structure. So in the end I was able to get the current state of a player without modifying the code.

GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Fix Committed
milestone: none → build20-rc1
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-rc1

Changed in widelands:
assignee: Notabilis (notabilis27) → nobody
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.