Skip to content

replaces player names with randomized name#340

Merged
evanpelle merged 32 commits into
openfrontio:mainfrom
Aotumuri:block-bad-username
Apr 23, 2025
Merged

replaces player names with randomized name#340
evanpelle merged 32 commits into
openfrontio:mainfrom
Aotumuri:block-bad-username

Conversation

@Aotumuri

@Aotumuri Aotumuri commented Mar 25, 2025

Copy link
Copy Markdown
Member

This PR replaces player names with randomized name
The goal is to reduce exposure to inappropriate or offensive names.
Additionally, content creators no longer need to worry about displaying other players’ usernames.
スクリーンショット 2025-03-25 23 03 37
スクリーンショット 2025-03-25 23 03 48
Use the upper left button (Ninja) to change settings.
スクリーンショット 2025-03-25 23 04 03

Fixes #489

@Aotumuri

Copy link
Copy Markdown
Member Author

This PR is my first change of code in the game.
I have debugged it on my end, but I would like to see it in someone else's environment as well, so if you are willing to help, please do.
Thanks!

...
um..
In other words, I don't think the merge should be done once.

@gqdc gqdc mentioned this pull request Mar 25, 2025
@Aotumuri

Copy link
Copy Markdown
Member Author

I've had a few people debug it, but more are needed.
But so far no problems have been reported so I think we are good to go.

@Aotumuri

Aotumuri commented Mar 25, 2025

Copy link
Copy Markdown
Member Author

Since I’m using localStorage, I understand that a bug can occur when playing the game in multiple tabs of the same browser.
Should I fix this issue?
I’m planning to fix it if playing in multiple tabs is considered a legitimate use case.

@VariableVince

Copy link
Copy Markdown
Contributor

Players call each other out like 'GG' in discord with screenshot of game. Or a youtuber says "[player name] is good" in their vid. Etc. Is there a way for recognizability to still be possible? A user knowing their random name for example, by assigning them the same name each time? Or some other unique identifier.

I may be totally wrong here and misinterpreting this PR, in that case sorry

@Aotumuri

Copy link
Copy Markdown
Member Author

Players call each other out like 'GG' in discord with screenshot of game. Or a youtuber says "[player name] is good" in their vid. Etc. Is there a way for recognizability to still be possible? A user knowing their random name for example, by assigning them the same name each time? Or some other unique identifier.

Random names are generated each time on the client side of each game.
So it is difficult to know who is who.

スクリーンショット 2025-03-26 10 28 25

@Aotumuri

Copy link
Copy Markdown
Member Author
スクリーンショット 2025-03-26 10 37 16 Bot names are now underlined.

@Aotumuri

Copy link
Copy Markdown
Member Author
スクリーンショット 2025-03-26 10 41 06 Player names are in bold.

@Aotumuri

Copy link
Copy Markdown
Member Author

Perspectives from test_name. (RandomName on)
スクリーンショット 2025-03-26 10 43 34

Perspectives from Anon826. (RandomName off)
スクリーンショット 2025-03-26 10 43 47

@VariableVince

Copy link
Copy Markdown
Contributor

Random names are generated each time on the client side of each game. So it is difficult to know who is who.

Yeah so each player each game will see their own randomized set of player names on their own screen. I could see it have an effect on player engagement, not being able to recognize eachother. While i also see the positives in no offensive names. Not one of the developers though (yet) and this may have already been discussed with Evan, so just my two cents.

(There's work being done on a discord login, which could be tied to a saved random name that stays with a player longer but i don't know. And you cannot force login or discord account maybe. Also there's work on clans with tags which may interfere.)

@Aotumuri

Copy link
Copy Markdown
Member Author

If a team mode is implemented, should we put in a process to remove the random when the same team is used?

@VariableVince

Copy link
Copy Markdown
Contributor

Good idea and i like seeing who is bot or player by underlined/bold name.

Also, maybe let player toggle random names on or off? A streamer not wanting to show offensive names, toggles random names on. A player sitting home alone and not really caring what they see, toggles random names off.

Then you still have the 'recognizability issue' (if it even is the issue i make of it) but user has a choice at least. But offensive names may still end up in screenshots shared and damage OpenFront rep.

Or, again, some way to do this but server side to keep track and assign the same random name to each player as much as possible. And show the player what name is displayed at others' screens.

Or only offensive names are randomized so only they suffer from not being recognizable, but that's basically what's already being done and hard to filter everything out.

@Aotumuri

Copy link
Copy Markdown
Member Author

You can change this system on the start screen.
スクリーンショット 2025-03-26 11 19 57
スクリーンショット 2025-03-26 11 20 10

@Aotumuri

Copy link
Copy Markdown
Member Author
スクリーンショット 2025-03-26 15 03 01 Bot will use italics

@Aotumuri

Copy link
Copy Markdown
Member Author

Right now, I’m using randomized bot-style names to hide player identities.
However, someone suggested that a single, memorable word — like a flower name — might be better.
Which approach do you think works best?

@evanpelle

Copy link
Copy Markdown
Collaborator

Instead of using Math.random, hash the name using simpleHash() function (should be in Util.ts) and use the hash to get a random name. Having repeatable names is important, especially when replaying games.

@evanpelle

Copy link
Copy Markdown
Collaborator

Instead of putting in the top left, why not include it in the settings?

@icslucas icslucas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good, works in game and no bugs where found.

Comment thread src/client/RandomNameButton.ts Outdated
Comment thread src/core/game/UserSettings.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
Comment thread src/core/Util.ts Outdated
Comment thread src/core/Util.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
@Aotumuri

Copy link
Copy Markdown
Member Author

I’ve updated everything except the part that fetches the username from local storage.
Please take a look and let me know if it looks good.

@Aotumuri Aotumuri requested a review from evanpelle April 16, 2025 12:35
Comment thread src/core/game/UserSettings.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
Comment thread src/client/graphics/layers/OptionsMenu.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
@Aotumuri

Copy link
Copy Markdown
Member Author

I’ve addressed all the comments—either by making changes or replying to them.

@Aotumuri Aotumuri requested a review from evanpelle April 18, 2025 13:18
@samisbakedham

Copy link
Copy Markdown
Member

Is this off by default?

@Aotumuri

Copy link
Copy Markdown
Member Author

Is this off by default?

ofc, this is off by default

@APuddle210

Copy link
Copy Markdown
Contributor

I’ve addressed all the comments—either by making changes or replying to them.

@Aotumuri, you should also click the 'resolve' button. If there are any unresolved when Evan approves it, it won't merge. Even after approving them again, Evan will have to come back to specifically merge it. A couple PRs from early march never got merged, despite being approved, I think because of this.

@Aotumuri

Copy link
Copy Markdown
Member Author

スクリーンショット 2025-04-20 8 06 01

Comment thread src/core/Util.ts Outdated
Comment thread src/core/game/GameView.ts Outdated
@Aotumuri Aotumuri requested a review from evanpelle April 21, 2025 08:48
@Aotumuri

Copy link
Copy Markdown
Member Author

@evanpelle I fixed

@evanpelle

Copy link
Copy Markdown
Collaborator

thanks!

@evanpelle evanpelle merged commit 0402e60 into openfrontio:main Apr 23, 2025
@scottanderson scottanderson modified the milestones: v23, v22 Apr 23, 2025
evanpelle added a commit that referenced this pull request Apr 24, 2025
This PR replaces player names with randomized name
The goal is to reduce exposure to inappropriate or offensive names.
Additionally, content creators no longer need to worry about displaying
other players’ usernames.
<img width="1276" alt="スクリーンショット 2025-03-25 23 03 37"
src="https://github.com/user-attachments/assets/3d396bb0-336f-41a0-8d56-ff5229fe05f8"
/>
<img width="1048" alt="スクリーンショット 2025-03-25 23 03 48"
src="https://github.com/user-attachments/assets/a72711cf-9743-4879-8f2f-b8187b10a272"
/>
Use the upper left button (Ninja) to change settings.
<img width="1173" alt="スクリーンショット 2025-03-25 23 04 03"
src="https://github.com/user-attachments/assets/2d2fcbbd-7342-40b0-97c1-ecc184e5fbb6"
/>

Fixes #489

---------

Co-authored-by: evanpelle <evanpelle@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace Player Names with Randomized Bot Names

8 participants