Giter Club home page Giter Club logo

Comments (4)

theashtronaut avatar theashtronaut commented on July 16, 2024 1

So while technically a disabled/solid point is part of the point list, if the end point is disabled (or "solid" for the AStarGrid2D class) _solve returns early which means even when asked to return the partial path the path is still an empty array as no actual pathfinding was done yet. You can see this early return here

https://github.com/godotengine/godot/blob/master/core/math/a_star_grid_2d.cpp#L453

The original issue that the partial path implementation was for was for non-disabled points that are in the point list, finding a path close to those even if there are obstacles preventing a complete path. The picture from the original proposal (godotengine/godot-proposals#277) showcases that intention
image

I did not change/modify the early termination present when the destination is itself disabled, however I can see the merit in having this functionality too. The main issue is this change would, unless I dragged in the partial path option into the _solve function to modify the early termination (which could be done if desired), mean that even for users who are not desiring a partial return the extra "processing" would happen to find that partial path even though we would then discard that result and return the empty array.

This short circuit was added as part of #27506 when disabling points became an option, as it represents a much more performant way to temporarily add/remove points from pathfinding without having to actually run the more expensive add/remove point functions. I believe the specific part of having it in _solve was just for the optimization of not trying to pathfind when the destination was "invalid", though this is speculation on my part as the intention wasn't directly stated anywhere.

Curious to hear other's thoughts on it as well!

from godot.

RilicTheFox avatar RilicTheFox commented on July 16, 2024 1

I was personally caught out by this just now. The documentation of the current behaviour in the AStarGrid2D doc lead me to believe that it would find the closest non-solid tile to a solid tile. It's very understandable why this isn't the case upon reading into it, though!

That said, I do think it should be considered inside the _solve function, since it makes sense in my head for allow_partial_path to perform the way I originally thought it would. I'll work around it in the meantime!

from godot.

femiaf13 avatar femiaf13 commented on July 16, 2024

I found godotengine/godot-proposals#277 (comment) so it seems like I'm not alone with there being some confusion on how partial path is meant to work

from godot.

Calinou avatar Calinou commented on July 16, 2024

I found godotengine/godot-proposals#277 (comment) so it seems like I'm not alone with there being some confusion on how partial path is meant to work

#88047 description says:

Note: This will not return a partial path to a location not in the AStar point list, the destination point still has to be a point. This is especially helpful for games where points may become disconnected due to other points being disabled during play while still permitting a path that gets close to the destination point.

cc @theashtronaut

from godot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.