Giter Club home page Giter Club logo

Comments (8)

mtlca401 avatar mtlca401 commented on May 21, 2024

This image may help understand how the character walks slightly to the side of the path.

screenshot

This is an example of the findpath returning a path, but it seems like it returns an invalid path, or maybe my grid is wrong. The 1s are the valid path and the character walks along the 1s up until the path in the screenshot.

from easystarjs.

prettymuchbryce avatar prettymuchbryce commented on May 21, 2024

Hello. Could you send me a link to your code so I can take a look ? You can email me at [email protected]

from easystarjs.

mtlca401 avatar mtlca401 commented on May 21, 2024

Absolutely. I have sent you my code.

from easystarjs.

prettymuchbryce avatar prettymuchbryce commented on May 21, 2024

Thanks. So just to clarify you have two separate issues.

First pathfinding from 4,7 to 43,39 yields no path, and no error. Basically
the callback is never fired ?

Second you're finding 4,7 to 40,39 yields a path but appears not to be the
most efficient one ?

Am I correct in this ?

-Bryce

On Fri, Nov 14, 2014 at 8:46 PM, mtlca401 [email protected] wrote:

Absolutely. I have sent you my code.


Reply to this email directly or view it on GitHub
#22 (comment)
.

from easystarjs.

mtlca401 avatar mtlca401 commented on May 21, 2024

The first issue (4,7 to 43,39) just returns null. The second issue (4,7 to 40,39) returns a path but does not seem to be on a valid path. The second issue may be due to the MovePath function calculation. So, yes you are correct.

from easystarjs.

prettymuchbryce avatar prettymuchbryce commented on May 21, 2024

Hello. It appears the library returns null because there is infact no path to your destination from 4,7 to 43,39. I have attached a debug image to show you what your tilemap looks like in 2D. Black squares are walkable, red squares are not.

screen shot 2014-11-16 at 10 23 38 am

In regards to your second issue with 4,7 to 40,39, A* does not always return the most efficient path. Only the least expensive. I intend to add a method in the next version which will force an exhaustive search to find the most efficient path, but this could in some cases be much slower. The path you've specified doesn't look too horribly inefficient to me. Here is what it looks like on a 2D grid.

screen shot 2014-11-16 at 10 29 51 am

Hope that helps. I will close this issue now.

from easystarjs.

mtlca401 avatar mtlca401 commented on May 21, 2024

Thanks for your help. I think the issue I am having with not being able to move to 43, 39 is because I realized I have multiple path objects with the same x and y in the path array. Don't know how it happened, but the ones at the end are the ones that have multiple and are the ones that are affected.

from easystarjs.

mtlca401 avatar mtlca401 commented on May 21, 2024

My mistake. I was using parseInt which was converting 40.999999999 to 40. I changed it to Math.round which converted to 41. It is fixed. Thanks again for your help!

from easystarjs.

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.