Skip to content

Add tribe name themes system with custom tribes support 🏰#4647

Merged
evanpelle merged 4 commits into
mainfrom
feature/tribe-name-themes
Jul 20, 2026
Merged

Add tribe name themes system with custom tribes support 🏰#4647
evanpelle merged 4 commits into
mainfrom
feature/tribe-name-themes

Conversation

@FloPinguin

@FloPinguin FloPinguin commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

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:

  • New src/core/execution/utils/tribeNameThemes.json containing 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 original TribeNames.ts values. Mappers are encouraged to change that json file, the new themes just serve as an example and are currently not used by any map.
  • Maps can specify "themes": ["europe", "war"] in info.json to merge prefixes/suffixes from multiple themes into one name pool.
  • Maps can specify "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.
  • TribeNameResolver resolves themes per-map at runtime, with fallback to the default theme and a console warning for unknown theme names.
  • Go codegen (codegen.go) updated to propagate themes and custom_tribes from info.json to Maps.gen.ts.
  • Germany map now has 404 custom tribes (all German Landkreise and kreisfreie Städte) to showcase the new feature.
  • Fixed a bug where tribe bots could inherit nation flags if their random name coincidentally matched a nation name (name-based cosmetics lookup now only applies to actual Nations, not Bots).

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • 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

@FloPinguin FloPinguin added this to the v33 milestone Jul 19, 2026
@FloPinguin
FloPinguin requested a review from a team as a code owner July 19, 2026 14:05
@FloPinguin FloPinguin added Maps A new map, or adjustments to an existing map itself, its json, etc, Feature labels Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Germany 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.

Changes

Map-specific tribe naming

Layer / File(s) Summary
Map metadata and code generation
map-generator/..., resources/maps/germany/manifest.json, src/core/game/Maps.gen.ts
Germany metadata defines custom tribe names, and code generation validates and emits themes and customTribes fields.
Theme data resolution
resources/tribeNameThemes.json, src/core/execution/utils/TribeNames.ts
Theme data is stored in JSON and resolved into merged prefixes and suffixes, with default and unknown-theme handling.
Runtime tribe and player naming
src/core/execution/TribeSpawner.ts, src/core/Util.ts, src/client/view/GameView.ts
Tribes select unused custom names before themed names, human names use resolved data, and cosmetics fallback is limited to nation players.
Metadata and naming validation
tests/MapConsistency.test.ts, tests/TribeNameThemes.test.ts
Tests validate generated metadata, theme structure, resolver behavior, duplicate-free defaults, and deterministic name generation.

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
Loading

Poem

German towns march in a name-filled parade,
Themes bloom where old prefixes stayed.
Custom tribes take the first bright turn,
Then themed names spin and return.
JSON and tests keep the naming flame.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: a tribe name theme system with custom tribes support.
Description check ✅ Passed The description accurately describes the changeset and matches the theme, custom tribe, codegen, and test updates.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d6b4b0e and d3d5f9d.

📒 Files selected for processing (11)
  • map-generator/assets/maps/germany/info.json
  • map-generator/codegen.go
  • resources/maps/germany/manifest.json
  • src/client/view/GameView.ts
  • src/core/Util.ts
  • src/core/execution/TribeSpawner.ts
  • src/core/execution/utils/TribeNames.ts
  • src/core/execution/utils/tribeNameThemes.json
  • src/core/game/Maps.gen.ts
  • tests/MapConsistency.test.ts
  • tests/TribeNameThemes.test.ts

Comment thread map-generator/assets/maps/germany/info.json
@github-project-automation github-project-automation Bot moved this from Triage to Development in OpenFront Release Management Jul 19, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
resources/tribeNameThemes.json (2)

167-172: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove duplicated names with alternative spellings.

The default prefixes 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 value

Consider removing the plural "Republics".

The default suffixes 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

📥 Commits

Reviewing files that changed from the base of the PR and between d3d5f9d and 3ace1d6.

📒 Files selected for processing (3)
  • resources/tribeNameThemes.json
  • src/core/execution/utils/TribeNames.ts
  • tests/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

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 19, 2026
@github-project-automation github-project-automation Bot moved this from Development to Final Review in OpenFront Release Management Jul 20, 2026
@evanpelle
evanpelle merged commit d9976ba into main Jul 20, 2026
13 checks passed
@evanpelle
evanpelle deleted the feature/tribe-name-themes branch July 20, 2026 01:46
@github-project-automation github-project-automation Bot moved this from Final Review to Complete in OpenFront Release Management Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Maps A new map, or adjustments to an existing map itself, its json, etc,

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

2 participants