Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    A

    Amit Patel

    theory.stanford.edu/~amitp · Personal blog · on HN since 2007

    Amit Patel, a game programmer, hosts a long-running Stanford-hosted site of game programming pages, especially on A* pathfinding and heuristics.

    Visit blogHN submissions
    ProgrammingGamesMath
    What HN says

    HN commenters recommend his A* pages as a great introduction and the standard reference for game pathfinding.

    Stats for nerds
    28HN people shared it
    13linked in comments
    710story points
    May 2025last shared
    2007people per year2025

    Top posts on HN

    1. 1
      Introduction to A* (1997)
      9 people · 637 points · first shared 2011 · 56 comments on HN
    2. 2
      Daylight Savings Time (2020)
      1 person · 36 points · first shared 2021 · 72 comments on HN
    3. 3
      Pathfinding with A*
      9 people · 20 points · first shared 2008 · 1 comments on HN
    4. 4
      Heuristics (An essay on changing the heuristic function of the A* algorithm)
      3 people · 10 points · first shared 2009 · 1 comments on HN
    5. 5
      Sorting in C++ vs. C
      3 people · 3 points · first shared 2007 · 1 comments on HN
    6. 6
      The A* algorithm – Implementation notes
      2 people · 3 points · first shared 2014 · Discussion on HN
    7. 7
      Interactive js diagram: Car Blind Spots
      1 person · 1 points · first shared 2013 · Discussion on HN
    8. 8
      Proxy
      1 person · first shared 2023
    9. 9
      Variations
      1 person · first shared 2022
    10. 10
      Test
      1 person · first shared 2008

    What HN people wrote when they linked it

    • jsjenkins168Sep 2007

      Here are some benchmarks on sorting:

      http://theory.stanford.edu/~amitp/rants/c++-vs-c/

      Besides that, custom C vs. STL comparisons would need to be done case-by-case. Admittedly, an all-encompassing statement "STL is always faster than C" is unreasonable. It depends entirely on the situation and what you are trying to do. I'm simply saying that it is very difficult and probably more time consuming than it is worth (for MOST cases) to try to beat STL in C++. When I used to do lots of graphics programming I tried (mostly out of curiosity), but I always ended up just using STL.

      But maybe your experiences are different? Do you write your own arrays, hash maps, and sorting algorithms each time you use them? There are times when code reuse is A Good Thing. Like when the difference is negligible and it enables you to dedicate time to more valuable things, like building product features that users want. When it comes down to it, everything is always a matter of time.

      Please explain what you mean when you say "C++ doesnt enable code reuse, it merely encourages it". Just curious..

    • pton_xdMay 2025

      Nice! There's a few techniques that I remember when doing something similar. Subgoal graphs [0], using precalculated landmarks in the heuristic [1], and theta* [2] may be worth looking into. A bunch of other variations and techniques are on the Red Blob Games site [3]. Also the priority queue implementation you use can really impact performance if it's not done well.

      [0] https://www.gameaipro.com/GameAIPro2/GameAIPro2_Chapter15_Subgoal_Graphs_for_Fast_Optimal_Pathfinding.pdf

      [1] https://www.redblobgames.com/pathfinding/heuristics/differential.html

      [2] https://web.archive.org/web/20190717211246/http://aigamedev.com/open/tutorials/theta-star-any-angle-paths/

      [3] https://theory.stanford.edu/~amitp/GameProgramming/

    • JakobMar 2018

      Dijkstra’s algorithm is not what you would use for efficient path finding. See http://theory.stanford.edu/~amitp/GameProgramming/#pathfinding for details.

      I think the biggest problem is collisions with other moving objects. I haven’t seen any library which solves this in a general manner for all kinds of games since they have different strategies. In Starcraft the most efficient way for a group of units to pass a bridge might not be the best one (e.g. sending fast and weak units first without any defense).

      Nowadays I don’t know of any bigger game with particular bad pathfinding, though.

    • MintPawJan 2023

      I feel like making this multithreaded is a bit overkill. Or at least it should have presented a situation with many more units.

      I made an RTS in C++ a while ago and was able to build paths for many units per frame on a fairly large map. And even if I couldn't, there's many optimizations I would have considered before threading, like only building a partial path based on portals. Or building a "bad" path and simplifying it on future frames.

      Here's a great A* references with a bunch of helpful tricks: http://theory.stanford.edu/~amitp/GameProgramming/

    • lloekiFeb 2020

      Nice and simple, but I’m a big fan of Amit Patel / Red Blob Games articles on the subject, and more. The interactive visualisations really drive the point home, and also tackle less usual stuff like hex grids and circular objects in dedicated articles.

      Introduction:

      https://www.redblobgames.com/pathfinding/a-star/introduction.html

      Much, much more, with in depth notes, variants, optimisations, moving targets and obstacles...:

      http://theory.stanford.edu/~amitp/GameProgramming/

      And other intriguing articles:

      https://www.redblobgames.com/

    • JachNov 2016

      I was going to challenge you, since I thought that was going to be the older http://theory.stanford.edu/~amitp/GameProgramming/AStarComparison.html reference which I never found very helpful. The best intro I had to these was in a Game AI course and we basically implemented all these visualizations and more (bad screenshot: http://www.thejach.com/imgs/visibility_with_astar.png) to fully understand it. But the newer reference you linked is great and I'd agree it's the best public introduction.

    Related

    Red Blob Gamesredblobgames.com199 people

    Hexagonal grids for games

    Red Blob Games
    Personal · last shared 2026
    Red Blob Games Blogsimblob.blogspot.com27 people

    Verb-Noun vs. Noun-Verb

    Red Blob Games Blog
    Personal · last shared 2025
    Louis Brandylbrandy.com45 people

    Using genetic algorithms to find Starcraft 2 build orders

    Louis Brandy
    Personal · last shared 2023
    Gaffer On Gamesgafferongames.com159 people

    UDP vs TCP

    Gaffer On Games
    Personal · last shared 2026
    #AltDevBlogADayaltdevblogaday.com163 people

    John Carmack on the importance of Static Code Analysis

    #AltDevBlogADay
    Publication · last shared 2023
    Break Into Chatbreakintochat.com17 people

    Instant Graphics and Sound

    Break Into Chat
    Personal · last shared 2026
    Keith Schwarzkeithschwarz.com50 people

    Darts, Dice, and Coins: A beautiful article on a beautiful algorithm

    Keith Schwarz
    Personal · last shared 2026
    Fabien Sanglardfabiensanglard.net525 people

    The Polygons of Another World

    Fabien Sanglard
    Personal · last shared 2026