Skip to content

Allow arbitrary height map image dimensions#3577

Merged
ZehMatt merged 7 commits intoOpenLoco:masterfrom
ZehMatt:heightmap-loading
Dec 25, 2025
Merged

Allow arbitrary height map image dimensions#3577
ZehMatt merged 7 commits intoOpenLoco:masterfrom
ZehMatt:heightmap-loading

Conversation

@ZehMatt
Copy link
Copy Markdown
Contributor

@ZehMatt ZehMatt commented Dec 24, 2025

Implements basic bilinear interpolation, when its the exact size no interpolation will happen, also images that are smaller will work just fine too now, it will always remap the coordinates. Also fixes a bug where gray scale pngs would not load, now it tells the png loader what we expect and it takes care of it for us.

output

Here is an example, left is 1424x1424 and right is 130x130, the difference is quite minor but that there is a difference is to be expected.

@LeeSpork
Copy link
Copy Markdown
Contributor

It generates land land too high now. In v25.12, generating this heightmap with the min land height set to 1 (and sea level 1) creates land ranging from +0 to +39 Units, but now, in this PR's latest artefact, it generates land ranging from +0 to +62. The gameplay currently only supports 40 levels of elevation from my testing (note the visual artefacts and terraform error message in the screenshot bellow.)
Heightmap
Screenshot

@ZehMatt
Copy link
Copy Markdown
Contributor Author

ZehMatt commented Dec 25, 2025

It generates land land too high now. In v25.12, generating this heightmap with the min land height set to 1 (and sea level 1) creates land ranging from +0 to +39 Units, but now, in this PR's latest artefact, it generates land ranging from +0 to +62. The gameplay currently only supports 40 levels of elevation from my testing (note the visual artefacts and terraform error message in the screenshot bellow.) Heightmap Screenshot

I wasn't sure what the exact upper bound is, will adjust it once I got some sleep.

@LeftofZen
Copy link
Copy Markdown
Contributor

LeftofZen commented Dec 25, 2025

The gameplay currently only supports 40 levels of elevation from my testing (note the visual artefacts and terraform error message in the screenshot bellow.)

my original implementation limited it to the 40 levels for that exact reason - the game doesn't let you build any higher or even lower the land there. that should actually be changed IMO and the land should be allowed to be lowered at any height > 0, and similarly raised when its any height < maxHeight

@ZehMatt
Copy link
Copy Markdown
Contributor Author

ZehMatt commented Dec 25, 2025

The gameplay currently only supports 40 levels of elevation from my testing (note the visual artefacts and terraform error message in the screenshot bellow.)

my original implementation limited it to the 40 levels for that exact reason - the game doesn't let you build any higher or even lower the land there. that should actually be changed IMO and the land should be allowed to be lowered at any height > 0, and similarly raised when its any height < maxHeight

Adjusted with commit 07cca78

@LeftofZen LeftofZen added enhancement-minor Changing an existing feature slightly changelog Requires a changelog entry labels Dec 25, 2025
Copy link
Copy Markdown
Contributor

@LeftofZen LeftofZen left a comment

Choose a reason for hiding this comment

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

needs changelog but otherwise looks good to me

@AaronVanGeffen AaronVanGeffen added this to the v25.12+ milestone Dec 25, 2025
@ZehMatt ZehMatt merged commit b4c95c1 into OpenLoco:master Dec 25, 2025
14 checks passed
@ZehMatt ZehMatt deleted the heightmap-loading branch December 25, 2025 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog Requires a changelog entry enhancement-minor Changing an existing feature slightly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants