# Pathfinding

> How a game character finds a way round walls to a goal.

**Field:** Software Development  
**Category:** Game Development  
**Also known as:** Path Finding, A* Search, A-Star, A* Pathfinding, Navigation Mesh, NavMesh

## Think of it like

Think of it like a map app for game characters. It finds the way round walls to where they want to go.

## Definition

Pathfinding is how a game character finds a way from one spot to another without walking into walls. The game sees the level as a grid or a web of points. A search, often one called A star, tries routes and keeps the shortest. The character then follows that path step by step. Big 3D games often use a navigation mesh, a map of where characters can walk.

## Example

In Lucy's game, a dog runs to the player. Pathfinding takes it round the fence, not straight into it.

## Why it matters

Characters that get stuck on walls look broken. Good paths make a world feel real.

## Common mistake

Working out a new path every frame for every character. That is slow, so reuse paths for a while.

## Three principles

- **A map of spots.** The level becomes a grid or a web of points.
- **Search for the best.** A star tries routes and keeps the shortest.
- **Follow the steps.** The character walks the path in order.

## Related terms

- [Dijkstra's Algorithm](https://learn.benibix.com/term/development/dijkstras-algorithm)
- [Breadth-First Search (BFS)](https://learn.benibix.com/term/development/breadth-first-search)
- [Graph (Data Structure)](https://learn.benibix.com/term/development/graph)
- [Non-Player Character (NPC)](https://learn.benibix.com/term/development/non-player-character)
- [Tilemap](https://learn.benibix.com/term/development/tilemap)
- [Path Planning](https://learn.benibix.com/term/ai/path-planning)

![Two panels. On the left, a finite state machine has three states: Patrol, Chase (lit up) and Attack. Patrol goes to Chase when the guard sees the player, Chase goes to Attack when close, and Chase goes back to Patrol when the guard loses sight. A note says one state at a time, with a rule for each change. On the right, a grid with a dark wall in the middle shows a path from G, the guard, up, across the top and down to P, the player, going round the wall.](https://learn.benibix.com/diagrams/dev2-npc-brain.svg)

---

Source: https://learn.benibix.com/term/development/pathfinding
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
