I wrote a little maze navigation simulator in JavaScript (I really like's JS advantages ) in order to present a working demo for path finding optimizations. I got it to a level it's working "OK" and has some functional features. I'm still trying to add more features and organize it. It's generally a few pieces of code I slapped together and you may find it useful.
You can find the latest version here previous one was ~50:
this is on my wife's payed site (reliable):
http://niseg.moshela.com/test_maze.htmlI got the latest version here too(old free site I used):
http://niseg.50webs.com/test_maze.htmlThis one is back up and also has older versions (test_maze1.html through test_maze37.html ):
http://niseg.0adz.com/test_maze.html if you are adventurous you should try the 128X128 version the A* optimization made it run in acceptable time but it doesn't seem to work on my cellphone/android pda:
http://niseg.moshela.com/test_maze128.htmlDemos:
-
different heuristic different path -when using a* you'll notice that heuristic that overestimate the distance fail to find the shortest path. it also has a simple waypoint demo and 4~ room traversal path.
-
big maze - A* likes getting lost here. You can see how waypoint based path caching and room pathing is generally better and the smoothing algorithm also does a decent job here. You'll also notice the problem with waypoint based room and bad selection (working on it).
Current features:UI(frontend)- build a maze 32X32 by toggling points or lines if you click edges
-CSS support - I can added graphic an option to use Mayday's tile-set TXT by refresh button.
- brush selection using select box or buttons
- basic line/rectangle drawing drawing. violet start point default is filled rectangle can be toggled using buttons.
- drawing traffic input -toggle checkbox to see them.
Load/Save- quick link generation with controllable length. Changed from v01 to v02 to B64 saves start,end and waypoints (max is 8 supports 15).
-quick link load is backward compatible (hex str,v01 and v02).
-quick link now has 2 more formats (well actually 3) v03 is a run-length encoded v02 maze data and v05 is a move to front encoded as 2,6 (3bit or 7bit) of the entire parameter. when a link is added it generates v02 and pick the shorter between v03 and v05
- forum output generation with controllable size - includes all the text in the table and paths
Pathfinding- A* navigation with feedback on how many nodes were visited (shows complexity). I modified 46 dogs' implementation a
tad lot.
Farther optimized! The complexity of the original algorithm got aggressively reduced by using an O(1) lookup on closed and open queues (replace O(N) search) and all nodes are inserted in order to the open list (O(log N) insert, O(1) pop, O(1) search for minimum) . This made it run 1000 times faster on huge mazes.
- A* navigation with Traffic zones
- A* navigation on an edge map with correct selection and correct heuristics but it still looks at "center points" that is not always center atm.
- A* in 2 room navigation - a node blocked if it's not in destination or source room (better than a range limit)
- modified heuristic currently defaults to sqrt(dx
2+dy
2),current options are (active button yellow): (dx
2+dy
2), sqrt(dx
2+dy
2),Manhattan , Max(dx,dy), Max(dx,dy) + Min(dx,dy)/4 , los penalty vector.
- feedback about path length ( I think I added this to both pathing algorithm)
-Waypoint navigation using a waypoint to waypoint full cache with feedback on number of nodes visited (path-finding,adding waypoint,updating cache). Full cache update will display it's size in steps (currently saved in "4 byte format" can be reduced to 4bit or less).
- waypoint navigation with path smoothing using vectors . I used info from this
page. changed my line drawing to return a vector on action 0. Then I used the line drawer to draw lines and validated the return value. After debugging it works great and the complexity isn't bad .
- path smoother chops off loops before starting (sort,find equal idx, first loop idx 0, last linear searched from end)
- waypoint-room path-finding (checkbox enabled to see "rooms") - this uses an idea I
outlined in path finding thread it's like waypoint pathfinding but the cached paths are only from one room to its neighbor. The implementation is preliminary - need some more work. I got problem with "room" selection process (same as waypoint) which cause trouble with arbitrarily placed nodes(might use length limited A*). Current implementation selects rooms mathematically (e.g. x*number_rooms/width).
-room based navigation path currently working on some level it's called "advanced WP rooms". It uses path chaching but picks rooms by using bitmap
- "advanced rooms no cache" is a non path caching algorithm that looks are the first access point of to the destination room (saved in room) .The output shows the subpath using "O" instead of a *.
Backend- maze is an array of column format is [ y ][ x ] (a_star uses x,y maze so i swap the output values)
- all points are 2d arrays of format [x,y](converted from y<<16|x) - can be later changed to 3d format if needed
- file list : test_maze.html , testmaze.js ,testmaze.css , a_star.js.
features I'm working on:- room based navigation without using path caching but it uses saved access points to the next room . It uses A* to navigate between the access points which is low complexity.
-added BFSCollider function that outputs bellow the maze - it show "rooms" it finds and a clear button to remove it. It has a highlight button (debug feature) that let you kinda see how the the way the rooms are defined (yellow rectangle with cyan corners but the cyan corners can be overwriten)
-trying to figure how to shorten the qlink more so I can stick traffic zones in there.
future plans(somewhat prioritized) :- improve refresh of drawing so it won't be so heavy.
- path validation and path replanning for waypoints along
- better waypoint selection - current method uses heuristics which can fool the waypoint path-finder much like it fools A*
- improving path smoothing - currently trying to find ways to optimize path smoother and understand some mixed results.
- scrolling the maze - ui change to let users change mazes.
- fix waypoint removal bug.
- add other path finding algorithms like D* lite /LPA*
- forum input maze
- maze presistance "code" shortening
history: You should check around page
12 of path finding thread in suggestion forum for more info about my plans and the little history of this little program.
I'm saving previous versions of my implementation by renaming them to test_maze#.html . I now have 1 through 11 or 12 on my site if you want to see what i did in older versions.
I'll be happy to get any type feedback. I'll also be happy to get suggestions and feature requests especially on UI,input and output features. Any new ideas related to path finding should go in the path finding thread

(we may want to start a wiki page to outline our progress) .