Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#3253 closed defect (fixed)

[PATCH] Playernames not initialized correctly

Reported by: elexis Owned by: Itms
Priority: Must Have Milestone: Alpha 19
Component: UI & Simulation Keywords:
Cc: Patch:

Description (last modified by elexis)

"Player X" instead of the actual playername is displayed in many places, for example

  • in the wonder victory message ("Player X will have won in Y", see #3226)
  • in the tooltip of trade carts (getTradingTooltip in utility_functions.js)
  • in the tooltips for tributing resources
  • in the commands.txt file (correct playernames would be needed by visual replay #9 and the menu #3258)
  • If someone disconnects and another player resigns, then the name of the disconnected player will change to "Player X" in all places where the correct playername was printed before (for example in the panels or diplomacy menu). This is because updateDiplomacy() in messages.js overwrites the player data with the default playernames.
  • in the summary screen for disconnected players because of the bug above

Attachments (1)

t3253_copy_playernames_on_init.patch (1.7 KB ) - added by elexis 5 years ago.
Solves all the issues described above, except the trade tooltip, which will be handled in #3252.

Download all attachments as: .zip

Change History (10)

comment:1 by elexis, 5 years ago

Description: modified (diff)

by elexis, 5 years ago

Solves all the issues described above, except the trade tooltip, which will be handled in #3252.

comment:2 by elexis, 5 years ago

Keywords: patch review added
Milestone: BacklogAlpha 19
Summary: Playernames not initialized correctly[PATCH] Playernames not initialized correctly

comment:3 by sanderd17, 5 years ago

Does this also change the names in singleplayer games? I think "Player X" is clearer in single player, because you can't see the names in the gamesetup, and you'd have to remember difficult names.

I agree for multiplayer, it would be handy to see the actual nickname of your opponent.

in reply to:  3 comment:4 by elexis, 5 years ago

Replying to sanderd17:

Does this also change the names in singleplayer games? I think "Player X" is clearer in single player, because you can't see the names in the gamesetup, and you'd have to remember difficult names.

Currently the randomly assigned names of the bots are displayed in the HUD and diplomacy menu. The only places where "Player X" for bots is displayed is in trade carts, tribute tooltip, wonder victory message, etc. (see above). So there is no way to distinguish the hard bots from easy ones currently excepting looking in one of those strange places and remembering the player ID. I think no one has ever done that X)

The patch works correctly and saves the assigned names of the bots to the playername variable. It should be this way for consistency, so that trade carts, wonder victory message etc. display the same value as in other places.


If you want to make it easier for the player to identify the hard bots, then the difficulty should be displayed in the diplomacy menu, or when selecting entities of that player (similar to the '(Offline)' label, which is added to the entities of disconnected players.

Im also planning a new session dialog that displays all map settings and the FPS and ping of other players (to identify the lagger). That info could be displayed there as well (see #3263).

Last edited 5 years ago by elexis (previous) (diff)

comment:5 by elexis, 5 years ago

sanderd17 noted on IRC today that the botnames are translated and therefore might cause an out-of-sync error when saving them. However that is not the case, since the host decides the playernames when the game is started. All clients will then see the names in the translated version of the host (with and without the patch above).

If you want to translate the botnames for each client individually, you would have to identify all places in the GUI where a playername is used and translate it just in time, since you can't translate in the simulation code (Player component and GuiInterface). Sometimes the name is accessed by the player assignments, sometimes by the Player component, sometimes by the simulation state.

The patch above saves the name from the assignment to the player component, so that it is identical and not "Player X", should be good enough.

To be done in #3307

Last edited 5 years ago by elexis (previous) (diff)

comment:6 by elexis, 5 years ago

Description: modified (diff)

comment:7 by Itms, 5 years ago

Owner: set to Itms
Resolution: fixed
Status: newclosed

In 16838:

Give players and bots their actual name during the game, for better experience.
Patch by elexis, fixes #3253

comment:8 by Itms, 5 years ago

Keywords: patch review removed

In the situation here you had to use for.. of (and also using let whenever possible is better, as usual).

Thanks for the patch!

comment:9 by Itms, 5 years ago

In 16839:

All work and no play... refs #3253

Note: See TracTickets for help on using tickets.