PathFinding.js | A comprehensive path-finding library for grid based games | Learning library

 by   qiao JavaScript Version: 0.4.17 License: No License

kandi X-RAY | PathFinding.js Summary

kandi X-RAY | PathFinding.js Summary

PathFinding.js is a JavaScript library typically used in Tutorial, Learning, Example Codes applications. PathFinding.js has no bugs, it has no vulnerabilities and it has medium support. You can install using 'npm i ric-pathfind' or download it from GitHub, npm.

The aim of this project is to provide a path-finding library that can be easily incorporated into web games. It may run on Node.js or the browser. It comes along with an [online demo] to show how the algorithms execute. (The pathfinding speed is slowed down in the demo). Note that this project only provides path-finding algorithms for 2D space. If you need to work in a 3D environment, then you may use [@schteppe] [fork] There is new documentation being written for PathFinding.js. You can read it [here] Note that this is in very early stages and far from complete so keep your eyes open for mistakes and don’t hesitate to open a pull request in case you find one.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              PathFinding.js has a medium active ecosystem.
              It has 8014 star(s) with 1305 fork(s). There are 251 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 78 open issues and 62 have been closed. On average issues are closed in 177 days. There are 23 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of PathFinding.js is 0.4.17

            kandi-Quality Quality

              PathFinding.js has 0 bugs and 0 code smells.

            kandi-Security Security

              PathFinding.js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              PathFinding.js code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              PathFinding.js does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              PathFinding.js releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions are not available. Examples and code snippets are available.
              PathFinding.js saves you 316 person hours of effort in developing the same functionality from scratch.
              It has 760 lines of code, 0 functions and 53 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PathFinding.js
            Get all kandi verified functions for this library.

            PathFinding.js Key Features

            No Key Features are available at this moment for PathFinding.js.

            PathFinding.js Examples and Code Snippets

            No Code Snippets are available at this moment for PathFinding.js.

            Community Discussions

            QUESTION

            why does my a star algorithm not work in javascript?
            Asked 2021-Apr-15 at 21:40
            function algorithm(){
            if(startPoint === true && endPoint === true){
            //add the heuristic distance to the start position from the final position
            startPosition.h = distance([startPosition.x, startPosition.y]);
            
            let openList = []
            
            openList.push(startPosition)
            let closedList = []
              while (openList.length > 0){
                //print(openList)
                lowPos = 0;
                for(let i = 0; i < openList.length; i++){
                  if(openList[i].f < openList[lowPos].f){
                    lowPos = i;
                  }
                }
                let currentPosition = openList[lowPos];
                //currentPosition.check()
                //if the currentPosition is the endPosition, retrace steps and find the path, then return this path
                if(currentPosition === endPosition){
                  let curr = currentPosition;
                  let ret = [];
                  while(curr.parent != null){
                    curr.path()
                    ret.push(curr);
                    curr = curr.parent;
                  }
                  endPosition.end()
                  return ret.reverse();
                }
                openList.splice(lowPos, 1);
                closedList.push(currentPosition);
                let neighbours = neighbors(currentPosition);
                for(let i = 0; i < neighbours.length; i++){
                  let neighbour = neighbours[i];
                  if(closedList.includes(neighbour) || neighbour.colour == "black"){
                    continue;
                  }
                  neighbour.check()
                  let gScore = currentPosition.g + 1;
                  let gScoreBest = false;
                  if(openList.includes(neighbour) == false){
                    gScoreBest = true;
                    neighbour.h = distance([neighbour.x, neighbour.y]);
                    openList.push(neighbour);
                  }
                  else if(gScore < neighbour.g){
                    gScoreBest = true;
                  }
                  if(gScoreBest == true){
                    neighbour.parent = currentPosition;
                    neighbour.g = gScore;
                    neighbour.f = neighbour.g + neighbour.h;
                  }
                }
              }
            }
             //meaning that either the path is not possible or the final node/initial node 
             has not yet been placed.
             return [];
            }
            
            ...

            ANSWER

            Answered 2021-Apr-13 at 12:34

            It looks like you are not checking the diagonals. It is not a mistake. You are doing great.

            Source https://stackoverflow.com/questions/67060406

            QUESTION

            Uncaught TypeError: current.distance is not a function
            Asked 2020-Sep-26 at 21:15

            I'm developing a little game of nothing at all more commonly called "Pathfinding"; and I am crashing on a small error that I have never encountered (I am young dev);

            I have searched everywhere but I do not understand why this error appears.

            I am experiencing this error:

            Uncaught TypeError: current.distance is not a function at search_min_distance (pathfinding.js:127) at game (pathfinding.js:151) at HTMLDocument. (pathfinding.js:173)

            ...

            ANSWER

            Answered 2020-Sep-26 at 19:44

            Bind distance function to this inside constructor

            Source https://stackoverflow.com/questions/64081781

            QUESTION

            pathFinding.js library - only first path is correct
            Asked 2019-Mar-23 at 21:22

            I'm using PathFinding.js package. My code is:

            ...

            ANSWER

            Answered 2019-Mar-23 at 21:22

            I didn't noticed this sentence in docs:

            Be aware that grid will be modified in each path-finding, and will not be usable afterwards. If you want to use a single grid multiple times, create a clone for it before calling findPath.

            So I have to create grid clone. Later I'll use finder in loop so within it I need to reassign grid clone each time in loop:

            Source https://stackoverflow.com/questions/55307800

            QUESTION

            Combing "click" and "hover" permanently?
            Asked 2018-May-21 at 10:12

            I want to have the click and drag functionality that Raphael.js provides, an example here: https://qiao.github.io/PathFinding.js/visual/.

            The way you add and remove obstacles is great, it's essentially combining mousedown event and hover. But how on earth is that done? Any help please?

            The closest I have is: https://codepen.io/ProgrammingKea/pen/ZowWJx

            The salient bit is

            ...

            ANSWER

            Answered 2018-May-20 at 13:06

            You can use something like:

            Source https://stackoverflow.com/questions/50435119

            QUESTION

            Pathfinding.js in PlayCanvas
            Asked 2017-Apr-13 at 01:00

            I am making a space game using Playcanvas. I want to add some AI to ships that fly around and shoot. I don't have any idea of how to impliment Pathfinding.js on a 3D space, let alone, using the PlayCanvas Script API as well. Does anyone know how to: - Implement Pathfinding.js in a 3D Space - Implement Pathfinding.js into a 3D PlayCanvas World - Impliment Pathfinding.js into a 3D Object, inside a 3D PlayCanvas World - Add basic tasks such as follow, attack, run away using Pathfinding.js

            I am kind of a noob at Pathfinding.js, even using 2D, so please be exact, if you want to answer.

            Thanks to all of you guys who work hard to help noobs like me!

            Thanks much, Noah

            ...

            ANSWER

            Answered 2017-Apr-13 at 01:00

            Pathfinding.js provides functionality for 2D pathfinding. Note that a fork of Pathfinding.js exists for 3D environments.

            Some PlayCanvas projects that use the 2D version of Pathfinding.js do exist. Namely:

            Note that both of these projects are based on PlayCanvas' previous scripting system. New projects in PlayCanvas default to a newer (better) scripting system, but generally, the code will be very similar.

            Source https://stackoverflow.com/questions/43234906

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install PathFinding.js

            You can install using 'npm i ric-pathfind' or download it from GitHub, npm.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/qiao/PathFinding.js.git

          • CLI

            gh repo clone qiao/PathFinding.js

          • sshUrl

            git@github.com:qiao/PathFinding.js.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link