Skip to main content
GameDev.net gamedev.net
🔒 Locked

A Pathfinding Optimization Using Flood Fill

Started by sled Jul 30, 2008 at 10:51 PM 4 replies 5.8k views
Original Post
sled
sled
A Pathfinding Optimization Using Flood Fill I wrote up a short post describing a technique that can be used to optimize pathfinding. You might find it useful or interesting if you're new to pathfinding. And there's a small, browser based demo.
Sneftel
Sneftel
It's a useful technique. It's already a fairly well-known technique, generally called "connected component labeling" or similar, but congrats for rediscovering it. BTW, when doing pathfinding or similar operations, you'll generally refer to the "flood fill" algorithm as a "breadth first" traversal. The term "flood fill" is generally used (to refer to the same algorithm) when you're discussing computer graphics or computer vision.
sled
sled
It was taught to me, I didn't come up with it myself. But apparently not with the correct terminology. Thanks.
Timkin
Timkin
The actual application of this technique to pathfinding is known as the "Distance Transform Algorithm".
sled
sled
Are you sure? The top two google hits for "Distance Transform Algorithm" are not the same...

Did you guys at least like the demo?
Christer Ericson
Christer Ericson
Quote:
Original post by sled
Are you sure? The top two google hits for "Distance Transform Algorithm" are not the same...
Don't worry, what you described in your blog post is 100% accurate, including the use of the "flood fill" terminology. They're talking about something entirely different.

More specifically, you're talking about using flood fill to identify connected regions of a map, coloring them uniquely. Your colored map would be used to determine in O(1) time whether a path exist from A to B. They are talking about another application of "flood-filling" (really breadth-first search) to actually _computing_ the path from A to B.

Yours is a good post. Keep it up.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.