mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 14:50:44 +00:00
main
7 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
182d008ddd |
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> |
||
|
|
3de5fb4204 |
Move map metadata into info.json and generate map TypeScript from it (#4227)
**Add approved & assigned issue number here:** N/A — maintainer refactor. ## Description: Makes each map's `info.json` the single source of truth for map metadata — adding a map is now a folder with `image.png` + `info.json`, a `gen-maps` run, and an en.json display name. **info.json / manifest.json carry full map metadata.** Every `map-generator/assets/maps/<map>/info.json` declares `id` (the `GameMapType` enum key), `name` (the enum value — wire format, unchanged for all 94 maps), `translation_key`, `categories`, and `multiplayer_frequency` (the public-playlist weight that used to be the `FREQUENCY` record in MapPlaylist.ts). The generator validates everything and mirrors it into `resources/maps/<map>/manifest.json`. 23 stale info.json `name` values were normalized to the canonical enum value; enum values are byte-identical, so replays and stored game configs are unaffected. **The generator emits the TypeScript and discovers maps itself.** New `map-generator/codegen.go` generates `src/core/game/Maps.gen.ts` (`GameMapType`, `GameMapName`, `mapCategories`, `mapTranslationKeys`, `multiplayerFrequency` — now a full `Record<GameMapName, number>`, killing the old `Partial`) on every run; `Game.ts` re-exports it. The hardcoded map registry in `main.go` is gone — maps are auto-discovered from the `assets/maps` / `assets/test_maps` directories. MapConsistency tests fail with a "run `npm run gen-maps`" message if info.json, manifest.json, and Maps.gen.ts drift. The tracked `map-generator/map-generator` binary is rebuilt to match. **New categories: continents + world/cosmic/tournament/other, multi-category support.** `continental`/`regional`/`fantasy`/`arcade` are replaced by `featured`, `world`, `europe`, `asia`, `north_america`, `africa`, `south_america`, `oceania`, `antarctica`, `cosmic`, `tournament`, and `other`. Maps can list multiple categories, so straddlers (Black Sea, Bosphorus, Caucasus, Between Two Seas, Bering Sea/Strait, Mena, Strait of Gibraltar, Hawaii, Arctic) appear under both regions. Featured is itself a category (same 7 maps as before). MapPlaylist keeps its arcade exclusion via an explicit set. **Map picker UI.** Two tabs: **Featured** (default — featured maps plus a Favorites section when maps are starred) and **All** (one prominent collapsible bar per category with a map count, collapsed by default). The selected map is prepended to the featured grid when it lives elsewhere. `getMapName()` resolves through the generated `mapTranslationKeys`, which also fixes tourney maps never resolving a valid translation key. ## Please complete the following: - [ ] I have added screenshots for all UI updates (maintainer change — picker described above) - [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> |
||
|
|
74b3bd275b |
Allow mappers to omit nation coordinates in manifest.json for random spawn 🎲 (#4156)
## Description: Previously, every nation in a map's manifest.json required explicit coordinates. Additional nations already supported optional coordinates to trigger random spawn placement, but regular nations did not. Idea from PlaysBadly. Reasoning (copied off discord): > I've been working on World Inverted by adding realistic 'nations' in the form sunken ship names with their flags and location. However after searching around for other possible nation locations that are ocean related I realised that I might not have enough info for proper 'realisitc' coverage of the map. Currently Im at ~170 nations with cordinates. This is not including the additional nations with no locations. This will be reduced to ~62 as the default with the rest turning into additional nations. > > The problem is the end process is proving difficult. Trying to blance the nation placment on the map is a little much at this volume. So being able to add a few no-cordinate nations would be a great way to fill in the map. This PR also improves the MapConsistency test to check the additional nations too. ## Please complete the following: - [X] I have added screenshots for all UI updates - [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: FloPinguin |
||
|
|
990eba6134 |
Improve MapPlaylist 🎲 (#3904)
## Description: ### 1. `SPECIAL_MODIFIER_POOL` rebalanced Ticket weights adjusted to roughly track the community "favorite modifier" poll <img width="486" height="724" alt="Screenshot 2026-05-11 210740" src="https://github.com/user-attachments/assets/bb1d2461-beb3-41c0-8d7b-b604db5fc033" /> - `isRandomSpawn`: 2 to 4 - `goldMultiplier`: 4 to 6 - `isWaterNukes`: 3 to 4 - `startingGold25M`: 1 to 3 - `startingGold5M`: 5 to 4 - `startingGold1M`: 3 to 2 ### 2. New `SPECIAL_TEAM_MAPS` config Replaces the hardcoded per-map branches in `getTeamCount` and `buildMapsList`. Each entry maps a `GameMapType` to its preferred `TeamCountConfig`. Shared constants: - `SPECIAL_TEAM_FORCE_CHANCE = 0.75` (probability of overriding the random team weights roll) - `SPECIAL_TEAM_FREQ_MULTIPLIER = 2` (frequency boost in the team playlist) Current entries: Baikal (2), FourIslands (4), Luna (2). Behavior preserved for the existing maps, but adding another special team map is now a one-line entry. ### 3. New `FULL_LAND_MAPS` config (TheBox, Alps) - Water nukes forced on 75% of the time in the special rotation (overrides `WATER_NUKES_BOOSTED_MAPS`, which still applies its 50% boost to FourIslands, Baikal, Luna, ArchipelagoSea). Because they make a lot of fun on these two maps. - The `isPortsDisabled` modifier is excluded unless water nukes is boosted on, since ports are pointless on full-land maps. Because this happened: <img width="516" height="292" alt="image" src="https://github.com/user-attachments/assets/cd9ce31d-25d0-4b35-a8ba-bb3ec1c02b70" /> ### 4. Misc - Renamed `frequency` constant to `FREQUENCY` for consistency with other module-level constants. ### 5. Exclude `isNukesDisabled` on special team maps in team mode On `SPECIAL_TEAM_MAPS` (FourIslands, Baikal, Luna) in team mode, the `isNukesDisabled` modifier is now excluded from the pool. Otherwise an extreme warship spam will follow. ## Please complete the following: - [X] I have added screenshots for all UI updates - [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 - [X] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: FloPinguin |
||
|
|
52033597ef |
Update Britannia and take its Classic version off rotation (#3710)
## Description: Similar to how Europe classic was taken off rotation, we do the same with Britannia. The newer Britannia was slightly updated to include the rivers of the classic version, this is because of feedback from players in the discord server who say the rivers in the classic version are an important part of gameplay. Map otherwise keeps same nations and size. ## Please complete the following: - [x] I have added screenshots for all UI updates - [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 - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: tri.star1011 |
||
|
|
95d7895740 |
Update Europe map and remove its Classic version off rotation (#3647)
## Description: This was a proposal in the map channel of the dev discord server: **Updates the Europe map to include Iceland, and removes Classic Europe off rotation.** Classic Europe will remain in custom private map list The only thing the new europe map didnt have from the classic version was iceland, so i figured we should update the europe map to contain it, since Iceland is a popular spawn in the classic version. Iceland is in the same position as the classic map The classic europe is frankly a lesser version of the new map as it doesnt contain rivers , is smaller and the terrain has less quality, and with the updated version, classic would just take up very needed space in the lobby queue. We currently have a very large number of maps, which results in players having to wait for a long time for an specific map in public lobbies. This should help the issue a little at the very least. <img width="2905" height="1674" alt="image" src="https://github.com/user-attachments/assets/da98d935-b927-4e04-9383-9a1f2b794f97" /> ## Please complete the following: - [x] I have added screenshots for all UI updates - [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 - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: tri.star1011 |
||
|
|
aa06754579 |
Add map consistency test 🗺️ (#3592)
## Description: Because we regularly have problems with incorrectly added maps: Add `tests/MapConsistency.test.ts` with 10 tests that verify every map is correctly registered across all required files: - **main.go** - every `GameMapType` has an entry in the map generator registry and vice versa - **map-generator assets** - each map folder contains exactly `image.png` + `info.json` - **mapCategories** - every map belongs to at least one category in `Game.ts` - **frequency** - every map (except exempted ones) has a playlist frequency in `MapPlaylist.ts`, and no unknown keys exist - **en.json** - every map has a translation entry - **resources/maps/** - every map has `manifest.json`, `map.bin`, `map4x.bin`, `map16x.bin`, `thumbnail.webp` - **Excess folders** - no orphaned directories in `resources/maps/` or `map-generator/assets/maps/` - **Nations consistency** - nation names and coordinates match between `info.json` and `manifest.json` Exempted from frequency check: `GiantWorldMap`, `Oceania`, `BaikalNukeWars`, `Tourney1–4`. ## Please complete the following: - [X] I have added screenshots for all UI updates - [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 - [X] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: FloPinguin |