mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 18:46:49 +00:00
6c8ce958b2e94de2849015c2a2d7b58dd487101b
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> |
||
|
|
9e9708468c |
Fix/nation names special caracters (#4195)
> **Before opening a PR:** discuss new features on [Discord](https://discord.gg/K9zernJB5z) first, and file bugs or small improvements as [issues](https://github.com/openfrontio/OpenFrontIO/issues/new/choose). You must be assigned to an `approved` issue — unsolicited PRs will be auto-closed. **Add approved & assigned issue number here:** Resolves #4165 ## Description: This PR update the test checking validity of Nation Names to include the new character constraint explained below. It also fixes the 10 Nations that invalid characters (that did not render correctly on the map). **The new character constraint** According to testing, the game map renders correctly all safe Extended-ASCII characters (non colored in www.ascii-code.com = [0x20–0x7E] or [0xA0-0xFF]). Other characters, when present in Nation Names, are rendered correctly in the rest of the game but not on the map, where they are trimmed to the last byte, which is then interpreted as Extended-ASCII and rendered if possible. **How to quickly check my assertion** 1. Change the file resources/maps/world/manifest.json, renaming one of the countries to "a.á.आ!š!慢!". 2. Start a game on the world map without any bots 3. Verify that the nation name is well displayed in its overlay but is shown as "a.á.!a!b!" on the map. (characters before a point are preserved, but characters before an exclamation mark are missing/changed). 4. run `npm run test` and notice that the NationName test fails and lists the three non-valid characters. Explanation: The string is represented in UNICODE-16 as \u0061\u002e\u00e1\u002e\u0906\u0021\u0161\u0021\u6162\u0021. Which, when we keep only the right-most byte of each character gives: 61 2e e1 2e 06 21 61 21 62 21 And, converted in Extended-ASCII gives: a.á.�!a!b! (which matches the showed name if we discard the control character). **The 10 Nations which needed a fix** Utqiaġvik from the Bearing Strait. Ar Rayyān from the Strait of Hormuz. 6 Nations in the Bosphorus Straits. 2 Easter-egg Nations from Luna. The 8 real-world Nations were adapted by simply removing the diacritics (after confirmation from a speaker of arabic and turkish, but sadly none for the Utqiaġvik Nation). The Secret Base from Luna was renamed "T0Þ $e¢®ët Mi|¡tªr¥ ß@§£", all within Extended-ASCII, keeping the same spirit as the original name. However, the Monolith Nation (previously named ▊, without any flag) has changed quite a lot and needs some explanation. **Easter-egg Nation Monolith** The new name is "ΜΟΝΟʟΙȚΗ", which is entirely outside of the valid character zone but in a way that entirely disappears on the map (as the आ character in the example above). This means that on the map, the Nation has no name and only its Monolith-flag. However, in all other places (leaderboard, overlay, alliances, warnings, etc.) the name is displayed correctly. The included test excludes this precise name from its violation list. <img width="1512" height="632" alt="image" src="https://github.com/user-attachments/assets/998693f2-edb4-417c-9054-35dc4819a57d" /> The Monolith Nation without its name but with a Monolith flag. ## 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: Katokoda |
||
|
|
b043dc6c15 |
Team Maps Expansion: New team spawnzones for multiple maps (#4058)
## Description: Lets give Teams and HvN gamemodes some attention. Adds team spawnzones to the following maps, and boosts them to appear more frequently as this gamemode: - Straitofgibraltar - 2 teams - Aegean - 2 teams - Beringsea - 2 teams - Beringstrait - 2 teams - Bosphorusstraits - 2 teams - Conakry - 2 teams - Falklandislands - 2 teams - Straitofhormuz - 2 teams - Tradersdream - 2 teams - Surrounded - 2 teams & 4 teams - Pluto - 2 teams - Gulf of St. Lawrence - 3 teams These maps (especially the ones for 2 teams) are all very symmetrical and would be nice gift for the playerbase, which enjoys these kind of games like FourIslands4Teams and Baikal2Teams. This is also nice for HvN, as it centralizes the players and gives them a better chance at defeating the nations. Screenshots of the maps with the new team spawnzones: <img width="1320" height="486" alt="Captura de pantalla 2026-05-28 001558" src="https://github.com/user-attachments/assets/e0b4bea6-d1b7-4793-a995-ec2a139a5af6" /> <img width="1177" height="528" alt="Captura de pantalla 2026-05-28 001913" src="https://github.com/user-attachments/assets/28ec5bf8-3a02-4660-ba62-3edbcabeaf51" /> <img width="1147" height="531" alt="Captura de pantalla 2026-05-28 002032" src="https://github.com/user-attachments/assets/b148f1ae-473a-4505-b0f4-ca8820fbbb55" /> <img width="1219" height="536" alt="Captura de pantalla 2026-05-28 002348" src="https://github.com/user-attachments/assets/89af4d27-eadf-447c-9bde-d0dcfe1ff757" /> <img width="923" height="524" alt="Captura de pantalla 2026-05-28 002704" src="https://github.com/user-attachments/assets/50ad1b11-1685-41fb-b14d-088a2f0db88b" /> <img width="1307" height="456" alt="Captura de pantalla 2026-05-28 002859" src="https://github.com/user-attachments/assets/4ef18da9-336a-4698-8af0-2769467148b4" /> <img width="1219" height="548" alt="Captura de pantalla 2026-05-28 003134" src="https://github.com/user-attachments/assets/d0a514bf-e6e6-43f6-89b7-2168bc395010" /> <img width="1200" height="538" alt="Captura de pantalla 2026-05-28 003449" src="https://github.com/user-attachments/assets/c1672296-db4d-4baf-9992-4bb380fab4e9" /> <img width="1032" height="501" alt="Captura de pantalla 2026-05-28 003650" src="https://github.com/user-attachments/assets/8dd5ee07-3ac3-4f03-a56e-31c01d612655" /> <img width="1074" height="525" alt="Captura de pantalla 2026-05-28 003951" src="https://github.com/user-attachments/assets/e140706b-3f1c-4e09-b70c-efc3e6536c60" /> <img width="914" height="513" alt="Captura de pantalla 2026-05-28 004632" src="https://github.com/user-attachments/assets/e0dd6820-62f4-48b6-8356-df20c0e6ed8f" /> <img width="988" height="509" alt="Captura de pantalla 2026-05-28 005518" src="https://github.com/user-attachments/assets/0da95c41-1191-4de4-a3ce-873839c00605" /> <img width="986" height="514" alt="Captura de pantalla 2026-05-28 000505" src="https://github.com/user-attachments/assets/4eb20c73-56ba-4f9f-90af-8a047aa399eb" /> ## 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 |
||
|
|
23a1538c7e |
Fix Bosphorus map (#3823)
## Description: QoL changes for the Bosphorus map. The base image for the map had a little aliasing which resulted in some rivers being cut off. <img width="673" height="386" alt="image" src="https://github.com/user-attachments/assets/b8ed181f-fbeb-4d6f-b7ab-a8b0ea300a22" /> All of the nations except istanbul also had absolutely nothing to do with the region. For example, Varna is a city in Northeast bulgaria and the aegean isles are also nowhere near. There was also a nation that did not spawn because its coordinates were in the sea. <img width="626" height="413" alt="image" src="https://github.com/user-attachments/assets/a6537f79-3785-4316-8fd4-a99f55faff71" /> All of these poor designs are probably the result of the map being resized, originally being a larger map. It probably explains why this is the smallest map by land area (not counting Oceania) Fixes: - Fixed landlocked rivers and added More accurate bodies of water - Complete remake of the nations. Nations are now far more accurately placed districts of the region, and more evenly placed <img width="664" height="407" alt="image" src="https://github.com/user-attachments/assets/ff5a34fc-dea0-4a3d-b798-39d5711b91af" /> The data and gamestyle of this map should not change much, as the landmasses remain in practice the same ## 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 |
||
|
|
4ae1fa2ebe |
Remove small islands on compact maps with half threshold 🏝️ (#3762)
## Description: Small-island removal previously ran only on the full-size terrain. The compact (4x downscaled) map inherited that filtering before being downscaled, which meant islands that survived at full size could end up as tiny specks in the compact map. This PR runs `removeSmallIslands` on the 4x terrain as well, with half the threshold (15 vs 30 tiles), so very small islands are pruned in compact maps while the full-size map is unchanged. ## 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 |
||
|
|
5542ac12e1 |
Add new map: Bosphorus Straits (#2927)
## Description: Adds a new Bosphorus Map (Turkey). One of the key strategic locations in the world and control access to the Black Sea. Smaller map that most to facilitate smaller FFA and Team games. Added are a selection of nations that correspond to the location. <img width="1000" height="612" alt="image" src="https://github.com/user-attachments/assets/27a6debc-a33b-4b54-b522-69ab814c39f0" />   ## 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: TSProphet --------- Co-authored-by: Ryan <7389646+ryanbarlow97@users.noreply.github.com> Co-authored-by: iamlewis <lewismmmm@gmail.com> |