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

Navigation for TileMapLayer introduces hard-to-trace map synchronization error #92056

Open
MichaelMacha opened this issue May 17, 2024 · 4 comments

Comments

@MichaelMacha
Copy link
Contributor

Tested versions

v4.3.dev6.official [64520fe]

System information

KUbuntu 22.04.4 LTS

Issue description

I have a project I'm using to get accustomed to TileMapLayer, just for a week-long jam. All is functioning, but I consistently get an error related to my navigation layer in TileMapLayer, which doesn't provide a lot of help in this instance:

E 0:00:00:0965   sync: Navigation map synchronization error. Attempted to merge a navigation mesh polygon edge with another already-merged edge. This is usually caused by crossing edges, overlapping polygons, or a mismatch of the NavigationMesh / NavigationPolygon baked 'cell_size' and navigation map 'cell_size'. If you're certain none of above is the case, change 'navigation/3d/merge_rasterizer_cell_scale' to 0.001.
  <C++ Source>   modules/navigation/nav_map.cpp:974 @ sync()

I have not tinkered with cell_size, and all navigation polygon edges are generated. Moreover, this is entirely a 2D project, and following the advice of changing 'navigation/3d/merge_rasterizer_cell_scale' to 0.001 has had no effect—I still get the error.

Steps to reproduce

I'm enclosing a zip of the project which has been having this problem. Running it will trigger the issue the moment that the navigation map bakes, which is effectively immediate.

Thankfully, the build for web is running without issue; but this seems like an unreported outstanding problem.

Minimal reproduction project (MRP)

example project.zip

@MichaelMacha
Copy link
Contributor Author

OK, for whatever reason, the error seems to have disappeared; but it was most certainly happening some time ago and it seems strange to me as I don't believe that I have a single 3D node in this game. So... odd.

@smix8
Copy link
Contributor

smix8 commented May 17, 2024

The error is from the final implosion when the navigation map tried to make any sense out of the edge mess that the TileMap cells created. The error happens when more than 2 unique edges tried to occupied the same rasterization cells, so bascially polygons overlapped or had their edges way to close to each other.

A core principle of navigation meshes is that they can not overlap or cross the polygon edges, it is a logical error if they do.

The TileMap editor does giggles to verify anything and will happily allow you to make non-working navigation mesh layouts.

That the erorr did not even go away when you lowered the cell scale to its lowest value tells me that you had at least 2 polygons that covered the same surface on multiple TileMapLayers which corrupted the navigation mesh logic.

@MichaelMacha
Copy link
Contributor Author

Thank you for your thorough explanation @smix8! Is there something I should do, procedurally, to prevent this? I'm still not sure where I could adjust my code to prevent this error in the future.

@smix8
Copy link
Contributor

smix8 commented May 22, 2024

You need to make sure that 2D navigation mesh surface does not overlap on the same navigation map.

The TileMap does not check for these things and will happily allow cell layouts and offsets that create overlap.

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