Path Finder - WASM module for path finding

Github repo with sources

It contains implementation of path finding algorithm on Python and on AssemblyScript. Algorithm is based on JavaScript addon for Three.JS Three Pathfinding All main ideas are the same, but there are some difference in details.


  1. Small size. Compiled WASM module is only 46 kb. As other WASM module, It also requires loader. Default AssemblyScript loader is 18 kb.
  2. Open source. For understanding algorithm it will be better to study Python implementation, because it’s more structural.


  1. Does not generate navigation mesh. This mesh should be prepared in any other external application. Module accept only polygonal description of the navigation mesh: vertex coordinates and vertex indexes of polygon corners.
  2. Works only with static navigation mesh. No dynamic obstacles, agent avoidance or something similar.

Short tutorial, which demonstrate, how to use the module is here

Example application is here


Hi @Shekn and welcome!

That looks super nice, and it performs quite well. Happy to see a Python to WebAssembly build running so good, many thanks for sharing.

Very useful! Thank you!

Ohh I’ve been looking for something like this for a while! thanks for sharing!!

I am trying to replicate the proyect with a simple 2 tris mesh and I just can’t make it :S
How do I get the right data structure for a custom mesh? I mean the .txt file.


EDIT: Oh wait I got it working! I wasn’t assigning the vertex index correctly in the polys array

Update of the module. Source files and descriptions are in the repository:
Also the repository contains builded wasm-file.

What’s new:

  1. Port RVO2 collision avoidance algorithm into AssemblyScript.
  2. Integrate this algorithm with old path finding algorithm in the navigation mesh. The result is complex PathFinder object, which can simulate agent movements to destination points in navigation mesh.
  3. Example application, which demonstrate some basic functionality of the module. This is the link to the project: PlayCanvas 3D HTML5 Game Engine

I have a problem. Can you help me explain,How do I get the right data structure for a custom mesh? I mean the .txt file. “level_03_data.txt”

sorry,i don’t know the right data structure for a custom mesh. can you help me?

how can i make a txt like it?
i use it to make navigation ,but i don’t know how to make a txt likt it. i convert obj to js,but it only have vertices and polygons , i don’t know how to get sizes. i need help.

You can store mesh data in any format you like. In examples I store it in simple txt-files, but the module does not actually use it. At the very beginning I parse these text files and extract three arrays. And only then use these arrays inside the module.

To the module you should pass three array. The first array should contains coordinates of the mesh vertices. First three values - coordinates of the first vertex, next three values - of the second and so on. So, the first array has the length equal to 3 x [number of vertices]. This is simple float array.
The second array should contains vertex indices of mesh polygons. It start from values for the first polygon, then for the second and so on. This array is an integer array. The length of this array is equal to the sum of all polygon sizes.
Finally, the third array should contains actual sizes of polygons. The first value is size of the first polygon (3 for triangle polygon, 4 for square polygon and so on), the second value - for the second polygon and so on. The third array is also integer array.

Used text format for example files is simple. The file contains only three lines. The first line contains values of the first array (divided by spaces). The second line contains values of the second array, and third line - third array.

1 Like