Latest Posts

Topic: Gametime difference between host and client

kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 19:48
Posts: 2488
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2023-11-16, 14:08

In the end of my tournament match against carli2 (host) there was in the end time difference about 21sec between his game and mine. In Result i got the "You have won message" ~ 20 sec earlier than he got the "You have lost" message. Since the game was extreme laggy in the end and the chat didn't worked either i leaved the game, whereas carli2 had 20 sec to play and saw me leaving the game, probably thinking i surrendered.

  • How is such a time difference possible?
  • Is this a bug of the metaserver or of widelands?

Did this happened in other widelands multiplayer matches too?


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 22:16
Posts: 2699
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2023-11-16, 14:15

How did you see or measure the time shift. from watching his stream and my game I thought I realized such shift as well however it might have been due to the stream being approx 20 sec late. As he hosted his machine was probably doing some calculations that your machine did not need to do and these were blocking the Game end status window by some mutexes.

Edit: However the lag that I encountered multiple times as well is really annoying and I believe we need to find the root cause for this before we could release something.

Edited: 2023-11-16, 14:16

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 17:07
Posts: 2002
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2023-11-16, 14:16

This is a known problem when the game is laggy for a player. In a multiplayer game the simulation always happens in steps: The host tells all clients to simulate until a specific gametime X. Then all clients do so independently and tell the host when they're done. Then all clients pause until the host tells them to simulate until the next gametime Y. And so on.

As long as the game stays responsive for everyone, these time intervals are very short and imperceptible. But when it lags then a simulation step that costs a few milliseconds realtime for one player can take many seconds or even minutes for another.


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 19:48
Posts: 2488
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2023-11-16, 14:30

hessenfarmer wrote:

How did you see or measure the time shift.

I watched the video today on twitch and close to the end i wrote in the chat "Noch 5s und es laggt ohne ende". Since he streamed on twitch you can see his playtime as i wrote this, and his playtime was 3:59:16, so his game was ~ 20 sec later, no 30 sec face-surprise.png

Thanks for the explanation Nordfriese. BTW: Glad you are not ill anymore face-smile.png


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote