how to customize tile map size ingame

Just a few thoughts:

  • don’t use TileMap in new games, it is deprecated. Use TileMapLayer exclusively
  • tiles: MineSweeper has a fixed, limited amount of different tiles: hidden, flagged, mine, triggered mine, zero to 8 adjacent mines are a total 13 different tiles
  • cells: what varies is the number of cells that the player sees:
    • easy: 9x9 = 81 cells, 10 mines
    • medium: 16x16 = 256 cells, 40 mines
    • hard: 16x30 = 480 cells, 99 mines
  • while it might be difficult to change the number of tiles at runtime, the number of cells can be changed anytime (actually, TileMapLayer has no method to set bounds for the number of cells, but you can call get_used_rect() to determine the region that contains cells).

There is a limit to the number of cells in TileMapLayer because the cell coordinates are integer values (about -2_000_000_000 to +2_000_000_000) and there are further restrictions if you want to save a TileMapLayer (only the coordinate range from -32_000 to 32_000 is saved - but this still means there are about 4_000_000_000 cells in total).

But probably no player would want to play MineSweeper on a grid exceeding a few thousand cells.