Skip to content

Allow mappers to omit nation coordinates in manifest.json for random spawn 🎲#4156

Merged
evanpelle merged 1 commit into
mainfrom
optional-nation-coordinates
Jun 4, 2026
Merged

Allow mappers to omit nation coordinates in manifest.json for random spawn 🎲#4156
evanpelle merged 1 commit into
mainfrom
optional-nation-coordinates

Conversation

@FloPinguin
Copy link
Copy Markdown
Contributor

@FloPinguin FloPinguin commented Jun 4, 2026

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:

  • 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 v32 milestone Jun 4, 2026
@FloPinguin FloPinguin self-assigned this Jun 4, 2026
@FloPinguin FloPinguin requested a review from a team as a code owner June 4, 2026 13:31
@github-actions github-actions Bot added the auto-closed-needs-issue PR closed by gate — see comment for next steps label Jun 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Hi @FloPinguin, thanks for the contribution.

This PR was automatically closed because it doesn't fit our contribution workflow:

  • You aren't currently assigned to an issue labelled approved, and
  • The change is larger than 50 lines (our cap for unsolicited contributions).

To contribute to OpenFront:

  1. For bugs or small quality-of-life improvements: open an issue. A maintainer will label it approved if it's something we'll work on.
  2. For feature ideas: discuss in the dev Discord first. We don't accept unsolicited feature PRs — even if they're good ideas, every merged feature is a permanent maintenance burden.
  3. Once an issue is labelled approved, comment asking to be assigned. After you're assigned, you can open a PR referencing that issue.

If you believe this was closed in error, please reach out on our Discord or comment below.

See CONTRIBUTING.md for the full contribution process.

Automated PR gate. Source.

@github-actions github-actions Bot closed this Jun 4, 2026
@github-project-automation github-project-automation Bot moved this from Triage to Complete in OpenFront Release Management Jun 4, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bfc40bd9-74fd-4ce7-97db-1f1de88f3455

📥 Commits

Reviewing files that changed from the base of the PR and between 986f0b6 and a0aaa1a.

📒 Files selected for processing (4)
  • src/core/game/NationCreation.ts
  • src/core/game/TerrainMapLoader.ts
  • tests/MapConsistency.test.ts
  • tests/NationCreation.test.ts

Walkthrough

This PR makes nation coordinates optional throughout the nation and map systems. The Nation.coordinates type changes from required to optional, with corresponding updates in nation creation and terrain loading to safely handle undefined coordinate values. Tests verify both cases.

Changes

Optional Nation Coordinates

Layer / File(s) Summary
Type contract and nation creation
src/core/game/TerrainMapLoader.ts, src/core/game/NationCreation.ts
Nation.coordinates changes from required [number, number] to optional [number, number]?. The toNation converter conditionally creates spawn cells based on coordinate presence.
Terrain map loading with optional coordinates
src/core/game/TerrainMapLoader.ts
Compact map loading now guards the coordinate downscaling logic with a presence check to prevent errors when nation coordinates are missing.
Test coverage for optional coordinates
tests/NationCreation.test.ts, tests/MapConsistency.test.ts
New test case validates spawn cell behavior when manifest coordinates are present or absent. Map consistency tests treat coordinates as optional and validate both nations and additionalNations arrays.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • evanpelle

Poem

Nations may wander without fixed ground,
Their coordinates float, undefined and free,
Tests now smile at emptiness found,
Each check stands guard gracefully,
Safe paths through maps and cells unseen. ✨🗺️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: allowing mappers to omit nation coordinates in manifest.json for random spawn placement.
Description check ✅ Passed The description is well-related to the changeset, explaining the rationale for allowing optional coordinates and providing context from the original requester.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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 and usage tips.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{"name":"HttpError","status":500,"request":{"method":"PATCH","url":"https://api.github.com/repos/openfrontio/OpenFrontIO/issues/comments/4622618840","headers":{"accept":"application/vnd.github.v3+json","user-agent":"octokit.js/0.0.0-development octokit-core.js/7.0.6 Node.js/24","authorization":"token [REDACTED]","content-type":"application/json; charset=utf-8"},"body":{"body":"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- review_stack_entry_start -->\n\n[![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/openfrontio/OpenFrontIO/pull/4156?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)\n\n<!-- review_stack_entry_end -->\n<!-- This is an auto-generated comment: review in progress by coderabbit.ai -->\n\n> [!NOTE]\n> Currently processing new changes in this PR. This may take a few minutes, please wait...\n> \n> <details>\n> <summary>⚙️ Run configuration</summary>\n> \n> **Configuration used**: Organization UI\n> \n> **Review profile**: CHILL\n> \n> **Plan**: Pro\n> \n> **Run ID**: `bfc40bd9-74fd-4ce7-97db-1f1de88f3455`\n> \n> </details>\n> \n> <details>\n> <summary>📥 Commits</summary>\n> \n> Reviewing files that changed from the base of the PR and between 986f0b61bf976be03fc571ac9eb16b00c2165fe8 and a0aaa1a6c45a5f5f136379e5cf6252fd3dc4da4d.\n> \n> </details>\n> \n> <details>\n> <summary>📒 Files selected for processing (4)</summary>\n> \n> * `src/core/game/NationCreation.ts`\n> * `src/core/game/TerrainMapLoader.ts`\n> * `tests/MapConsistency.test.ts`\n> * `tests/NationCreation.test.ts`\n> \n> </details>\n> \n> ```ascii\n>  _________________________\n> < Loose code sinks ships. >\n>  -------------------------\n>   \\\n>    \\   \\\n>         \\ /\\\n>         ( )\n>       .( o ).\n> ```\n\n<!-- end of auto-generated comment: review in progress by coderabbit.ai -->\n\n<!-- tips_start -->\n\n---\n\nThanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=openfrontio/OpenFrontIO&utm_content=4156)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.\n\n<details>\n<summary>❤️ Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n\n<sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub>\n\n<!-- tips_end -->"},"request":{"retryCount":3,"signal":{},"retries":3,"retryAfter":16}}}

