Skip to content

feat(map-generator): cap water magnitude at 11 for better compression#3859

Open
alexjurkiewicz wants to merge 2 commits intoopenfrontio:mainfrom
alexjurkiewicz:feat/cap-water-magnitude
Open

feat(map-generator): cap water magnitude at 11 for better compression#3859
alexjurkiewicz wants to merge 2 commits intoopenfrontio:mainfrom
alexjurkiewicz:feat/cap-water-magnitude

Conversation

@alexjurkiewicz
Copy link
Copy Markdown
Contributor

@alexjurkiewicz alexjurkiewicz commented May 6, 2026

Description:

Water tile magnitude encodes distance from land and was previously stored as values up to 31. The pathfinding sweet spot is magnitude 3–10 (zero penalty); values above 10 carry a slight deep-water penalty, and values above 11 have no additional effect. Capping at 11 preserves the deep-water penalty threshold while making the lower bits of distant ocean tiles more homogeneous, improving gzip/brotli compression ratios of the generated .bin files.

No change to land tile output.

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
  • 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:

alexjurkiewicz

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 6, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

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: 10467c0b-6cf1-49dd-a3d2-3a41921fce30

📥 Commits

Reviewing files that changed from the base of the PR and between e58886c and bc32f3f.

⛔ Files ignored due to path filters (227)
  • resources/maps/achiran/map.bin is excluded by !**/*.bin
  • resources/maps/achiran/map16x.bin is excluded by !**/*.bin
  • resources/maps/achiran/map4x.bin is excluded by !**/*.bin
  • resources/maps/aegean/map.bin is excluded by !**/*.bin
  • resources/maps/aegean/map16x.bin is excluded by !**/*.bin
  • resources/maps/aegean/map4x.bin is excluded by !**/*.bin
  • resources/maps/africa/map.bin is excluded by !**/*.bin
  • resources/maps/africa/map16x.bin is excluded by !**/*.bin
  • resources/maps/africa/map4x.bin is excluded by !**/*.bin
  • resources/maps/amazonriver/map.bin is excluded by !**/*.bin
  • resources/maps/amazonriver/map4x.bin is excluded by !**/*.bin
  • resources/maps/antarctica/map.bin is excluded by !**/*.bin
  • resources/maps/antarctica/map16x.bin is excluded by !**/*.bin
  • resources/maps/antarctica/map4x.bin is excluded by !**/*.bin
  • resources/maps/archipelagosea/map.bin is excluded by !**/*.bin
  • resources/maps/archipelagosea/map16x.bin is excluded by !**/*.bin
  • resources/maps/archipelagosea/map4x.bin is excluded by !**/*.bin
  • resources/maps/arctic/map.bin is excluded by !**/*.bin
  • resources/maps/arctic/map16x.bin is excluded by !**/*.bin
  • resources/maps/arctic/map4x.bin is excluded by !**/*.bin
  • resources/maps/asia/map.bin is excluded by !**/*.bin
  • resources/maps/asia/map16x.bin is excluded by !**/*.bin
  • resources/maps/asia/map4x.bin is excluded by !**/*.bin
  • resources/maps/australia/map.bin is excluded by !**/*.bin
  • resources/maps/australia/map16x.bin is excluded by !**/*.bin
  • resources/maps/australia/map4x.bin is excluded by !**/*.bin
  • resources/maps/baikal/map.bin is excluded by !**/*.bin
  • resources/maps/baikal/map16x.bin is excluded by !**/*.bin
  • resources/maps/baikal/map4x.bin is excluded by !**/*.bin
  • resources/maps/baikalnukewars/map.bin is excluded by !**/*.bin
  • resources/maps/baikalnukewars/map16x.bin is excluded by !**/*.bin
  • resources/maps/baikalnukewars/map4x.bin is excluded by !**/*.bin
  • resources/maps/bajacalifornia/map.bin is excluded by !**/*.bin
  • resources/maps/bajacalifornia/map16x.bin is excluded by !**/*.bin
  • resources/maps/bajacalifornia/map4x.bin is excluded by !**/*.bin
  • resources/maps/beringsea/map.bin is excluded by !**/*.bin
  • resources/maps/beringsea/map16x.bin is excluded by !**/*.bin
  • resources/maps/beringsea/map4x.bin is excluded by !**/*.bin
  • resources/maps/beringstrait/map.bin is excluded by !**/*.bin
  • resources/maps/beringstrait/map16x.bin is excluded by !**/*.bin
  • resources/maps/beringstrait/map4x.bin is excluded by !**/*.bin
  • resources/maps/betweentwoseas/map.bin is excluded by !**/*.bin
  • resources/maps/betweentwoseas/map16x.bin is excluded by !**/*.bin
  • resources/maps/betweentwoseas/map4x.bin is excluded by !**/*.bin
  • resources/maps/blacksea/map.bin is excluded by !**/*.bin
  • resources/maps/blacksea/map16x.bin is excluded by !**/*.bin
  • resources/maps/blacksea/map4x.bin is excluded by !**/*.bin
  • resources/maps/bosphorusstraits/map.bin is excluded by !**/*.bin
  • resources/maps/bosphorusstraits/map16x.bin is excluded by !**/*.bin
  • resources/maps/bosphorusstraits/map4x.bin is excluded by !**/*.bin
  • resources/maps/britannia/map.bin is excluded by !**/*.bin
  • resources/maps/britannia/map16x.bin is excluded by !**/*.bin
  • resources/maps/britannia/map4x.bin is excluded by !**/*.bin
  • resources/maps/britanniaclassic/map.bin is excluded by !**/*.bin
  • resources/maps/britanniaclassic/map16x.bin is excluded by !**/*.bin
  • resources/maps/britanniaclassic/map4x.bin is excluded by !**/*.bin
  • resources/maps/caucasus/map.bin is excluded by !**/*.bin
  • resources/maps/caucasus/map16x.bin is excluded by !**/*.bin
  • resources/maps/caucasus/map4x.bin is excluded by !**/*.bin
  • resources/maps/conakry/map.bin is excluded by !**/*.bin
  • resources/maps/conakry/map16x.bin is excluded by !**/*.bin
  • resources/maps/conakry/map4x.bin is excluded by !**/*.bin
  • resources/maps/deglaciatedantarctica/map.bin is excluded by !**/*.bin
  • resources/maps/deglaciatedantarctica/map16x.bin is excluded by !**/*.bin
  • resources/maps/deglaciatedantarctica/map4x.bin is excluded by !**/*.bin
  • resources/maps/didier/map.bin is excluded by !**/*.bin
  • resources/maps/didier/map16x.bin is excluded by !**/*.bin
  • resources/maps/didier/map4x.bin is excluded by !**/*.bin
  • resources/maps/didierfrance/map.bin is excluded by !**/*.bin
  • resources/maps/didierfrance/map16x.bin is excluded by !**/*.bin
  • resources/maps/didierfrance/map4x.bin is excluded by !**/*.bin
  • resources/maps/dyslexdria/map.bin is excluded by !**/*.bin
  • resources/maps/dyslexdria/map16x.bin is excluded by !**/*.bin
  • resources/maps/dyslexdria/map4x.bin is excluded by !**/*.bin
  • resources/maps/eastasia/map.bin is excluded by !**/*.bin
  • resources/maps/eastasia/map16x.bin is excluded by !**/*.bin
  • resources/maps/eastasia/map4x.bin is excluded by !**/*.bin
  • resources/maps/europe/map.bin is excluded by !**/*.bin
  • resources/maps/europe/map16x.bin is excluded by !**/*.bin
  • resources/maps/europe/map4x.bin is excluded by !**/*.bin
  • resources/maps/europeclassic/map.bin is excluded by !**/*.bin
  • resources/maps/europeclassic/map16x.bin is excluded by !**/*.bin
  • resources/maps/europeclassic/map4x.bin is excluded by !**/*.bin
  • resources/maps/falklandislands/map.bin is excluded by !**/*.bin
  • resources/maps/falklandislands/map16x.bin is excluded by !**/*.bin
  • resources/maps/falklandislands/map4x.bin is excluded by !**/*.bin
  • resources/maps/faroeislands/map.bin is excluded by !**/*.bin
  • resources/maps/faroeislands/map16x.bin is excluded by !**/*.bin
  • resources/maps/faroeislands/map4x.bin is excluded by !**/*.bin
  • resources/maps/fourislands/map.bin is excluded by !**/*.bin
  • resources/maps/fourislands/map16x.bin is excluded by !**/*.bin
  • resources/maps/fourislands/map4x.bin is excluded by !**/*.bin
  • resources/maps/gatewaytotheatlantic/map.bin is excluded by !**/*.bin
  • resources/maps/gatewaytotheatlantic/map16x.bin is excluded by !**/*.bin
  • resources/maps/gatewaytotheatlantic/map4x.bin is excluded by !**/*.bin
  • resources/maps/giantworldmap/map.bin is excluded by !**/*.bin
  • resources/maps/giantworldmap/map16x.bin is excluded by !**/*.bin
  • resources/maps/giantworldmap/map4x.bin is excluded by !**/*.bin
  • resources/maps/greatlakes/map.bin is excluded by !**/*.bin
  • resources/maps/greatlakes/map16x.bin is excluded by !**/*.bin
  • resources/maps/greatlakes/map4x.bin is excluded by !**/*.bin
  • resources/maps/gulfofstlawrence/map.bin is excluded by !**/*.bin
  • resources/maps/gulfofstlawrence/map16x.bin is excluded by !**/*.bin
  • resources/maps/gulfofstlawrence/map4x.bin is excluded by !**/*.bin
  • resources/maps/halkidiki/map.bin is excluded by !**/*.bin
  • resources/maps/halkidiki/map16x.bin is excluded by !**/*.bin
  • resources/maps/halkidiki/map4x.bin is excluded by !**/*.bin
  • resources/maps/hawaii/map.bin is excluded by !**/*.bin
  • resources/maps/hawaii/map16x.bin is excluded by !**/*.bin
  • resources/maps/hawaii/map4x.bin is excluded by !**/*.bin
  • resources/maps/iceland/map.bin is excluded by !**/*.bin
  • resources/maps/iceland/map16x.bin is excluded by !**/*.bin
  • resources/maps/iceland/map4x.bin is excluded by !**/*.bin
  • resources/maps/italia/map.bin is excluded by !**/*.bin
  • resources/maps/italia/map16x.bin is excluded by !**/*.bin
  • resources/maps/italia/map4x.bin is excluded by !**/*.bin
  • resources/maps/japan/map.bin is excluded by !**/*.bin
  • resources/maps/japan/map16x.bin is excluded by !**/*.bin
  • resources/maps/japan/map4x.bin is excluded by !**/*.bin
  • resources/maps/lemnos/map.bin is excluded by !**/*.bin
  • resources/maps/lemnos/map16x.bin is excluded by !**/*.bin
  • resources/maps/lemnos/map4x.bin is excluded by !**/*.bin
  • resources/maps/lisbon/map.bin is excluded by !**/*.bin
  • resources/maps/lisbon/map16x.bin is excluded by !**/*.bin
  • resources/maps/lisbon/map4x.bin is excluded by !**/*.bin
  • resources/maps/losangeles/map.bin is excluded by !**/*.bin
  • resources/maps/losangeles/map16x.bin is excluded by !**/*.bin
  • resources/maps/losangeles/map4x.bin is excluded by !**/*.bin
  • resources/maps/luna/map.bin is excluded by !**/*.bin
  • resources/maps/luna/map16x.bin is excluded by !**/*.bin
  • resources/maps/luna/map4x.bin is excluded by !**/*.bin
  • resources/maps/manicouagan/map.bin is excluded by !**/*.bin
  • resources/maps/manicouagan/map16x.bin is excluded by !**/*.bin
  • resources/maps/manicouagan/map4x.bin is excluded by !**/*.bin
  • resources/maps/marenostrum/map.bin is excluded by !**/*.bin
  • resources/maps/marenostrum/map16x.bin is excluded by !**/*.bin
  • resources/maps/marenostrum/map4x.bin is excluded by !**/*.bin
  • resources/maps/mars/map.bin is excluded by !**/*.bin
  • resources/maps/mars/map16x.bin is excluded by !**/*.bin
  • resources/maps/mars/map4x.bin is excluded by !**/*.bin
  • resources/maps/mena/map.bin is excluded by !**/*.bin
  • resources/maps/mena/map16x.bin is excluded by !**/*.bin
  • resources/maps/mena/map4x.bin is excluded by !**/*.bin
  • resources/maps/middleeast/map.bin is excluded by !**/*.bin
  • resources/maps/middleeast/map16x.bin is excluded by !**/*.bin
  • resources/maps/middleeast/map4x.bin is excluded by !**/*.bin
  • resources/maps/milkyway/map.bin is excluded by !**/*.bin
  • resources/maps/milkyway/map16x.bin is excluded by !**/*.bin
  • resources/maps/milkyway/map4x.bin is excluded by !**/*.bin
  • resources/maps/montreal/map.bin is excluded by !**/*.bin
  • resources/maps/montreal/map16x.bin is excluded by !**/*.bin
  • resources/maps/montreal/map4x.bin is excluded by !**/*.bin
  • resources/maps/newyorkcity/map.bin is excluded by !**/*.bin
  • resources/maps/newyorkcity/map16x.bin is excluded by !**/*.bin
  • resources/maps/newyorkcity/map4x.bin is excluded by !**/*.bin
  • resources/maps/niledelta/map.bin is excluded by !**/*.bin
  • resources/maps/niledelta/map16x.bin is excluded by !**/*.bin
  • resources/maps/niledelta/map4x.bin is excluded by !**/*.bin
  • resources/maps/northamerica/map.bin is excluded by !**/*.bin
  • resources/maps/northamerica/map16x.bin is excluded by !**/*.bin
  • resources/maps/northamerica/map4x.bin is excluded by !**/*.bin
  • resources/maps/oceania/map.bin is excluded by !**/*.bin
  • resources/maps/oceania/map16x.bin is excluded by !**/*.bin
  • resources/maps/oceania/map4x.bin is excluded by !**/*.bin
  • resources/maps/pangaea/map.bin is excluded by !**/*.bin
  • resources/maps/pangaea/map16x.bin is excluded by !**/*.bin
  • resources/maps/pangaea/map4x.bin is excluded by !**/*.bin
  • resources/maps/passage/map.bin is excluded by !**/*.bin
  • resources/maps/passage/map16x.bin is excluded by !**/*.bin
  • resources/maps/passage/map4x.bin is excluded by !**/*.bin
  • resources/maps/pluto/map.bin is excluded by !**/*.bin
  • resources/maps/pluto/map16x.bin is excluded by !**/*.bin
  • resources/maps/pluto/map4x.bin is excluded by !**/*.bin
  • resources/maps/sanfrancisco/map.bin is excluded by !**/*.bin
  • resources/maps/sanfrancisco/map16x.bin is excluded by !**/*.bin
  • resources/maps/sanfrancisco/map4x.bin is excluded by !**/*.bin
  • resources/maps/sierpinski/map.bin is excluded by !**/*.bin
  • resources/maps/sierpinski/map16x.bin is excluded by !**/*.bin
  • resources/maps/sierpinski/map4x.bin is excluded by !**/*.bin
  • resources/maps/southamerica/map.bin is excluded by !**/*.bin
  • resources/maps/southamerica/map16x.bin is excluded by !**/*.bin
  • resources/maps/southamerica/map4x.bin is excluded by !**/*.bin
  • resources/maps/straitofgibraltar/map.bin is excluded by !**/*.bin
  • resources/maps/straitofgibraltar/map16x.bin is excluded by !**/*.bin
  • resources/maps/straitofgibraltar/map4x.bin is excluded by !**/*.bin
  • resources/maps/straitofhormuz/map.bin is excluded by !**/*.bin
  • resources/maps/straitofhormuz/map16x.bin is excluded by !**/*.bin
  • resources/maps/straitofhormuz/map4x.bin is excluded by !**/*.bin
  • resources/maps/straitofmalacca/map.bin is excluded by !**/*.bin
  • resources/maps/straitofmalacca/map16x.bin is excluded by !**/*.bin
  • resources/maps/straitofmalacca/map4x.bin is excluded by !**/*.bin
  • resources/maps/surrounded/map.bin is excluded by !**/*.bin
  • resources/maps/surrounded/map16x.bin is excluded by !**/*.bin
  • resources/maps/surrounded/map4x.bin is excluded by !**/*.bin
  • resources/maps/svalmel/map.bin is excluded by !**/*.bin
  • resources/maps/svalmel/map16x.bin is excluded by !**/*.bin
  • resources/maps/svalmel/map4x.bin is excluded by !**/*.bin
  • resources/maps/tourney1/map.bin is excluded by !**/*.bin
  • resources/maps/tourney1/map16x.bin is excluded by !**/*.bin
  • resources/maps/tourney1/map4x.bin is excluded by !**/*.bin
  • resources/maps/tourney2/map.bin is excluded by !**/*.bin
  • resources/maps/tourney2/map16x.bin is excluded by !**/*.bin
  • resources/maps/tourney2/map4x.bin is excluded by !**/*.bin
  • resources/maps/tourney3/map.bin is excluded by !**/*.bin
  • resources/maps/tourney3/map16x.bin is excluded by !**/*.bin
  • resources/maps/tourney3/map4x.bin is excluded by !**/*.bin
  • resources/maps/tourney4/map.bin is excluded by !**/*.bin
  • resources/maps/tourney4/map16x.bin is excluded by !**/*.bin
  • resources/maps/tourney4/map4x.bin is excluded by !**/*.bin
  • resources/maps/tradersdream/map.bin is excluded by !**/*.bin
  • resources/maps/tradersdream/map16x.bin is excluded by !**/*.bin
  • resources/maps/tradersdream/map4x.bin is excluded by !**/*.bin
  • resources/maps/twolakes/map.bin is excluded by !**/*.bin
  • resources/maps/twolakes/map16x.bin is excluded by !**/*.bin
  • resources/maps/twolakes/map4x.bin is excluded by !**/*.bin
  • resources/maps/world/map.bin is excluded by !**/*.bin
  • resources/maps/world/map16x.bin is excluded by !**/*.bin
  • resources/maps/world/map4x.bin is excluded by !**/*.bin
  • resources/maps/yenisei/map.bin is excluded by !**/*.bin
  • resources/maps/yenisei/map16x.bin is excluded by !**/*.bin
  • resources/maps/yenisei/map4x.bin is excluded by !**/*.bin
  • tests/testdata/maps/giantworldmap/map.bin is excluded by !**/*.bin
  • tests/testdata/maps/giantworldmap/map16x.bin is excluded by !**/*.bin
  • tests/testdata/maps/giantworldmap/map4x.bin is excluded by !**/*.bin
  • tests/testdata/maps/world/map.bin is excluded by !**/*.bin
  • tests/testdata/maps/world/map16x.bin is excluded by !**/*.bin
  • tests/testdata/maps/world/map4x.bin is excluded by !**/*.bin
📒 Files selected for processing (6)
  • map-generator/map-generator
  • resources/maps/dyslexdria/manifest.json
  • resources/maps/losangeles/manifest.json
  • resources/maps/losangeles/thumbnail.webp
  • resources/maps/luna/manifest.json
  • resources/maps/luna/thumbnail.webp
✅ Files skipped from review due to trivial changes (2)
  • resources/maps/dyslexdria/manifest.json
  • resources/maps/luna/manifest.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • resources/maps/losangeles/manifest.json

Walkthrough

Water tile magnitude packing is reduced from a cap of 31 to 11 in the map generator. Three game map manifests are updated to reflect adjusted land tile counts following this encoding change.

Changes

Water Tile Magnitude Encoding & Map Manifest Updates

Layer / File(s) Summary
Magnitude Packing Logic
map-generator/map_generator.go
Water tiles' magnitude is now capped at 11 (using Ceil(tile.Magnitude/2)) instead of 31 during bit-packing in packTerrain; Land tile logic unchanged.
Map Manifests
resources/maps/dyslexdria/manifest.json, resources/maps/losangeles/manifest.json, resources/maps/luna/manifest.json
Land tile counts updated in map4x configurations: Dyslexdria (459895 → 458859), Los Angeles (508470 → 508420), Luna (364566 → 363006).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

💧 Water tiles now pack more tight,
With caps at eleven, not at height,
Maps regenerate, numbers shift down,
Land tile counts wear their new crown! 🗺️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: capping water magnitude at 11 for compression improvements in the map generator.
Description check ✅ Passed The description is directly related to the changeset, explaining the technical rationale for capping water magnitude at 11, pathfinding behavior, compression benefits, and confirming no changes to land tiles.
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.

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


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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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/map_generator.go`:
- Line 578: The pack logic at packedByte |=
byte(math.Min(math.Ceil(tile.Magnitude/2), 10)) prevents any encoded magnitude
>10, so AStar.Water.ts / AStar.WaterBounded.ts branches for magnitude >10 never
run; fix by aligning the encoder with the pathfinder: remove or raise the cap so
values >10 can be encoded (e.g., drop the math.Min(...,10) or increase the cap
above the threshold used in AStar.Water.ts), or alternatively adjust the AStar
code to use >= the packed maximum; update the packing in the map generator (the
packedByte/ tile.Magnitude encoding) accordingly so deep-water penalty logic
remains reachable.
🪄 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: 59a16d8e-a8a8-4990-98f2-0338260591db

📥 Commits

Reviewing files that changed from the base of the PR and between c0b9764 and 6e5fc75.

📒 Files selected for processing (1)
  • map-generator/map_generator.go

Comment thread map-generator/map_generator.go Outdated
@github-project-automation github-project-automation Bot moved this from Triage to Development in OpenFront Release Management May 6, 2026
@alexjurkiewicz alexjurkiewicz force-pushed the feat/cap-water-magnitude branch from 6e5fc75 to f97fc38 Compare May 6, 2026 10:30
@alexjurkiewicz alexjurkiewicz changed the title feat(map-generator): cap water magnitude at 10 for better compression feat(map-generator): cap water magnitude at 11 for better compression May 6, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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/map_generator.go`:
- Line 578: The code caps encoded water magnitude to 11 using packedByte |=
byte(math.Min(math.Ceil(tile.Magnitude/2), 11)), which contradicts the PR
objective to cap at 10; change the cap constant from 11 to 10 so packedByte uses
math.Min(math.Ceil(tile.Magnitude/2), 10) and ensure any pathfinding thresholds
that assume a different encoding (refer to AStar.Water.ts and its deep-water
checks) are updated in the same PR or update the PR description to state that a
deep-water (magnitude>10) distinction is intentional; verify tile.Magnitude and
packedByte encoding consistency across map_generator.go and
src/core/pathfinding/algorithms/AStar.Water.ts.
🪄 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: 23f9041a-d297-4579-83fd-467875ddd665

📥 Commits

Reviewing files that changed from the base of the PR and between 6e5fc75 and f97fc38.

📒 Files selected for processing (1)
  • map-generator/map_generator.go

Comment thread map-generator/map_generator.go
Copy link
Copy Markdown
Contributor Author

@alexjurkiewicz alexjurkiewicz left a comment

Choose a reason for hiding this comment

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

Thank you robot 🤖

@VariableVince
Copy link
Copy Markdown
Contributor

Hi @alexjurkiewicz, it's not the most important thing but would it be possible for you to apply our default PR template? It should normally be applied automatically on PR creation, maybe something went wrong there. You can find it here: https://github.com/openfrontio/OpenFrontIO/blob/main/.github/PULL_REQUEST_TEMPLATE.md. This should also fix the failing Valid Description test.

In the Description template we also ask for your Discord name if you have that. Especially welcome if you'd like to join our Dev server, link here in the readme: https://github.com/openfrontio/OpenFrontIO#-contributing

Btw the CI Test failed previously in this PR, because of an unrelated test that sometimes takes too long to run. Fixing that now in another PR, and re-ran the job in here which now completed within the default timout.

@evanpelle
Copy link
Copy Markdown
Collaborator

Can you run the map generator to regen the map files

Water tile magnitude encodes distance from land and was previously stored
as values up to 31. The pathfinding sweet spot is magnitude 3–10 (zero
penalty); values above 10 carry a slight deep-water penalty, and values
above 11 have no additional effect. Capping at 11 preserves the
deep-water penalty threshold while making the lower bits of distant ocean
tiles more homogeneous, improving gzip/brotli compression ratios of the
generated .bin files.

No change to land tile output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@alexjurkiewicz alexjurkiewicz force-pushed the feat/cap-water-magnitude branch from f97fc38 to e58886c Compare May 7, 2026 00:09
@alexjurkiewicz
Copy link
Copy Markdown
Contributor Author

Rebased onto main with performance improvements from #3860 and rebuilt maps 👍

@alexjurkiewicz alexjurkiewicz force-pushed the feat/cap-water-magnitude branch from e58886c to bc32f3f Compare May 7, 2026 00:15
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

no sure why num land tiles should change? unless the generated maps were out of date

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

update: i reran the map generator it was out of date.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I'm not clear what you mean. I believe the maps in this PR are all up to date. Is that what you see?

I can see there are some merge conflicts, do you want me to rebase and regenerate all maps?

Given how fast map generation is now, it might make sense to remove "compiled" maps from the repo, and instead build them in CI. But that could be a future PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development

Development

Successfully merging this pull request may close these issues.

4 participants