You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Copy file name to clipboardExpand all lines: map-generator/README.md
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,8 @@ Alternatively, `npm run gen-maps` (from the root directory) runs the generator f
49
49
-`../resources/maps/<map_name>/map4x.bin` - 1/4 scale (half dimensions) binary map data used for mini-maps.
50
50
-`../resources/maps/<map_name>/map16x.bin` - 1/16 scale (quarter dimensions) binary map data used for mini-maps.
51
51
-`../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`.
53
54
54
55
## Command Line Flags
55
56
@@ -121,14 +122,18 @@ Example:
121
122
122
123
`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).
123
124
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>`.
125
128
126
129
`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.
127
130
128
131
`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.
129
132
130
133
`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.
131
134
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
+
132
137
`flag` is the code for a country
133
138
134
139
- 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`
148
153
149
154
## To Enable In-Game
150
155
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:
155
158
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
0 commit comments