Add tribe name themes system with custom tribes support 🏰#4647
Conversation
WalkthroughGermany now supplies custom tribe names through map metadata. Code generation exposes map themes and custom tribes, runtime resolution loads themed name data, and tribe spawning prioritizes unused custom names. Tests cover metadata consistency, theme validity, resolution, and deterministic names. ChangesMap-specific tribe naming
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant GermanyMap
participant MapsGen
participant resolveTribeNameData
participant TribeSpawner
GermanyMap->>MapsGen: provide themes and customTribes metadata
MapsGen-->>resolveTribeNameData: expose map naming configuration
TribeSpawner->>resolveTribeNameData: resolve gameMap tribe-name data
resolveTribeNameData-->>TribeSpawner: return customTribes and theme fragments
TribeSpawner->>TribeSpawner: choose an unused custom name or compose a themed name
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@map-generator/assets/maps/germany/info.json`:
- Around line 7-412: The Germany custom_tribes source contains exact duplicates
that must be removed. In map-generator/assets/maps/germany/info.json lines
7-412, deduplicate the array; regenerate map outputs so
resources/maps/germany/manifest.json lines 3-408 and src/core/game/Maps.gen.ts
lines 475-880 contain the same unique entries, with no direct manual change
needed in Maps.gen.ts beyond regeneration. In map-generator/codegen.go lines
122-126, update loadMapInfos to detect duplicate custom tribe names and fail
generation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cfd62e9b-2d74-4368-824a-0e54d7520f8b
📒 Files selected for processing (11)
map-generator/assets/maps/germany/info.jsonmap-generator/codegen.goresources/maps/germany/manifest.jsonsrc/client/view/GameView.tssrc/core/Util.tssrc/core/execution/TribeSpawner.tssrc/core/execution/utils/TribeNames.tssrc/core/execution/utils/tribeNameThemes.jsonsrc/core/game/Maps.gen.tstests/MapConsistency.test.tstests/TribeNameThemes.test.ts
There was a problem hiding this comment.
🧹 Nitpick comments (2)
resources/tribeNameThemes.json (2)
167-172: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove duplicated names with alternative spellings.
The
defaultprefixes list contains both "Uyghur" (line 150) and "Uighur". You can remove one of them to prevent generating very similar tribe names.♻️ Proposed fix
"Uzbek", "Kyrgyz", "Tajik", - "Uighur", "Pashtun", "Baloch",🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@resources/tribeNameThemes.json` around lines 167 - 172, Remove the duplicate alternative spelling “Uighur” from the default prefixes list, retaining the existing “Uyghur” entry and leaving all other tribe names unchanged.
231-235: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider removing the plural "Republics".
The
defaultsuffixes list contains both "Republic" (line 190) and "Republics". Since most other suffixes are singular (e.g., "Empire", "Kingdom", "State"), you might want to remove "Republics" for consistency.♻️ Proposed fix
"Supremacy", "Tribe", - "Republics", "Army", "Dictatorship",🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@resources/tribeNameThemes.json` around lines 231 - 235, Remove the plural "Republics" entry from the default suffixes list in tribeNameThemes.json, retaining the existing singular "Republic" entry and leaving all other suffixes unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@resources/tribeNameThemes.json`:
- Around line 167-172: Remove the duplicate alternative spelling “Uighur” from
the default prefixes list, retaining the existing “Uyghur” entry and leaving all
other tribe names unchanged.
- Around line 231-235: Remove the plural "Republics" entry from the default
suffixes list in tribeNameThemes.json, retaining the existing singular
"Republic" entry and leaving all other suffixes unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 03251349-3c50-4ff7-ace1-76edde87b51d
📒 Files selected for processing (3)
resources/tribeNameThemes.jsonsrc/core/execution/utils/TribeNames.tstests/TribeNameThemes.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/TribeNameThemes.test.ts
- src/core/execution/utils/TribeNames.ts
Description:
Adds a theme system for bot tribe names that maps can customize via their info.json. Instead of all bots using the same global name pool, maps can now specify one or more themed name sets and define custom tribe names with higher priority.
Key changes:
src/core/execution/utils/tribeNameThemes.jsoncontaining 17 themed name sets (default, north_america, south_america, europe, africa, asia, oceania, space, fantasy, war, western, under_ocean, tournament, funny, scary, weird, vs). The default theme preserves the originalTribeNames.tsvalues. Mappers are encouraged to change that json file, the new themes just serve as an example and are currently not used by any map."themes": ["europe", "war"]in info.json to merge prefixes/suffixes from multiple themes into one name pool."custom_tribes": ["Holy Roman Empire", "Kalmar Union"]for exact tribe names that take priority over theme-generated names. Custom tribes are used first (random selection, no duplicates until exhausted), then theme-based prefix+suffix combos.TribeNameResolverresolves themes per-map at runtime, with fallback to the default theme and a console warning for unknown theme names.codegen.go) updated to propagatethemesandcustom_tribesfrom info.json to Maps.gen.ts.Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
FloPinguin