Click the Stage to select the track. Click the red ball to start the search. NOTE: It's advised to use Turbo Mode for a quicker presentation! (i.e: Press Shift + Click the Green Flag or See Inside, then in the header menu, press Edit > Turn on Turbo Mode) -- Instructions --------------------------------------- Hello there! This project is the 2nd version of my Raceline Finder projects. TurboWarp: https://turbowarp.org/418920660?turbo 1st version: https://scratch.mit.edu/projects/167912019 2D Race Path Finder (v2.0) A robust, scratch-built algorithm designed to compute optimal racing lines for 2D tracks, tailored for future Scratch racing projects. Key Features & Architecture of Version 2.0 Physics-Aware Cost Evaluation: Evaluates paths based on true frame-time costs (accounting for speed, acceleration, and turning) rather than minimizing raw segment counts, including explicit collision detection between two-point segments. Two-Pass BFS Architecture: A grid-based dual Breadth-First Search—the first pass maps track orientation, while the second computes the optimal raceline using Vector Racer rules and a 12% delay pruning threshold (configurable / independent of fixed start/finish color points). Custom Scratch List Data Architecture: Overcame Scratch's 200,000 list item limit to store multiple incoming vectors per endpoint vertex while the best path remained unknown. Developed a custom packing method to distribute multiple vertex values per list item, utilizing precise math and string joining for instant node retrieval (cost and startpoint) at granular grid resolutions. I still pretend to explain the code, there is some math related to the heuristic function and data structure that is unclear and illegible, therefore I want to explain it, maybe leaving some comments in the code! Feel free to use the script in your projects, and to See Inside and draw any circuit you like, in the Stage section! Just make sure you use the same pattern (that can be found in the other circuits) to separate the starting position (blue dot) from the finish position (orange dot), with the lighter grey separator, just reminding that you must use the same colors. Also, feel free to comment and to suggest any improvements you would like to see in the project, I hope you like it! PS: If you're interested in this kind of projects, you might want to checkout matfin's contest as well: https://scratch.mit.edu/projects/475045 Also, feel free to check out my entry for that contest: