Store full game for singleplayer, add more validation (#2031)

## Description:

onunload allows up to 64kb, but reducing the number of hash messages and
compressing using gzip, we can reduce the GameRecord size to stay under
64kb. I played a 10 minute game and the compressed GameRecord was only a
few kb.

Also verify the game is singleplayer and has only 1 player

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
This commit is contained in:
evanpelle
2025-09-08 18:14:08 -07:00
committed by GitHub
parent 043462e28a
commit defb6bb1d4
6 changed files with 119 additions and 51 deletions
+3 -3
View File
@@ -271,7 +271,7 @@ export class ClientGameRunner {
this.lobby.clientID,
);
console.error(gu.stack);
this.stop(true);
this.stop();
return;
}
this.transport.turnComplete();
@@ -361,12 +361,12 @@ export class ClientGameRunner {
this.transport.connect(onconnect, onmessage);
}
public stop(saveFullGame: boolean = false) {
public stop() {
if (!this.isActive) return;
this.isActive = false;
this.worker.cleanup();
this.transport.leaveGame(saveFullGame);
this.transport.leaveGame();
if (this.connectionCheckInterval) {
clearInterval(this.connectionCheckInterval);
this.connectionCheckInterval = null;