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

Remove experimental constrain_avoidance from NavigationRegion2D #90747

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

smix8
Copy link
Contributor

@smix8 smix8 commented Apr 16, 2024

Removes experimental constrain_avoidance feature from NavigationRegion2D.

This was added in Godot 4.1 with the avoidance rework in an attempt to automate the placement of static avoidance obstacles around NavigationRegion2D.

This feature already had a strong experimental tag so removing it should not come unexpected for users. It clearly told everyone to not use or rely on it for a real project because a lot of its issues where already known back then.

experimental="When enabled, agents are known to get stuck on the navigation polygon corners and edges, especially at a high frame rate. Not recommended for use in production at this stage."

The reason why it was even added is, at that time it looked like some of the issues could be reasonably solved in the future and that the general userbase could manage the limitations better. Both did not happen.

There are multiple reasons why this experimental feature failed and / or why it should be removed.

  • Main reason, the feature never worked, it gets agents stuck on the navmesh edges easily.
    Attempting to mitigate this would require adding edge margins. Basically to implement a custom version of navmesh baking just for this feature, not at all worth the effort.

  • Main reason, the feature never worked, navmesh outline order is just too brittle and unreliable.
    Because the avoidance pushback was based on the (hand-drawn) navmesh outlines a single wrong interpreted outline caused the entire user world to break. Happened way to often on more complex navmeshes.

  • Even if the feature worked, it could only work with a single region.
    Having more than just a single region is common for nearly all projects but the constrain made it impossible for agents to cross into other regions. So basically any more evolved project had to auto-stop using this feature and / or start to juggle avoidance layers which was horrendous.

  • Even if the feature worked, it had unscaleable bad performance.
    The typical 2D navmesh in user projects is badly optimized and the feature added an obstacle point for every single navmesh vertex. This was just too much, a static avoidance obstacle edge is far more costly than a navmesh edge. Attempting to mitigate this would require adding an edge simplification just for this feature, again, not at all worth the effort.

  • Even if the feature worked, it only existed in 2D and only on a node with no actual server support.
    It also created the wrong user expectations that navmesh and avoidance are connected and violated the separation of concerns between them.

  • Even if the feature worked, it makes the required refactors for the navmap and the avoidance spaces extra difficult because a region is stuck with both.

  • Even if the feature worked, it adds a lot of boilerplate code and properties on the NavigationRegion2D for a niche feature.

Removes experimental constrain_avoidance feature from NavigationRegion2D.
@smix8 smix8 force-pushed the remove_constrain_avoidance branch from 96673ad to df66a55 Compare April 16, 2024 16:03
@smix8 smix8 requested review from a team as code owners April 16, 2024 16:03
@akien-mga akien-mga merged commit ce07448 into godotengine:master Apr 17, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@smix8 smix8 deleted the remove_constrain_avoidance branch April 17, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants