A* Algorithm

An algorithm for pathfinding.

I want to play around with pathfinding using the A* algorithm. Ultimately, I would like to combine pathfinding with vector fields to create a sort of swarming, pathfinding algorithm.

Tile Map

I need to start by creating a tile map to represent our area. Each tile will have one of two states: blocking or non-blocking. Blocking tiles should stop the movement of entities, while non-blocking tiles should allow the movement of entities.

Pathfinding

Now that the tile map has been implemented, I can work on the actual pathfinding algorithm. As the title of this page suggests, I will be using the A* pathfinding algorithm here.

Movement Rules

These movement rules will determine how and when an entity can move through the tiles within this algorithm. The movement rules are as follows:

A* Rules

The A* algorithm is governed by a very simple path scoring rule. Each tile is given a score of F = G + H, where:

Paths are then given a score equal to their cumulative tiles' F values. The path with the lowest score should be shortest path.

The algorithm should follow these basic steps:

Entity Tests