Map size presets chosen from the main menu #158

Open
opened 2026-10-11 20:23:44 +01:00 by liamjd · 0 comments
Owner

Milestone 2, item 1. Also on the #90 list ("Specify map size from main menu; smaller maps may make for easier/quicker testing").

Problem

grid_size is an export on the Map node in game.tscn, currently set to 16, a testing value that every run now plays at. The player cannot choose it, and the camera's zoom limits are hand-tuned metres that assume a 64-tile map (camera_rig.gd says as much: "must be revisited if TerrainGrid.tile_size or grid_size changes").

Proposal

Five presets, picked on the main menu next to the seed field:

Preset Tiles per side Cells
TINY 32 1 024
SMALL 48 2 304
NORMAL 64 4 096
LARGE 96 9 216
XLARGE 128 16 384

The values are a starting proposal; tune them freely. Below 32 every preset struggles (see #159 and #161), and 16 is useful for tests but not for play. If a debug size smaller than TINY is wanted, put it behind OS.is_debug_build().

Seams

  • Where the presets live. An enum plus a size lookup, in one place. Either a small MapSize class or on GameState. It is run configuration in the same sense as run_seed.
  • GameState gains the chosen size alongside run_seed, defaulting to NORMAL.
  • main_menu.gd: an OptionButton populated from the enum, not from hand-typed items, so adding a preset is one edit. It is read in _start_new_game() alongside the seed. It joins the controls in _set_menu_focusable().
  • game.gd: sets map.grid_size from GameState before map.generate(), the same way it hands over the seed today. TerrainGrid stays ignorant of GameState.
  • game.tscn: grid_size = 16 comes out, so the editor preview falls back to the script default.
  • Camera: max_zoom (and probably the default zoom) derived from map.map_extents() rather than fixed at 120 m, which only frames up to 64 tiles. edge_margin is already relative to the extents.
  • Pawn spawning (_reset_stub_pawns) needs nothing, since it already asks the map.

Acceptance criteria

  • The main menu offers the five presets, NORMAL selected by default.
  • Starting a game generates a map of the chosen size. Both entry paths (New Game button, Enter in the seed field) honour it. #16's seed bug was exactly a divergence between those two paths.
  • The same seed and size give the same map.
  • At XLARGE, zooming fully out frames the whole map at the 45° yaw. Checked headed, by screenshot.
  • The camera still clamps to the map edge at TINY.
  • Unit tests: the preset→size mapping, and that game.gd applies the size before generating.

Out of scope

  • Choosing the terrain shape from the menu. Today that is only the debug cycler. It is a natural companion, but a separate ticket.
  • A minimap for large maps: #23.
Milestone 2, item 1. Also on the #90 list ("Specify map size from main menu; smaller maps may make for easier/quicker testing"). ## Problem `grid_size` is an export on the `Map` node in `game.tscn`, currently set to **16**, a testing value that every run now plays at. The player cannot choose it, and the camera's zoom limits are hand-tuned metres that assume a 64-tile map (`camera_rig.gd` says as much: "must be revisited if TerrainGrid.tile_size or grid_size changes"). ## Proposal Five presets, picked on the main menu next to the seed field: | Preset | Tiles per side | Cells | | --- | --- | --- | | TINY | 32 | 1 024 | | SMALL | 48 | 2 304 | | NORMAL | 64 | 4 096 | | LARGE | 96 | 9 216 | | XLARGE | 128 | 16 384 | The values are a starting proposal; tune them freely. Below 32 every preset struggles (see #159 and #161), and 16 is useful for tests but not for play. If a debug size smaller than TINY is wanted, put it behind `OS.is_debug_build()`. ## Seams - **Where the presets live.** An enum plus a size lookup, in one place. Either a small `MapSize` class or on `GameState`. It is run configuration in the same sense as `run_seed`. - **`GameState`** gains the chosen size alongside `run_seed`, defaulting to NORMAL. - **`main_menu.gd`**: an `OptionButton` populated from the enum, not from hand-typed items, so adding a preset is one edit. It is read in `_start_new_game()` alongside the seed. It joins the controls in `_set_menu_focusable()`. - **`game.gd`**: sets `map.grid_size` from `GameState` before `map.generate()`, the same way it hands over the seed today. `TerrainGrid` stays ignorant of `GameState`. - **`game.tscn`**: `grid_size = 16` comes out, so the editor preview falls back to the script default. - **Camera:** `max_zoom` (and probably the default `zoom`) derived from `map.map_extents()` rather than fixed at 120 m, which only frames up to 64 tiles. `edge_margin` is already relative to the extents. - **Pawn spawning** (`_reset_stub_pawns`) needs nothing, since it already asks the map. ## Acceptance criteria - [ ] The main menu offers the five presets, NORMAL selected by default. - [ ] Starting a game generates a map of the chosen size. Both entry paths (New Game button, Enter in the seed field) honour it. #16's seed bug was exactly a divergence between those two paths. - [ ] The same seed and size give the same map. - [ ] At XLARGE, zooming fully out frames the whole map at the 45° yaw. Checked headed, by screenshot. - [ ] The camera still clamps to the map edge at TINY. - [ ] Unit tests: the preset→size mapping, and that `game.gd` applies the size before generating. ## Out of scope - Choosing the terrain **shape** from the menu. Today that is only the debug cycler. It is a natural companion, but a separate ticket. - A minimap for large maps: #23.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
liamjd/UntitledColonyBuilder#158
No description provided.