Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Height Map Landscapes have Two Edges marked as Cliffs #2376

Open
glenjimen opened this issue Mar 31, 2024 · 7 comments
Open

Height Map Landscapes have Two Edges marked as Cliffs #2376

glenjimen opened this issue Mar 31, 2024 · 7 comments

Comments

@glenjimen
Copy link

Version information:
Platform: Win10
Version: 24.03
Commit : f0863a0

Describe the bug
When you load a grey scale height map, OpenLoco sets two edges of the entire map as Cliffs. Then when you apply textures to the map's topography ( such as Brown Rock -> Around Cliffs ) the textures are incorrectly applied to those two edges. The Original & Simplex generators do not have this problem. Whatever texture is listed last will be applied to these two edges, Sand is last alphabetically so it overwrites any other texture applied as well. The textures are also correctly being applied to actual cliffs throughout the map.

To Reproduce
Steps to reproduce the behaviour:
Load a height map .png image using the landscape generation tools & set a texture to 'Around Cliffs'. See that two map edges have a 6-tile wide strip of land entirely set to one texture.

Expected behaviour
The selected texture only is applied to cliffs throughout the landscape.

heightmap one cliff map edge
heightmap two cliff map edges

@LeftofZen LeftofZen added the investigate Not sure what the problem is yet label Mar 31, 2024
@LeftofZen
Copy link
Contributor

LeftofZen commented Mar 31, 2024

hey Glen, can you send me the exact PNG you used for this, just so I can test it as you have it

edit: nevermind, I've managed to repro it with your land gen settings

@LeftofZen
Copy link
Contributor

LeftofZen commented Mar 31, 2024

Whatever texture is listed last will be applied to these two edges

Actually, it is the 'first' terrain type here, Brown Rock, but the Around Cliffs generator that is the real issue - this is the very last generator that is run in the code, and seems to be overwriting the terrain with whatever land type you've set for it. Unfortunately this generator is not yet reverse-engineered so I cannot examine exactly what and why this is happening, and why the game things these areas are "around cliffs"

@LeftofZen LeftofZen added the requires reverse engineering This task requires reverse-engineering work label Mar 31, 2024
@glenjimen
Copy link
Author

I've attached the png in case you'd still like it.
hightmap FtBragg

Actually, it is the 'first' terrain type here, ...

I didn't explain that part quite right, if you have multiple terrain types set to 'around cliffs' then only the last alphabetically will be applied. I think this is the expected behavior, actually.
heightmap around cliffs multiple
You can see multiple terrain types set to around cliffs, but only sand is applied to the edges and to actual cliffs throughout the map.
Anyway, that's not really a problem in need of a solution.

Also, with the new paint terrain tools you've added, it's easy enough to go thru and fix up those two edges :-)

@glenjimen
Copy link
Author

glenjimen commented Apr 3, 2024

FYI, more details. The terrain type stops getting applied to an edge if the land reaches a height of zero.

cliff edge coloring underwater

cliff edge coloring height zero

@LeftofZen
Copy link
Contributor

LeftofZen commented Apr 3, 2024

We've fixed this in an experimental branch; Aaron reverse-engineered the generateTerrainAroundCliffs method just for this, and in that method the cliff detection code runs on all tiles of the map. Bringing in that range 1 tile from the edge of the map means the edge-of-map 'cliff' will no longer be detected as a cliff, fixing the problem. You can also solve this already by just not using the "around cliffs" terrain colouring.

@LeftofZen LeftofZen added original bug and removed investigate Not sure what the problem is yet labels Apr 3, 2024
@glenjimen
Copy link
Author

As of release v24.04, the cliff coloring is halfway solved :-)
cliff edge single

Now only one edge is being colored as a cliff. Same settings as before. Here is the heightmap I used, in case it's helpful. I was able to reproduce this reliably with multiple different heightmaps.
jamestown

It's bizarre that your applied solution only reduced the number of edges effected. Still, pretty easy to go in and manually clean up that edge, so not a huge high priority thing.

@LeftofZen
Copy link
Contributor

LeftofZen commented Apr 7, 2024

Ah, I didn't actually put the fix into this release! I totally forgot about it, and it required #2383 which was only merged 12 hours ago, just before I went to bed and as the other guys tagged the release. I will get this in for next release for sure, though that may be while away.

Interesting that the behaviour still changed though!

@LeftofZen LeftofZen removed the requires reverse engineering This task requires reverse-engineering work label Apr 7, 2024
@LeftofZen LeftofZen added this to the v24.04+ milestone Apr 7, 2024
@AaronVanGeffen AaronVanGeffen removed this from the v24.04+ milestone Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants