Skip to content

Handle Battle, Lobby, Party, and Matchmaking status reconnections - #711

Merged
Hectate merged 46 commits into
beyond-all-reason:masterfrom
Hectate:reconnect-stores
Sep 3, 2026
Merged

Handle Battle, Lobby, Party, and Matchmaking status reconnections#711
Hectate merged 46 commits into
beyond-all-reason:masterfrom
Hectate:reconnect-stores

Conversation

@Hectate

@Hectate Hectate commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #665 #666 #667 #668 and #707 and closes parent #664

Each store has a listener for user/self event and handles it's own data as appropriate.
A modal now prompts the user to rejoin their battle if the server indicates they were in one.
If the modal is dismissed, the BAR logo is overlaid with an attention-grabbing animated crossed swords. Clicking it will re-prompt them to rejoin the battle via the modal again. Various events and actions will forcibly clear the "in battle" state as appropriate.

Server Issues

At this time, it is not possible to reliably know that a battle ended and the autohost has shut down because battle/ended is not being sent.
Matchmaking queue status upon reconnection is always no_matchmaking, which can be incorrect. Any newly received matchmaking status events afterward from the server will update it correctly, however.

See below:

To alleviate the missing implementations, tests are included to cover the expected behavior when they are added. Live validation will happen separately once possible. Since this only impacts multiplayer functions, which are locked behind Dev Mode, this is considered an acceptable compromise to holding the PR back.

AI / LLM usage statement:

GH Copilot was used for some tests and code generation under my direction, and for evaluating options for different approaches.

Hectate added 10 commits August 22, 2026 23:55
Made a shared springString utility
Cleaned up launch triggers slightly
Added a launch for user/self currentBattle
Prompts user to rejoin a current battle if user/self indicated that one was active.
Battle connection details are now preserved so the user can choose to rejoin immediately or later. We will need some kind of "rejoin active battle" option in the UI to do that, but this sets it up for that.
NavBar main logo will now show a "in battle" animation over the logo to attract attention to itself. Clicking on the element will display the Rejoin Battle Modal.
Animation will only show if there is a known battle to join.
Hectate added 13 commits August 23, 2026 23:44
CI will fail because of errors in the server-provided objects
Dev server has been fixed
A different PR (campaign data) had this fixed but was never applied, and got forgotten about. Revived to fix the issue.
We have to always send the party status because prechecking for a null value means we have zero parties and we still need to tell the client (maybe they were kicked while disconnected, etc.).
Now properly handling situations where the value becomes null/undefined because the client was removed from the party/lobby/battle while disconnected.
@Hectate Hectate linked an issue Aug 27, 2026 that may be closed by this pull request
Comment thread src/renderer/store/matchmaking.store.ts Outdated

@burnhamrobertp burnhamrobertp 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.

Read this against a local teiserver with the matchmaking reconnect cases driven end to end, so a few of the comments below reference what the server actually sends. Nothing here is about the parts you already flagged under Server Issues.

Comment thread src/renderer/store/party.store.ts Outdated
Comment thread src/renderer/store/me.store.ts Outdated
Comment thread src/renderer/store/lobby.store.ts Outdated
Comment thread src/renderer/store/me.store.ts Outdated
Comment thread src/renderer/store/matchmaking.store.ts Outdated
Comment thread src/renderer/store/matchmaking.store.ts Outdated
Comment thread src/renderer/store/lobby.store.ts
Comment thread src/renderer/components/battle/RejoinBattleModal.vue
Comment thread src/renderer/store/lobby.store.ts
Comment thread src/renderer/store/lobby.store.ts Outdated
@Hectate Hectate linked an issue Aug 28, 2026 that may be closed by this pull request
4 tasks
@Hectate

Hectate commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Note to self; implement requestStructured with these changes.

Using idempotent lobby/join to refresh chat had a client side-effect of purging chat history as it assumed it was a newly joined lobby and not potentially a pre-existing one.
Comment thread src/renderer/store/lobby.store.ts Outdated
Replaces all uses of window.tachyon.request() with requestStructured().,
@Hectate
Hectate requested a review from burnhamrobertp August 29, 2026 03:56
Comment thread src/renderer/store/lobby.store.ts Outdated
Comment thread src/renderer/store/lobby.store.ts
Comment thread src/renderer/store/lobby.store.ts
Comment thread src/renderer/store/lobby.store.ts Outdated
Comment thread src/renderer/store/matchmaking.store.ts Outdated
Comment thread src/renderer/store/lobby.store.ts Outdated
Comment thread src/renderer/store/lobby.store.ts Outdated
Comment thread src/renderer/store/matchmaking.store.ts
Comment thread src/renderer/store/me.store.ts
Comment thread src/renderer/utils/user-self-signal.ts Outdated
Party and Lobby now use a Map like Users did. This means that we no longer have to worry about chat clearing/preserving when we get lobby or party events in 'user/self'
This request needed two parameters. To avoid ambiguity, each has been tied to named properties of a single object with neither optional. All existing references updated.
ip:string > ips:string[]
Added battleId where appropriate.
@Hectate

Hectate commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Tests for state changes mid-disconnection:

  • Changes to lobby composition ✅
  • Removed from lobby ✅
  • Existing Active battle upon reconnect ✅
  • New active battle ✅
  • Active battle is no longer present ✅
  • Removed from party ✅
  • New invites received ✅
  • Old invites cancelled ✅
  • Changes to party composition ✅
  • Matchmaking found ❓
  • Matchmaking ready ❓
  • Matchmaking lost ❓
  • Matchmaking cancelled ❓
  • Chat is restored/kept ✅
  • New chat is fetched if available ✅

Server needs updated
Both the event handler (main) and rejoin action (renderer) needed to handle the missing property
@Hectate
Hectate merged commit eb1da83 into beyond-all-reason:master Sep 3, 2026
3 checks passed
@Hectate Hectate linked an issue Sep 3, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants