Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to online multiplayer system #6360

Closed
1 of 11 tasks
GGGuenni opened this issue Mar 17, 2022 · 20 comments
Closed
1 of 11 tasks

Improvements to online multiplayer system #6360

GGGuenni opened this issue Mar 17, 2022 · 20 comments

Comments

@GGGuenni
Copy link
Collaborator

GGGuenni commented Mar 17, 2022

Ideas to improve the multiplayer. Some things were already planned and pursued in #9497

  • Resign at any time
  • Multiplayer lobbies
  • Public/Private lobbies with a list for public lobbies to easily join games
  • Kick players from games
  • invite links
  • Turn notifications per game
  • Option to allow players to join already running games (Take over AI)
  • Move multiplayer game related settings (kick, invite, resign, etc.) to WorldScreenMenuPopup (right side?)
  • Usernames to hide UUIDs
  • Feature request: Password validation in Unciv  #8482
  • disable charts for non spectator players until the game ends.
  1. Multiplayer lobbies: A lobby before the game starts, where everyone can choose their Civ themselves and only the leader can change game related settings
  2. Public lobbies + list: Is this worth the implementation effort? Would this even be used? Maybe ask in a Poll if people would use this
  3. Kick players: Should it be a democratic vote or leader decides? Maybe Poll this
@GGGuenni GGGuenni changed the title Improvements to online Multiplayer system Improvements to online multiplayer system Mar 17, 2022
@ravignir
Copy link
Contributor

Imo, the most important thing is to implement some anti-cheating features.

@GGGuenni
Copy link
Collaborator Author

Imo, the most important thing is to implement some anti-cheating features.

Sadly not possible as far as I can tell. Players will always have the ability to modify the game files or even create a cheating version of unciv on their own repo. There is not much we can do about that.
But that's one of the reasons I don't know if public lobbies would even be used.

@xlenstra
Copy link
Collaborator

I don't think we have to make it completely fool-proof, but making it more difficult might already be enough to stop most ways of cheating. Currently, in order to start a game you need to send the host your userID, which the host can then later use at any moment to log into the game and mess up your empire.
One way to prevent this, is by not sharing userID's, but by sharing usernames (as you're already planning) and not making these one-to-one translatable to userID's. For example, adding a file in the dropbox saving usernames, hash-encrypted passwords and password-encrypted userID's. This will also allow users to easily sync multiplayer games across different devices; simply logging in with the same account on a different device automatically gives access to the userID, no copy+pasting between different devices required.
We could then also save the username, password & userId in gameSettings.json, so we can automatically try logging in again whenever the multiplayer tab is opened.

This would, of course, still leave open the possibility for people to clone the repo and create a version where all passwords are accepted, but the only way out of that is to run all authentication server-side, which is in the current server setup impossible.

@GGGuenni
Copy link
Collaborator Author

One way to prevent this, is by not sharing userID's, but by sharing usernames

My current plan is to not share anything directly with the game creator but to join a game through a lobby yourself. The only thing that is displayed in-game to everyone in the lobby is currently the first 8 characters of the UUID as I do not have user names implemented yet. Ids can still always be read from the game file itself though

Login system through dropbox sounds kinda crazy but maybe worth a try if it's needed

Looks like the number one priority for me should be finding a way to handle the rate limit fiesta that is going on.
Don't know what the Dropbox tos say about it but as the rate limit is enforced per User we could create multiple accounts that all access the same dropbox which can then in game be selected as different access points

@SomeTroglodyte
Copy link
Collaborator

Shouldn't #1 prio be to finish the backing storage abstraction with at least one working alternate provider, be it local UNC paths or WebDAV?

@yairm210 yairm210 mentioned this issue Mar 20, 2022
@touhidurrr
Copy link
Contributor

Multiplayer lobbies: A lobby before the game starts, where everyone can choose their Civ themselves and only the leader can change game related settings

I will say that try not to create more type of files. Ditch Multiplayer Lobbies data to the _preview file and when the game start create the game file.

@touhidurrr
Copy link
Contributor

touhidurrr commented Apr 16, 2022

Imo, the most important thing is to implement some anti-cheating features.

I was thought of implementing some on UncivServer.xyz as such that players game files won't have data about other civs. So, that they can't see others conditions and cheat.
But this has some problems even if cleverly implemented.

  1. The host needs to process the game and thus needs everyones data
  2. Other's can mimic players and see game data anyways (by using others user ID)
  3. Might lead to many unknown circumstances
    That's why my plan never progressed.

@itanasi
Copy link
Contributor

itanasi commented Apr 25, 2022

Another idea, turn timer? If you don't move in X time, either skip turn or resign eventually. Might need to be a Server thing unfortunately

@touhidurrr
Copy link
Contributor

touhidurrr commented Apr 25, 2022

Another idea, turn timer? If you don't move in X time, either skip turn or resign eventually. Might need to be a Server thing unfortunately

It can also be manually programming in a per client basis so that clients secretly kick out a player who doesn’t move for X time. That would be a fun to know feature that would give chuckles to a programmer. Maybe kinda like using Clients to mine Crypto. (Lol)

I have always had similar Idea from mid 2021 when i started played Unciv. But for lazyness forgot it quickly. Maybe since now I have a server, I would try to implement such logic.

@touhidurrr
Copy link
Contributor

Also now that I think about it. How would you know if this is a server or client thing if when you try to join a game, you see yourself kicked out. It would seem like seamless right? XD

@itanasi
Copy link
Contributor

itanasi commented Apr 25, 2022

Trouble with client side is you can easily change system time.

Also, how would the system then pass the game to the next player?

@touhidurrr
Copy link
Contributor

Trouble with client side is you can easily change system time.

Also, how would the system then pass the game to the next player?

Fetch the time from NTP or something on startup!!! Case closed!!!!

@qwerty2586
Copy link
Contributor

I think multiplayer server should use websockets instead of constant polling preview save each 500ms. With websockets server can distribute save instant when is pushed by other player. With some stream code, it can be started distributing even before upload is complete for example. Also with websockets server is aware who is connected and signal this info to players. Server will also have awereness who is on turn and make players skip if timeout is reached.

Here is interesting implementation of dummy websocket server.
https://github.com/mafintosh/signalhub

@touhidurrr
Copy link
Contributor

touhidurrr commented Oct 21, 2022

I think multiplayer server should use websockets instead of constant polling preview save each 500ms. With websockets server can distribute save instant when is pushed by other player. With some stream code, it can be started distributing even before upload is complete for example. Also with websockets server is aware who is connected and signal this info to players. Server will also have awereness who is on turn and make players skip if timeout is reached.

Here is interesting implementation of dummy websocket server. https://github.com/mafintosh/signalhub

Unciv uses free Dropbox API by default. So, no WebSocket for now. But I do think WebSocket support should be included. I am open to implement WebSocket for UncivServer.xyz if it is ever implemented. I think I also asked for it at some point or another.

@itanasi
Copy link
Contributor

itanasi commented Dec 15, 2023

Reviving this.

Something helpful would be a Password Screen for each time you start your turn. Merge it into the "Start " screen used for Hotseat.

If no Password, can just Continue.

If a Password is set, can opt to change it or just enter password to enter the turn.

Save hashed password in the save file per civilization.

Would improve security for Hotseat and Online MP.

Civ5 screens
image

@ravignir
Copy link
Contributor

disable charts for non spectator players until the game ends.

@GGGuenni
Copy link
Collaborator Author

GGGuenni commented Dec 15, 2023

Something helpful would be a Password Screen for each time you start your turn

It is currently shown on next turn when trying to upload the file and the password hasn't been set in the options yet or the set password is wrong. Only works if the server supports auth v1 and only for multiplayer, not hotseat.
(Well, I haven't checked for a while so it might not be working anymore idk 😅 )
uncivserver.xyz currently does not support auth if I'm not mistaken as there were plans to overhaul the multiplayer completely.

This is the line that triggers the AuthPopup

disable charts for non spectator players until the game ends.

I will add it to the issue description in case someone is searching for multiplayer stuff to work on

@alexban01
Copy link
Contributor

alexban01 commented Dec 21, 2023

@itanasi I already started implementing that but then decided to stop. I even hashed the password :))
#7334

Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 15 days.

@github-actions github-actions bot added the Stale label Mar 21, 2024
Copy link

github-actions bot commented Apr 6, 2024

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants