Home Projects Contact Me

Pathfinding Simulator


Role: Solo Developer

Description: Open source, browser based development tool built to help me design and test my own pathfinding algorithms along side traditional algorithms, and aid in level design prototyping. The sim features customisable grid and randomly generated grid layouts that can be saved, GUI to provide visual representation of the pathfinding process and technical feedback, and simulation controls to modify the speed that the visual simulation runs.

  • Traditional Algorithms: The simulator comes with several well known pathfinding algorithms.

  • GreedyBug Pathfinding: My own algorithm that is a combination of different concepts like combining GBFS, directional raycasting, and robotic obstacle hugging. It prioritises straight line speed, falling back on walltracing only when trapped

    • Directional Raycasting (Greedy Phase): Driven by a heuristic sorted MinHeap, the algorithm casts a continuous ray along the most promising heading. The ray advances without checking neighbors until it hits an obstacle or reaches the goal.
    • Collision and History Tracking: Records obstacle collisions and logs recent travel distances. This data determines whether the algorithm should branch around the obstacle or switch to wall tracing.
    • Dynamic Blooming: Navigates corners by spawning new rays perpendicular and diagonal to the impact point. The search radius for these new rays decays exponentially based on collision count to prevent over-searching in confined spaces
    • Wall-Tracing (Bug Phase): Triggered when collision thresholds are exceeded. The algorithm hugs the obstacle's perimeter until it reaches a coordinate strictly closer to the target than its initial impact point. Upon escape, it resumes straight line raycasting
    • Post-Processing Optimisation: Applies backward line of sight checks across the raw output to eliminate unnecessary intermediate nodes, resulting in a direct vector path

  • Visualisation: The rendering engine is built on the HTML5 <canvas> API and is driven by a centralised requestAnimationFrame loop. It provides realtime, color coded feedback showing the algorithm's state: evaluated nodes, active raycasts, and the final constructed path.
    The visualisation layer is intentionally decoupled from the core algorithm logic. Algorithms return a structured data object containing the evaluated nodes and final path arrays, which the main controller then unpacks and renders sequentially based on the user's selected playback speed.

  • Savable Custom Layouts: Users can interact with the canvas to manually paint or erase walls, and drag and drop the start/target nodes. For quicker testing, a generation tool can scatter random obstacles across the grid based on a user defined density slider.
    To facilitate consistent and quicker testing environments, the simulator uses the browser's localStorage API. This allows users to save and instantly reload up to three distinct grid configurations, preserving the exact layout of walls and node positions across sessions.

  • Simulation controls: A control panel allows users to adjust the simulation's execution speed dynamically. Additional controls provide the ability to pause the simulation mid-execution or entirely reset the visual state while maintaining the current grid layout.

This is a project I expect to be ever evolving as I conceptualise and create new pathfinding algorithms or come across others that are not yet supported, and add those in. Being open source, my hopes for the future of this project is that it will evolve into a powerful and comprehensive tool that covers a wide range of algorithms and allows for user control in tweaking existing / creating new algorithms.