[1.1.107] Player being renamed on load

Bugs that are actually features.
User avatar
Cooldude2606
Fast Inserter
Fast Inserter
Posts: 108
Joined: Sat Sep 16, 2017 9:04 pm
Contact:

[1.1.107] Player being renamed on load

Post by Cooldude2606 »

When a multiplayer game is saved and then loaded in singleplayer, if you do not exist in the save game then the player with index 1 will be renamed to match your name. This is inconsistent with loading single player save games where you play as index 1 but the player is not renamed.

This results in a scenario where `on_player_joined_game` is raised with a player who's name was never raised by `on_player_created`.
This causes issues where on join has a dependency on actions performed within on created, such as modifying the global table.
It also contradicts previous comments about player names not changing.

Reproduction Steps:
  1. Start a new multiplayer game.
  2. Save the game (A).
  3. Change your name in the settings.
  4. Load (SP) save A and note that you are playing as index 1 without being renamed. (expected)
  5. Host (MP) save A and note that you are playing as index 2 as a new player. (expected)
  6. Save the game (B).
  7. Load (SP) save B and note that you are playing as index 2 as the same player. (expected)
  8. Change your name in the settings.
  9. Load (SP) save B and note that you are playing as index 1 but have been renamed. (unexpected)
This was found while investigating a bug report for a mod but was reproducible in vanilia.
--- Developer for Explosive Gaming and Clusterio. Please contact me via our Discord. ---
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3522
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.107] Player being renamed on load

Post by boskid »

We decided this is working as intended. In single player world it is assumed you are the owner of the world and it will change the name of the player.
User avatar
Cooldude2606
Fast Inserter
Fast Inserter
Posts: 108
Joined: Sat Sep 16, 2017 9:04 pm
Contact:

Re: [1.1.107] Player being renamed on load

Post by Cooldude2606 »

boskid wrote: Thu Oct 17, 2024 5:31 pm it will change the name of the player.
In which case this is still a bug because in step 4 of my previous message, it does not change the name of the player when loading in single player.

(Now running on 1.1.110)
To describe more clearly:
1) "Host new game" (freeplay)
2) "Save game" as "A"
3) Quit to menu.
4) Change your name in settings.
5) "Host saved game" ("A")
6) "Save game" as "B"
7) Quit to menu.
8) Change your name in settings.

Now if you load save game "A" in single player, your name is not changed.
But if you load save game "B" in single player, your name is changed.

This is inconsistent behaviour based on the number of players who are in the save file. "A" contains one player, you are not renamed; "B" contains two players, you are renamed. I believe it should never rename the player so that mods can rely on the player created event to setup data. But if it was decided that the player should be renamed then they should always be renamed and not be dependent on the number of players in the save file.
--- Developer for Explosive Gaming and Clusterio. Please contact me via our Discord. ---
Rseding91
Factorio Staff
Factorio Staff
Posts: 15033
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.107] Player being renamed on load

Post by Rseding91 »

Once you load a save in multiplayer it is forever marked as in-multiplayer and so you can never "load it in single player" from that point of view.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”