Pathfinding and Movement Finished

After a few days of work, I've managed to get the movement system working good. What the system does is that it takes the NavMesh, and checks the mesh against a grid. The grid cell's outside the mesh are solid, while the ones inside are not, and you can move freely inside the mesh. After that the program uses a basic A* pathfinding engine to produce the near-shortest path towards the destination. Precision of the grid, that is the edges can be changed easily, but I am keeping the cell size 16px for now, as it is somewhere between performance and quality (precision). Smaller cell size results in a more precise checking, but takes 16x more CPU power.

Here is a preview, with the grid and cells (red cells are solid, green are the walk area or the NavMesh). The white rectangle is the "player" object, and the line is the path it will take to reach the destination.
I will see to improve both the precision and the quality, while improving performance. A better A* pathfinding engine is also planned.

No comments:

Post a Comment