Skip to content

feat: persist authenticated accounts and reconnectable game memberships - #89

Open
Enn3Developer wants to merge 9 commits into
n/secure-transportfrom
n/account-game-memberships
Open

feat: persist authenticated accounts and reconnectable game memberships#89
Enn3Developer wants to merge 9 commits into
n/secure-transportfrom
n/account-game-memberships

Conversation

@Enn3Developer

Copy link
Copy Markdown
Owner

No description provided.

@Enn3Developer Enn3Developer added this to the 0.1.0 milestone Sep 5, 2026
@Enn3Developer Enn3Developer added type: feat New gameplay or feature work area: client OpenPolytopia/ Godot project area: server OpenPolytopia.Server/ dedicated server area: common OpenPolytopia.Common/ shared library area: netcode TCP transport, packet protocol, serialization breaking-change Breaks save format, packet protocol, or public API labels Sep 5, 2026
@Enn3Developer Enn3Developer self-assigned this Sep 5, 2026
@claude

claude Bot commented Sep 5, 2026

Copy link
Copy Markdown

Claude encountered an error after 51s —— View job


Summary

Adds persistent player accounts (register/login/session tokens) and makes lobby and game membership durable across reconnects, backed by server-side SQLite persistence so lobbies, sessions and completed games survive a restart.

Changes

  • Server: New GameServer.Accounts.cs/ServerStore additions for registration, login, PBKDF2 password hashing, and 30-day session tokens with per-connection auth throttling; lobby/game membership now keyed by persistent account id instead of transport connection id.
  • Server: New GameServer.Persistence.cs and ServerStore.Archive.cs capture and restore full server state (lobbies, in-progress games, account renames) transactionally, only replying after a successful SQLite commit, with rollback on failure; completed games are archived instead of discarded.
  • Server: GameManager/GameSession/LobbyManager reworked to support disconnect/reconnect (Join/Disconnect/FindByAccount) without losing a seat, plus a new README.md documenting deployment and the account/session protocol.
  • Client: NetworkNode gains Register/Login/Logout/session-resume flow with local token storage, and new MyGames/game-membership packets (JoinGamePacket, LeaveGamePacket, ResignGamePacket).
  • Client: Lobby.cs/Game.cs updated for login/registration UI and reconnect-aware game state handling.
  • Tests: New integration/unit tests for authentication flow, completed-game archiving, persistence failure/rollback, and server transactions.

Worth a look

  • Protocol version bump and new packets are a breaking wire-format change for existing clients/servers.
  • WithStateAsync now wraps every inbound packet (including read-only ones) and serializes full server state to diff against the previous snapshot — worth checking the cost as games/accounts grow.
  • Turn-timer mode (TimerMode on lobbies, GameClockPacket) is added to the wire protocol and UI but has no server-side effect yet.

@Enn3Developer
Enn3Developer force-pushed the n/account-game-memberships branch from 2f8e441 to 48ec490 Compare September 5, 2026 09:09
Comment thread OpenPolytopia/src/NetworkNode.cs
Comment thread OpenPolytopia.Server/GameServer.Accounts.cs Outdated
Comment thread OpenPolytopia/src/NetworkNode.cs
Comment thread OpenPolytopia.Server/GameServer.Accounts.cs Outdated
Comment thread OpenPolytopia/src/NetworkNode.cs
Comment thread OpenPolytopia.Server/GameServer.Persistence.cs
Comment thread OpenPolytopia.Server/GameManager.cs
@Enn3Developer
Enn3Developer force-pushed the n/account-game-memberships branch from 48ec490 to 55fa0b4 Compare September 5, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: client OpenPolytopia/ Godot project area: common OpenPolytopia.Common/ shared library area: netcode TCP transport, packet protocol, serialization area: server OpenPolytopia.Server/ dedicated server breaking-change Breaks save format, packet protocol, or public API type: feat New gameplay or feature work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant