FreeCol / freecol

FreeCol: FreeCol is a turn-based strategy game based on the old game Colonization, and similar to Civilization. The objective of the game is to create an independent nation.
GNU General Public License v2.0
584 stars 170 forks source link

Cannot resume multiplayer due to server.userNameNotPresent error #63

Open SteeveDroz opened 4 years ago

SteeveDroz commented 4 years ago

Version

freecol v0.11.6 on Linux/Fedora 31

Description

NOTE: I'm using FreeCol in French, so the name of the menus can differ slightly as I translate them into English on the fly.

On a hotseat game (2 clients on the same computer, one as the owner of the game), with a previously saved game, Player 1, the owner, opens the saved game and waits for Player 2.

Player 2 clics on "New game" and chooses "Join a multiplayer game" with server 127.0.0.1:3541. He also chooses "Player 2" as his name.

If Player 2 chooses his own previous nation, an error message tells him that the username isn't present in the game.

WARNING: ServerAPI. login error, messageId: server.userNameNotPresent message: Player "Guillaume Ier" is not present in the game. Known players = ( Player 1 Player 2 Louis XIV Élizabeth Iere )

Desired behavior

Use the name specified in the "Name" field as the username instead of the default name for the nation.

Why am I sure the problem comes from there?

If Player 2 chooses another nation, when prompt, he can take it without a problem.

Workaround

Unzip the saved game, change name="Player 2" to name="Guillaume Ier" and rezip the saved game, but seriously, that's not even an option for lambda users.

SteeveDroz commented 4 years ago

I tried to fix the bug, but the codebase is so huge that I lost myself :-( My starting point is the following: https://github.com/FreeCol/freecol/blob/abd48eca2adeb5a9055be7fb5654e8ef6bef59a6/src/net/sf/freecol/common/networking/LoginMessage.java#L271

I hope it can help someone!

mpope042 commented 4 years ago

Have you tried using a nightly release? This code has changed a fair bit since 0.11.6.

dvr-1com commented 3 years ago

Yep. On freecol-git-20201224 error confirmed

dvr-1com commented 3 years ago

Here is some workaround: https://github.com/dvr-1com/saveFix

markusschaber commented 2 years ago

This error seems still present on 20220217. We ran into a freeze while trying to negotiate peace between two human players (both on Windows 10). The client of the user sending the peace offer froze when the other user accepted the offer without changing. After killing the frozen client, I cannot rejoin, getting this error. However, it seems I could join as spanish (which is an AI player).

Calebrw commented 2 years ago

This error seems still present on 20220217. We ran into a freeze while trying to negotiate peace between two human players (both on Windows 10). The client of the user sending the peace offer froze when the other user accepted the offer without changing. After killing the frozen client, I cannot rejoin, getting this error. However, it seems I could join as spanish (which is an AI player).

Sorry this is happening. @mpope042 can take a look at some point, but I can't make any promises.

markusschaber commented 2 years ago

At least we have the workaround of editing the name within the savegame, or manually entering the default name when starting the game.

mpope042 commented 2 years ago

Please try the new release 0.12.0 and see if the problem is still there.