@ryanbarlow97 ryanbarlow97 reopened this Jun 4, 2026
@github-project-automation github-project-automation Bot moved this from Complete to Triage in OpenFront Release Management Jun 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Hi @FloPinguin, thanks for the contribution.

This PR was automatically closed because it doesn't fit our contribution workflow:

  • You aren't currently assigned to an issue labelled approved, and
  • The change is larger than 50 lines (our cap for unsolicited contributions).

To contribute to OpenFront:

  1. For bugs or small quality-of-life improvements: open an issue. A maintainer will label it approved if it's something we'll work on.
  2. For feature ideas: discuss in the dev Discord first. We don't accept unsolicited feature PRs — even if they're good ideas, every merged feature is a permanent maintenance burden.
  3. Once an issue is labelled approved, comment asking to be assigned. After you're assigned, you can open a PR referencing that issue.

If you believe this was closed in error, please reach out on our Discord or comment below.

See CONTRIBUTING.md for the full contribution process.

Automated PR gate. Source.

@github-actions github-actions Bot closed this Jun 4, 2026
@github-project-automation github-project-automation Bot moved this from Triage to Complete in OpenFront Release Management Jun 4, 2026
@ryanbarlow97 ryanbarlow97 added approved Approved for a PR, if you assigned to the issue. and removed auto-closed-needs-issue PR closed by gate — see comment for next steps labels Jun 4, 2026
@ryanbarlow97 ryanbarlow97 reopened this Jun 4, 2026
@github-project-automation github-project-automation Bot moved this from Complete to Triage in OpenFront Release Management Jun 4, 2026
@github-actions github-actions Bot added the auto-closed-needs-issue PR closed by gate — see comment for next steps label Jun 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Hi @FloPinguin, thanks for the contribution.

This PR was automatically closed because it doesn't fit our contribution workflow:

  • You aren't currently assigned to an issue labelled approved, and
  • The change is larger than 50 lines (our cap for unsolicited contributions).

To contribute to OpenFront:

  1. For bugs or small quality-of-life improvements: open an issue. A maintainer will label it approved if it's something we'll work on.
  2. For feature ideas: discuss in the dev Discord first. We don't accept unsolicited feature PRs — even if they're good ideas, every merged feature is a permanent maintenance burden.
  3. Once an issue is labelled approved, comment asking to be assigned. After you're assigned, you can open a PR referencing that issue.

If you believe this was closed in error, please reach out on our Discord or comment below.

See CONTRIBUTING.md for the full contribution process.

Automated PR gate. Source.

@github-actions github-actions Bot closed this Jun 4, 2026
@github-project-automation github-project-automation Bot moved this from Triage to Complete in OpenFront Release Management Jun 4, 2026
@ryanbarlow97 ryanbarlow97 added bypass-pr-check Bypass the automated PR check and removed auto-closed-needs-issue PR closed by gate — see comment for next steps labels Jun 4, 2026
@ryanbarlow97 ryanbarlow97 reopened this Jun 4, 2026
@github-project-automation github-project-automation Bot moved this from Complete to Triage in OpenFront Release Management Jun 4, 2026
@github-project-automation github-project-automation Bot moved this from Triage to Final Review in OpenFront Release Management Jun 4, 2026
@evanpelle evanpelle merged commit 74b3bd2 into main Jun 4, 2026
44 checks passed
@evanpelle evanpelle deleted the optional-nation-coordinates branch June 4, 2026 22:57
@github-project-automation github-project-automation Bot moved this from Final Review to Complete in OpenFront Release Management Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Approved for a PR, if you assigned to the issue. bypass-pr-check Bypass the automated PR check Feature

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants