feature request: better connection management in multiplayer

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderator: Forum Moderators

Post Reply
meriton
Posts: 77
Joined: March 17th, 2007, 1:17 pm

feature request: better connection management in multiplayer

Post by meriton »

Hello,

One thing that bugs me about playing wesnoth in multiplayer is the rather unstable nature of the connection management code. For instance, I had the following troubles today:

1. I joined the server, and tried to join a game as spectator to inquire whether an era was needed. I got the progress bar indicating download progress, which didn't move for about half a minute. I then hit cancel, and was returned to the main menu.

2. I logged in again (was forced to pick another user name), and joined the same game as player. It worked, and I was in the game lobby. I had time to ask whether an era was needed, but received no reply on my screen, and a little later got a message I had lost the connection again.

3. I logged in again (with yet another username), succeeded in joining the game in spectator mode and we managed to start it. Sometime during turn 1 I lost the connection again (as usual wesnoth took a while to notice and inform me of that fact).

4. Suspecting packet loss, I killed the filesharing application (which previously I had merely throttled to use 50% of my nominal bandwith), logged in again, joined the game again, and got control of my hero. We then played a couple of hours without problems, until suddenly the game froze during an ai turn; the host had lost the connection. Before we could decide on a remedy, another player left. We would have had to wait until the host noticed the connection loss, and loaded a saved game. Since the game was nearly over we gave up instead.

Yesterday, I played a game hosted by somebody else, and got accused of moving extremly slowly. After quite some talking, we discovered that when the host thought I was delaying, my client still showed it was the ai's turn (this took about 45 seconds each turn). Only when the server restarted halfway through the game, and I hosted the reload, did the problem disappear.

---

What I'd like to see improved is:

1. The connection should not break that easily. After all, my filesharing application experienced no problems and used the same internet connection.
2. If a connection does break, this should be detected within seconds rather than minutes. This would free the user name again, allow a host transfer in case the host has lost the connection, and prevent people from mistakenly thinking they are still connected (and consequently getting angry at other players because they appear not to move, or not to reply to messages).
3. It should not be possible that players are left waiting for half a minute with each player's client showing it is the other's turn.

A fix for these issues would be appreciated.
joshudson
Posts: 501
Joined: January 17th, 2006, 8:04 pm
Contact:

Post by joshudson »

[blockquote]1. The connection should not break that easily. After all, my filesharing application experienced no problems and used the same internet connection.[/blockquote]

Wesnoth uses the same API calls for connections as your filesharing application.

[blockquote]2. If a connection does break, this should be detected within seconds rather than minutes. This would free the user name again, allow a host transfer in case the host has lost the connection, and prevent people from mistakenly thinking they are still connected (and consequently getting angry at other players because they appear not to move, or not to reply to messages).[/blockquote]

I'm not sure but I think I saw that in the changelog.

[blockquote]
3. It should not be possible that players are left waiting for half a minute with each player's client showing it is the other's turn.
[/blockquote]

This is a derived error from #2 or Out of Sync (OOS) errors.
CHKDSK has repaired bad sectors in CHKDSK.EXE
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

Soliton and Dave are working on some changes to the server networking code, which may address some of your complaints.

(irclog for details...)
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
meriton
Posts: 77
Joined: March 17th, 2007, 1:17 pm

Post by meriton »

joshudson:
"same api calls": How can you tell without knowing which filesharing app I used? And how do you explain that the filesharing client continued working when wesnoth failed every couple of minutes?

"This is a derived error from #2 or Out of Sync (OOS) errors."
My observations appear to indicate otherwise. The described problem happened every turn until the server restarted. During that time, I did not receive an OOS-error, nor did anybody have to reconnect to continue the game.

Sapient: Good to know it's being worked on.
Carnildo
Posts: 6
Joined: November 18th, 2007, 1:29 am

Post by Carnildo »

meriton wrote:joshudson:
"same api calls": How can you tell without knowing which filesharing app I used?
Presumably an understanding of how networking works. It's theoretically possible for the filesharing app to use raw sockets and run its own TCP or UDP stack, but in practice, every program out there uses the same API for networking.
And how do you explain that the filesharing client continued working when wesnoth failed every couple of minutes?
Wesnoth needs data transfer to take place in near-real-time. A filesharing app only needs the data to get there eventually -- it doesn't matter if it takes half a second or half a day.
Soliton
Site Administrator
Posts: 1687
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: feature request: better connection management in multipl

Post by Soliton »

meriton wrote:What I'd like to see improved is:

1. The connection should not break that easily. After all, my filesharing application experienced no problems and used the same internet connection.
The problem with file sharing programs is that they make a *lot* of connections which some routers for example don't handle well. Comparing the one connection wesnoth maintains vs the hundreds? of your file sharing program is a bit silly anyway. I doubt you notice when your file sharing program loses a connection.. The way a file sharing program and wesnoth use networking connections is usually quite different.
meriton wrote:2. If a connection does break, this should be detected within seconds rather than minutes. This would free the user name again, allow a host transfer in case the host has lost the connection, and prevent people from mistakenly thinking they are still connected (and consequently getting angry at other players because they appear not to move, or not to reply to messages).
Well, there are two sides to detecting a network disconnection, the server and the client side. Since recently the server sends a ping every 5 minutes to make sure ghost users are detected. I've now changed that to every 10 seconds and actually process the pings on the client side to see if/how much we're lagging. If the client did not receive a ping in the last 30 seconds it'll consider itself disconnected. We'll see how that works out when 1.3.12 is out..
meriton wrote:3. It should not be possible that players are left waiting for half a minute with each player's client showing it is the other's turn.
This can happen with network lag or if one player is still processing the moves it received from the last turn. Different animation speed settings for example could cause that. No idea what you expect to be done about that.
"If gameplay requires it, they can be made to live on Venus." -- scott
Samantha
Posts: 65
Joined: December 13th, 2007, 3:50 am

Post by Samantha »

Wesnoth needs data transfer to take place in near-real-time. A filesharing app only needs the data to get there eventually -- it doesn't matter if it takes half a second or half a day.
First of all, I use 1.3.12 and I get an awful lot of OOS problems. But me question is: why does a turn based game require near-real-time? Couldn't one client just calculate the move and send the results back to the server?
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Samantha wrote:But me question is: why does a turn based game require near-real-time? Couldn't one client just calculate the move and send the results back to the server?
People would probably mind if the game took half a day to transmit their moves. ;) Really, anything more than a few seconds would be unacceptable, and even that's not really desirable...
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
Weeksy
Posts: 1017
Joined: January 29th, 2007, 1:05 am
Location: Oregon

Post by Weeksy »

samantha, what eras/addons (if any) are you using when you get these oos issues? 1.3.12 is rather oos free, and so it could be poorly coded or out-of-date addons. If you don't have the most recent version of an era, lots of oos will ensue. If you're not using any addons, the most likely cause of your problems will be the fact that you didn't install into a clean folder, and instead put 1.3.12 over an old version of wesnoth. That causes much oos. To remedy this, delete everything but your userdata folder in whatever folder(s) 1.3.12 is in, and then reinstall it.
If enough people bang their heads against a brick wall, The brick wall will fall down
Samantha
Posts: 65
Joined: December 13th, 2007, 3:50 am

Post by Samantha »

I have used some addons and customizations previously but I deleted them when I reinstalled. Made sure to trash both the application itself and my userdata folder.

I just reinstalled again, I have a mac so I tossed the application and my userdata folder in ~/Library/Preferences/Wesnoth along with the .plist file org.wesnoth.plist next to it.

I use a Mac by the way. Let's see if this last reinstall fixes anything, otherwise I'll post my savegames and error reports here.
Post Reply