Skip to content

Game crashes with "Map maximum size exceeded" on World10000 with water nukes #6388

Open

Description

@YassineKaibi

Describe the bug

The game crashed mid-match with RangeError: Map maximum size exceeded.

  • game id: dFasL6K561
  • client id: p2EUp38a

RangeError: Map maximum size exceeded
at Map.set ()
at e.noteTerrainEdit
at e.setMagnitude
at o_.recomputeMagnitudesInBox
at o_.finalizeWaterChanges
at o_.tick
at l_.executeNextTick

Cause: GameMapImpl records every tile whose terrain changed in a Map (pristineTerrain). A JS Map holds at most 2^24 (~16.7M) entries. World10000 has 50M tiles, and each large water-nuke crater adds roughly 32k tiles to that log, so a long game with heavy nuking passes the limit and the next setMagnitude throws.

To Reproduce

In game:

  1. Play World10000 with water nukes enabled.
  2. Keep playing while large parts of the map get nuked into water.
  3. Once more than ~16.7M tiles have had their terrain changed, the game crashes.

In code (fast):

  1. Create a GameMapImpl with more than 2^24 tiles, e.g. 4200x4200 of water.
  2. Call setMagnitude on every tile.
  3. It throws RangeError: Map maximum size exceeded.

Expected behavior

The game keeps running no matter how many tiles have been edited.

Screenshots

None; the crash text is above.

Desktop

  • OS: Fedora 44 (Linux)
  • Browser: Brave
  • Version: 155.1.97.59

Additional context

GameImpl.addViewResync builds a Set from the same log, so it would hit the same limit.

I have a fix ready with a reproducing test: the edit log moves to a one-bit-per-tile mask plus typed arrays, so it has no entry limit. The snapshot format and first-edit order are unchanged.

Assignment

  • I'd like to be assigned to this issue and work on it myself

Activity

  1. github-actions commented on Nov 11, 2026

    @github-actions
    Contributor

    Hi @YassineKaibi, thanks for opening this issue. It hasn't been approved by a maintainer yet — we'll get back to you shortly to either milestone it (approval) or close it.

    — Automated. See CONTRIBUTING.md.

  2. added this to the Backlog milestone on Nov 13, 2026
  3. added
    approvedApproved for a PR, if you assigned to the issue.
    and removed
    not-approvedThis issue has NOT been approved by the maintainers.
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

approvedApproved for a PR, if you assigned to the issue.

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions