logo

Algorithms

A better A* algorithm

A few years ago I needed a path finding algorithm in a hurry for a procedural level generator I was trying to write. I managed to find a C# one that supported a number of options and was focused on performance. I reached out to the author if they minded if I changed it a bit and package it up as a nuget. The author agreed, and I used the library in a couple procedural level generators such as Promethean.

A* algorithm in C#

An A* algorithm in C#. Original credit goes to Gustavo Franko and his post on code guru. With his permission I’ve pulled out the A* algorithm from the sample app, updated some of the code to use some newer c# features, added some tests to demonstrate usage and uploaded it to github. You can view the project at https://github.com/valantonini/AStar. The algorithm contains a variety options such as whether it uses diagonals.