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

4.0 NavigationServer 2D issues. #43704

Closed
olifly opened this issue Nov 20, 2020 · 3 comments
Closed

4.0 NavigationServer 2D issues. #43704

olifly opened this issue Nov 20, 2020 · 3 comments

Comments

@olifly
Copy link
Contributor

olifly commented Nov 20, 2020

Godot version: v4.0.dev.custom_build.6a683f801

OS/device including version: Mac Pro 2018/Big Sur (11.0.1)

Issue description: NavigationServer2D seems to have some issues with the following items from my testing and assumptions on how it should work. My assumptions could, however, be totally wrong 😁

  1. TileMaps: Tiles with no navigation polygons seem to have "seams" that allow the pathfinding to plot a path along their borders, at least if they're a part of a tileset that has other tiles that are completely covered by a navigation polygon. This is not a problem in 3.2 stable.

  2. NavigationServer2D/Map doesn't seem to combine overlapping regions into a single navigation polygon. It is my understanding from reading blogs/proposals about the new navigation system that that was one of the main feature of the new system 😄

  3. NavigationServer2D seems to generate paths between two regions with a path that goes outside these regions. I would expect this not to be the desired behaviour.

  4. NavigationServer2D sometimes generates a visible inefficient path on what seems to be really straightforward path in Tilemaps. This could be related to how TileMaps seem to generate its navigation polygon

Steps to reproduce:
I attached the same project for 3.2 and 4 with this ticket. It demonstrates what I assume are issues. It's a simple 2d scene with a navigation2d node. The node contains:

  • Two identical tilemaps that have navigation polygons in their tileset. Overlapping the tilemaps is a navigation polygon. The tileset used has four tiles, two with no navigation polygons and two that are completely covered by a navigation polygon,.
  • Two identical navigation polygons. Overlapping them both is a navigation polygon.
  • The good old godot sprite!

Right mouse button allows you to move the godot sprite to the current mouse position.
Left mouse button uses get_simple_path to draw a line from the current sprite position to the current mouse position

  1. Positioning the sprite on one side of the white no navigation tile cluster on one of the upper maps and using the left mouse button to plot a path to the other side of the white cluster will create a path that travels along the seams of the white tiles in the 4.0 project. This does not happen in the 3.2 version.
  2. You cannot position the sprite on one of the "island" regions and plot a path to the other region that is/should be conntected to it by an overlapping navigationregion/polygon. This is expected not to work in 3.2 but I thought is should work in 4.0
  3. Plotting a path between the two lower "island" regions made of a single navigationpolygon plots a path that goes straight through the non navigation space between them. Happens in 3.2 and 4.0
  4. Plotting simple paths on the tilemap islands will sometimes generate a wonky path that will snap back into a "straight" path by left clicking a few pixels around the position that gave the wonky path.

Maybe I'm not understanding the new Navigation system, or setting things up wrong, or have the wrong assumptions, but after messing around with this while playing around with a prototype for a game this seems like genuine bugs to me.

Best Regards,

  • Óli Fly

NavigationTest_3_2.zip
NavigationTest_4.zip

@groud
Copy link
Member

groud commented Mar 9, 2021

So I made some investigations.

TileMaps: Tiles with no navigation polygons seem to have "seams" that allow the pathfinding to plot a path along their borders, at least if they're a part of a tileset that has other tiles that are completely covered by a navigation polygon. This is not a problem in 3.2 stable.

This will likely be solved by #45278, as I am rewriting the whole system and testing it.

You cannot position the sprite on one of the "island" regions and plot a path to the other region that is/should be conntected to it by an overlapping navigationregion/polygon. This is expected not to work in 3.2 but I thought is should work in 4.0

Nope, this isn't supposed to work in fact. You need two edges to be similar for two regions to be considered as connected.
I have clarified this into this PR: #46786.

Plotting a path between the two lower "island" regions made of a single navigationpolygon plots a path that goes straight through the non navigation space between them. Happens in 3.2 and 4.0

This is expected in your example project. In fact your two polygons have a their edges connected. They thus create, between the edges, a path. You would have to modify the Navigation map's edge_connection_margin for the edges not to be connected together. By default this is likely set to 100px, so the edges get connected.

Edit: I'd like to implement a way to view the connected edges in the editor.

Plotting simple paths on the tilemap islands will sometimes generate a wonky path that will snap back into a "straight" path by left clicking a few pixels around the position that gave the wonky path.

Same as the second point. I'll see what's happening.

@DrRuhe
Copy link

DrRuhe commented May 13, 2021

This sounds similar to these (rather dated) issues: #30883 and #41349. It seems to be an issue with the NavigationPolygon not getting initialized the way they are defined in the tileset. Will this be fixed in 4.0?

@groud groud added this to the 4.0 milestone May 24, 2021
@smix8
Copy link
Contributor

smix8 commented May 23, 2022

So it tested the project in 4.0 after fixing it due to being a little outdated by now.

groud explained everything that was setup wrong already like the too much overlapping navigationpolygons.
The edge merge problems were fixed with #47024 and the tileset with #48535 in Godot 4.0.
I could not test the tileset cause the ui is currently broken in Godot 4.0 but the .tres file looked ok.

I could not find any bug or issue with the navigationpath or the navigationpolygon.

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

6 participants