Skip to content

Commit 182d008

Browse files
evanpelleclaude
andauthored
Generate a single MapInfo list; move SPECIAL_TEAM_MAPS and en.json map names into info.json (#4231)
**Add approved & assigned issue number here:** N/A — maintainer follow-up to #4227. ## Description: Follow-up to #4227, finishing the "info.json is the single source of truth" refactor. **Maps.gen.ts now generates one `MapInfo` interface and a `maps` list** instead of parallel lookup records. `mapCategories`, `mapTranslationKeys`, and `multiplayerFrequency` are gone — consumers read the list directly (`map.categories`, `map.translationKey`, `map.multiplayerFrequency`). MapPicker got simpler in the process: it renders from `MapInfo` objects, so the reverse `Object.entries(GameMapType)` lookup to recover the enum key is gone. The featured-rank sort moved out of the Go codegen into the picker, where the presentation concern belongs. **`SPECIAL_TEAM_MAPS` moves into info.json** as an optional `special_team_count` field (set on the same 17 maps with the same values). MapPlaylist derives its map from the generated list; `SPECIAL_TEAM_FORCE_CHANCE` and the frequency multiplier behavior are unchanged. **The en.json `map` section is now generated.** A new optional `display_name` field in info.json (defaulting to `name`) is written to `resources/lang/en.json` by the generator, preserving the section's non-map UI keys (`map`, `featured`, `all`, `favorites`, `random`). The 8 maps whose English display name intentionally differs from the frozen enum value (e.g. `MENA`, `Milky Way`, `Europe (Classic)`, `Baikal (Nuke Wars)`) declare it via `display_name`, so no display text changes. The section is emitted alphabetically; since #4232 already sorted en.json and every value matches, regeneration is byte-identical and this PR has no en.json diff. Other languages remain Crowdin-managed. The generator also now validates `translation_key` is exactly `map.<folder>` and `special_team_count >= 2`. MapConsistency tests compare info.json directly against the generated list and the en.json section, and fail with a "run `npm run gen-maps`" message on drift. No behavior changes: enum values, playlist frequencies, special-team counts, featured order, and display names are all byte-identical. ## Please complete the following: - [x] I have added screenshots for all UI updates (no UI changes — internal refactor, rendering output identical) - [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 ## Please put your Discord username so you can be contacted if a bug or regression is found: evanpelle 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent be177f4 commit 182d008

60 files changed

Lines changed: 1096 additions & 505 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

map-generator/README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ Alternatively, `npm run gen-maps` (from the root directory) runs the generator f
4949
- `../resources/maps/<map_name>/map4x.bin` - 1/4 scale (half dimensions) binary map data used for mini-maps.
5050
- `../resources/maps/<map_name>/map16x.bin` - 1/16 scale (quarter dimensions) binary map data used for mini-maps.
5151
- `../resources/maps/<map_name>/thumbnail.webp` - WebP image thumbnail of the map.
52-
- `../src/core/game/Maps.gen.ts` - Generated TypeScript (`GameMapType`, `mapCategories`, `mapTranslationKeys`, `multiplayerFrequency`) built from every map's info.json. Regenerated on every run, even with `--maps`.
52+
- `../src/core/game/Maps.gen.ts` - Generated TypeScript (the `GameMapType` enum and the `maps` list of `MapInfo` objects) built from every map's info.json. Regenerated on every run, even with `--maps`.
53+
- `../resources/lang/en.json` - The `map` section is rewritten with each map's display name. Regenerated on every run, even with `--maps`.
5354

5455
## Command Line Flags
5556

@@ -121,14 +122,18 @@ Example:
121122

122123
`name` is the map's canonical name — the `GameMapType` enum value. It must never change once the map ships (it is part of the wire format and stored in game records).
123124

124-
`translation_key` is the key of the map's display name in `../resources/lang/en.json` (`map.<map_name>`).
125+
`display_name` (optional) is the English display name written to the `map` section of `../resources/lang/en.json`. It defaults to `name` — set it only when the display name should differ from the canonical name (e.g. `MENA`, `Europe (Classic)`).
126+
127+
`translation_key` is the key of the map's display name in `../resources/lang/en.json`. It must be `map.<map_name>`.
125128

126129
`categories` groups the map in the map picker. Each entry must be one of: `featured`, `world`, `europe`, `asia`, `north_america`, `africa`, `south_america`, `oceania`, `antarctica`, `cosmic`, `tournament`, `other`. Maps that straddle regions (e.g. Black Sea, Bering Strait) can list more than one. Add `featured` to show the map in the featured section of the map picker.
127130

128131
`multiplayer_frequency` is how many times the map appears in the public multiplayer playlist. Use 0 (or omit) to keep the map out of the regular rotation.
129132

130133
`featured_rank` (optional, featured maps only) is the map's position in the featured grid (1 = first). Featured maps without a rank sort after ranked ones, alphabetically.
131134

135+
`special_team_count` (optional) is the map's preferred team count in team / special games — see `SPECIAL_TEAM_MAPS` in `../src/server/MapPlaylist.ts`. Omit it for no preference.
136+
132137
`flag` is the code for a country
133138

134139
- The full list of supported codes can be seen in `../src/client/data/countries.json` - all ISO_3166 codes are supported, with several additions.
@@ -148,12 +153,14 @@ The country will need to be added to `../src/client/data/countries.json`
148153

149154
## To Enable In-Game
150155

151-
`GameMapType`, `mapCategories`, `mapTranslationKeys`, and
152-
`multiplayerFrequency` are generated from the info.json files into
153-
`../src/core/game/Maps.gen.ts` when the map-generator runs — do not edit that
154-
file by hand. The only step outside info.json is:
156+
Everything is generated from the info.json files when the map-generator runs —
157+
there are no manual steps:
155158

156-
- Add the map's display name to the `map` translation object in `../resources/lang/en.json` (using your `translation_key`)
159+
- The `GameMapType` enum and the `maps` list (one `MapInfo` per map) are
160+
written to `../src/core/game/Maps.gen.ts`. Do not edit that file by hand.
161+
- The `map` section of `../resources/lang/en.json` is rewritten with each
162+
map's `display_name` (or `name`). Translations to other languages are
163+
managed via Crowdin.
157164

158165
## Notes
159166

map-generator/assets/maps/aegean/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"translation_key": "map.aegean",
55
"categories": ["europe"],
66
"multiplayer_frequency": 6,
7+
"special_team_count": 2,
78
"nations": [
89
{
910
"coordinates": [786, 1860],

map-generator/assets/maps/archipelagosea/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"id": "ArchipelagoSea",
33
"name": "ArchipelagoSea",
4+
"display_name": "Archipelago Sea",
45
"translation_key": "map.archipelagosea",
56
"categories": ["europe"],
67
"multiplayer_frequency": 3,

map-generator/assets/maps/baikal/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"translation_key": "map.baikal",
55
"categories": ["asia"],
66
"multiplayer_frequency": 5,
7+
"special_team_count": 2,
78
"nations": [
89
{
910
"coordinates": [695, 665],

map-generator/assets/maps/baikalnukewars/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"id": "BaikalNukeWars",
33
"name": "Baikal Nuke Wars",
4+
"display_name": "Baikal (Nuke Wars)",
45
"translation_key": "map.baikalnukewars",
56
"categories": ["other"],
67
"multiplayer_frequency": 0,

map-generator/assets/maps/beringsea/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"translation_key": "map.beringsea",
55
"categories": ["asia", "north_america"],
66
"multiplayer_frequency": 5,
7+
"special_team_count": 2,
78
"nations": [
89
{
910
"coordinates": [1043, 121],

map-generator/assets/maps/beringstrait/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"translation_key": "map.beringstrait",
55
"categories": ["asia", "north_america"],
66
"multiplayer_frequency": 2,
7+
"special_team_count": 2,
78
"nations": [
89
{
910
"coordinates": [1297, 287],

map-generator/assets/maps/bosphorusstraits/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"translation_key": "map.bosphorusstraits",
55
"categories": ["europe", "asia"],
66
"multiplayer_frequency": 3,
7+
"special_team_count": 2,
78
"nations": [
89
{
910
"coordinates": [564, 245],

map-generator/assets/maps/britanniaclassic/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"id": "BritanniaClassic",
33
"name": "Britannia Classic",
4+
"display_name": "Britannia (Classic)",
45
"translation_key": "map.britanniaclassic",
56
"categories": ["europe"],
67
"multiplayer_frequency": 0,

map-generator/assets/maps/choppingblock/info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"translation_key": "map.choppingblock",
55
"categories": ["other"],
66
"multiplayer_frequency": 5,
7+
"special_team_count": 4,
78
"nations": [
89
{
910
"coordinates": [230, 230],

0 commit comments

Comments
 (0)