Saves too big for the browser: wait before retrying

A late-game save of ~22 million characters is over Firefox's localStorage
quota, so every save failed, yet the game rebuilt it with JSON.stringify(S)
every 5 seconds, every 10 days and after every action: ~95 ms each in
headless Firefox, 300-570 ms in a player's browser, all thrown away.

After a failed save the autosave now waits 1 minute before trying again,
then 2, 4, at most 5. A save that works resets this, so normal games still
save every time. Leaving the page, exporting, reloading for an update or a
language and a new game (a new S) still try at once.

Player save in Firefox: first save 95 ms as before, the next autosaves 0 ms.
This commit is contained in:
Hugues 2026-10-27 13:44:57 +01:00
parent ecb862e70d
commit d7301747f7
5 changed files with 36 additions and 6 deletions

View file

@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
- Huge networks stop stuttering every few seconds when their save is too big for the browser to keep: after a failed save the game waits a minute before trying again, then longer, instead of retrying every 5 seconds and after every click. Leaving the page, exporting and new games still save at once.
- The map of a huge network spends less time working out fiber capacities on every frame, and skips links above or below the screen.
## [1.34.1] — 2026-10-27