A new post in the english side of “The shaman’s lair”, after more than a year. I’ve been caged by real life problems, and the effort of writing in english was too much to me. Now that things seem to come to a more stable way it’s my intention to try again. Short posts, mainly about my works as a programmer but with focus on my side projects.
Well, the first step I’ve made has been to write a procedural generation code with the target to build random cavelike structures, and it works fine for me. I’ve called it Caves and Creatures, you could guess why 🙂
Then I began to think, when you have a maze (or something like), you need to be capable to run through it, from a start point to an end point, to find the best path between the two points.
And that’s all.
To keep trace of my progressions I’ve created a GitHub repository and a demo page. At the moment the repository is up-to-date to the last revision and the demo let you navigate through some of the pathfinding options like choosing the heuristic function and movements cost. With the intention to give the user more interaction I’ve added (to the random generated grid) a canvas where you can draw obstacles and choose start and end points.
At last, you could save the picture and use the local storage to save and restore the grid.
After reached this point, I’m coding a second version, using web workers to move a cursor in the grid. The web worker choose every turn the best path to the target and the user could draw obstacles and watch the cursor changing its mind and trying new ways.
But this version is under test and not really ready.
As always, suggestions and critics are welcome.