© Rex van der Spuy 2017

Rex van der Spuy, The Advanced Game Developer's Toolkit, 10.1007/978-1-4842-1097-0_6

6. Finding the Shortest Path

Rex van der Spuy

(1)Toronto, Ontario, Canada

There is one last major area of pathfinding we need to tackle: finding the shortest path through a maze. As it turns out, this is not just an interesting aside, but one of the most important game design skills you need to know.

All the player control systems that we’ve covered in the book so far have involved moving the player around the screen with the keyboard or the mouse. But games often employ a point-and-click control system. Point the mouse to some place on the map and click. The character will walk there and magically seem to find the shortest path to the destination ...

Get The Advanced Game Developer's Toolkit: Create Amazing Web-based Games with JavaScript and HTML5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.