This is an implementation of the a-star algorithm using realistic three-dimensional pathfinding displayed with WebGL.
The A-star algorithm is a pathfinding algorithm computing the shortest path between two nodes using a specific heuristc. Focus of this project is the algorithm itself so some graphics and controls are only implemented as prototypes.
For upcoming features, todos and first runtime measurements take a look at the issues on github.
Try it out here!
- a-star path navigation considering three dimensions
- 3D graphics using WebGL and Three.js
- full customizable three-dimensional level build of cubes
- easy add and remove cubes
- impassable wall nodes
- import and export levels (as plain JSON)
- generate random levels
- flat levels with random walls
- levels with random walls and random (walkable placed) heights
- customizable height factor for avoiding heights during path finding
- realistic paths usable in computer games for example
- using all three dimensions to compute ground navigatation
- no flying paths
- no paths through ground
- fast algorithm runtime
- 12.000 traversed nodes in 30ms
- integrated runtime tests
- random tests
- specific user defined tests
- jQuery
- Three.js
Current controls (will change probably)
- level width and height definable
- generates flat level
- generates flat level with random walls (adjustable wall frequency)
- generates level with random walls and random heights
- starts edit mode
- add node: left click on any node face
- delete node: right click
- wall: ctrl + left click
- left click: define start node
- rigt click: define end node
- euclidean
- manhatten
- defines if and how heights are avoided
- show the status of all nodes at the end of the algorithm
- start/end nodes need to be defined
- start algorithm: process
- middle mouse button on node (after algorithm execution)
- clears all temporary markers and properties
- tests traversed nodes in relation to time needed (in ms)
- all result are printed to console
- for each dimension and test run:
- 50 repetions
- excluding 20 warmups
- generates level
- pathfinding between opposite corners
- for specified dimensions
- like simple test using random level
- like simple test using full random level
- tests on current build level
- uses current level
- specify test ->
- define start node
- define multiple end nodes
- run specified test ->
- test runs from start node to each end node specified
- saves current level as json file
- loads level from file (json format) and displays it in the current scene
- overrides the current level
The actual a-star algorithm. Just needs a three-dimensional array and start/end nodes as parameter. Also takes options for heuristics and movement types.
The node class including properties and the cube mesh.
The graph object for building the three-dimensional level with an array of nodes and serving control functions.
Some helper methods like additional array functions.