Visualizing Pathfinding Algorithms

  Рет қаралды 145,195

CodeNoodles

CodeNoodles

Жыл бұрын

In this video I code a visualization of a couple of different pathfinding algorithms.
Sorting Algorithms Video: • 15 Sorting Algorithms ...
LINKS
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Support the channel: ko-fi.com/codenoodles
Itch.io: codenoodles.itch.io/
GitHub: github.com/OfficialCodeNoodles
█▀ █ █ █▄▄ █▀ █▀▀ █▀█ █ █▄▄ █▀▀
▄█ █▄█ █▄█ ▄█ █▄▄ █▀▄ █ █▄█ ██▄

Пікірлер: 154
@plagosus
@plagosus 7 ай бұрын
The sound effect turned up much cooler than I expected tbh. Great work here!
@CodeNoodles
@CodeNoodles 7 ай бұрын
I'm glad you liked it!
@plectro3332
@plectro3332 Жыл бұрын
8:24, your algorithm just straight up played Flight of the Bumblebee
@CodeNoodles
@CodeNoodles Жыл бұрын
Lol you're right it kinda does 😆
@tylerb6981
@tylerb6981 Жыл бұрын
Personally, I heard the screams of a desperate algorithm losing hope that it will accomplish its singular goal in life!
@Quizlz
@Quizlz Жыл бұрын
eh
@andrewtoasterr9325
@andrewtoasterr9325 Жыл бұрын
What I think would be cool if the path was not generated instantly, but was constructed tile by tile with the noise. Just like the algorithms
@Skyblue92u
@Skyblue92u 10 ай бұрын
Isn’t that literally what he did?
@FriedMonkey362
@FriedMonkey362 10 ай бұрын
​@@Skyblue92uno he means AFTER its done Just like the sorting algorithm, after the sorting is done, you hear one last noise wich is the complete one, which should sound nicer then all the noise
@jutube821
@jutube821 6 ай бұрын
@@FriedMonkey362 Noise? Those were all single notes with defined frequencies, played fast or slow. It might sound like noise to a non musician I guess.
@dominikluigi2308
@dominikluigi2308 5 ай бұрын
​@@jutube821, no, noise as in sound in general, not white noise
@aldobernaltvbernal8745
@aldobernaltvbernal8745 5 ай бұрын
​​@@jutube821you know how when you say "loud noises", well noise as in that: a sound
@HyperFocusMarshmallow
@HyperFocusMarshmallow 6 ай бұрын
I love how you showed “mistakes”. That’s so useful for learning. Maybe you even made mistakes on purpose to be pedagogical, I don’t know. Very useful regardless!
@CodeNoodles
@CodeNoodles 6 ай бұрын
Trust me, I don't need to create mistakes to show because I make plenty already 😆
@HyperFocusMarshmallow
@HyperFocusMarshmallow 6 ай бұрын
@@CodeNoodles Sorry I doubted you XD
@u9vata
@u9vata 7 ай бұрын
You should have written which is which. Btw a lot of other algorithms exist: like there are various speedups for A* for grid-like spaces like this that are more efficient and there are hierarchical pathfinding algorithms that basically create bigger grids and pre-calculate which connects with which (info needed only at boundary) and then you can do a higher level search on the bigger grid and then a low-level search for the inside of the grid. This ensures scalability much better. A further speedup to the original A* is to "look ahead" so instead of just using the hint values for the cell to visit - we look ahead and its hint becomes hint values of that + all its neighbors that are k distant from it. This ensures much better heuristic hints at the cost of more operations - but can lead to better results. One can also pair this up with data structures that hold the grid not the usual 2D array ways, but as a hierarchy where close-by elements are more often cache local to each (this is especially powerful if you can make the grid 0s and 1s.
@PumpkinBear
@PumpkinBear Жыл бұрын
This is really cool! What happens if the target is fully encased in solid tiles?
@CodeNoodles
@CodeNoodles Жыл бұрын
Thanks! If the target is fully encased once the algorithm runs out of tiles it just stops and no path is generated.
@ghlcit
@ghlcit Жыл бұрын
@@CodeNoodles I saw that coming but I don't think the algorithm did
@jasobk5258
@jasobk5258 Жыл бұрын
Bud dump dink
@jazzj2
@jazzj2 7 ай бұрын
in addition to no complete path being generated, generally you still remember the closest valid tile to the goal and can still make a path towards it
@Tasarran
@Tasarran 4 ай бұрын
You have to remember that 'no path' is a valid result sometimes and allow for that exit point once everything has been checked.
@toffeejc
@toffeejc Жыл бұрын
I’ve watched all your videos and I subbed, I can’t wait to see you post more. I really want to get into coding now
@the_cheese_cultist
@the_cheese_cultist 6 ай бұрын
you can make a c++ priority queue order from minimum to maximum like this: std::priority_queue
@danyaeger12345
@danyaeger12345 6 ай бұрын
Heh just seeing this video now, and i love it. The one thing i thought was missing is a final going up the scale as the purple line is drawn in. It was a little disappointing after all that awesomeness to not get that final glissando when it's found the path. Always found that to be the most satisfying part of the sorting method videos.
@CodeNoodles
@CodeNoodles 6 ай бұрын
You're right. I love the sorting algorithm videos as well! Maybe I should do a video about them 🤔
@danyaeger12345
@danyaeger12345 6 ай бұрын
@@CodeNoodles Nice, i'd totally watch that :) btw, I hope i didn't come off too harsh with my prior comment, i just get nitpicky sometimes :-P
@grassypaddy
@grassypaddy Жыл бұрын
this is a great pathfinding algorithm! thanks for the epic video!
@Speiger
@Speiger 6 ай бұрын
I know this is one year late. But the breath first algorithm has 1 upside that the A* cant really compete in. And that is when you have multiple targets, or if you don't know where the targets are on the grid. The second one is fairly simple because the A* requires target locations to work optimally. The first one is not so simple, with a finite set of targets you could optimize it to work, but if the size gets to big even a optimized priority queue that is designed to handle multiple targets you simply lose in complexity gained because you have to iteratively check against all targets, while the breath first simply can simply check on a set if it is contained. It's basically List.indexOf vs Set.contains problem. And pathfinding usually contains multiple targets at once.
@DMG.
@DMG. 6 ай бұрын
You could probably get A* working with multiple targets without much issue
@Speiger
@Speiger 6 ай бұрын
@@DMG. It will turn into a N*M problem while breath first stays in the same logic complexity level. Because you need to evaluate the "closest" distance for every possible target on every node. Breath first doesn't have this issue.
@cameronbowen4430
@cameronbowen4430 5 ай бұрын
@@Speiger ya so cool! Recently discovered flow fields after playing a plague tale and I love this style of pathfinding! Instead of using each agent to request an A* path you just bake each navTile or mesh with a direction to the goal!
@paicemaster6855
@paicemaster6855 5 ай бұрын
So glad i found your channel! Awesome video and your newer ones look even more interesting ^_^
@CodeNoodles
@CodeNoodles 5 ай бұрын
Thanks, it means a lot!
@amoineau
@amoineau 7 ай бұрын
Really cool piece of software !
@SkateBox900
@SkateBox900 7 ай бұрын
🤘🔥 awesome. thanks. that’s really cool. I’m going to tinker around with coding something like that.
@Mistereee
@Mistereee Жыл бұрын
another very epic and cool video
@comeycallate9959
@comeycallate9959 7 ай бұрын
The difference of the sound use is the algorithm is linearly increased, from sorting algorithms is more exciting because of the pseudo randomized opening and the ordered ending
@XoIoRouge
@XoIoRouge 6 ай бұрын
The biggest thing missing is information on each pathfinding. My favorite part about Timo Bingmann's video is that I could identify which sort I liked the best and look it up for more information. I wish I knew which pathfinding algorithm was being used.
@wangtang32000
@wangtang32000 Жыл бұрын
i didn't expect how satisfying the generation would sound lol
@MichaelHumphrey
@MichaelHumphrey Жыл бұрын
How come the final path appears to go through the frontier tiles as seen at 6:06? If they're in the frontier, they shouldn't have been searched yet.
@CodeNoodles
@CodeNoodles Жыл бұрын
I forgot to mention that the A Star algorithm doesn't use a searched tile list. It can go over a tile multiple times if it produces a better path.
@lightsinthedarkness
@lightsinthedarkness Жыл бұрын
@@CodeNoodles what happened to the duck hunting game video?
@acerbd8784
@acerbd8784 Жыл бұрын
Really good video!
@olillin
@olillin Жыл бұрын
Very nice video!
@ocomolinaehain1795
@ocomolinaehain1795 Жыл бұрын
This reminds me of, a bit obviously, echolocation, as well as Slime molds!
@cabbageder
@cabbageder Жыл бұрын
So cool!
@MeriaDuck
@MeriaDuck 5 ай бұрын
4:28 Nooo, I do'nt want to go there, nooo! XD 'perfectly inefficient', could see that it actually would work with the fix you applied🙂
@Hoxle-87
@Hoxle-87 7 ай бұрын
Nice!
@shripalmehta
@shripalmehta 3 ай бұрын
Great video, but could have been better if you showed which approach/algorithm is being implemented after adding the sound effects. you've put in great efforts.
@obvioustruth
@obvioustruth 6 ай бұрын
Awesome video! :D
@hattonz5275
@hattonz5275 Жыл бұрын
Would be cool to make a game using this. Cool video! : )
@Lifesstructure_
@Lifesstructure_ Жыл бұрын
Just with a higher pitch
@paulaosegueda9053
@paulaosegueda9053 Жыл бұрын
I love your videos
@blazester1018
@blazester1018 Жыл бұрын
I was wondering where your other videos are? I'm new to the channel and it seems you've had more videos but I only see four. Sorry if this has already been asked or if I'm wrong about there being past videos. By the way seems like a very good channel!
@CodeNoodles
@CodeNoodles Жыл бұрын
I did have some old videos but they aren't very good. I just want to keep making better videos and my old ones weren't up to the standard I want to work towards.
@lod4246
@lod4246 Жыл бұрын
@@CodeNoodles Perhaps unlist them and put it in a playlist called "Old Videos" or something
@richarddooley3655
@richarddooley3655 Жыл бұрын
*Adds sounds* Algorithm: -I am cop -Now I am cat on piano
@catmaxi2599
@catmaxi2599 Жыл бұрын
I think you could have shown Dijkstra and depth first search too. Perhaps djikstra ends up almost doing the same as bfs it still worthwhile pointjng out the differences
@KDKEVlN
@KDKEVlN 6 ай бұрын
Or Jump Point Search
@jakeaustria5445
@jakeaustria5445 3 ай бұрын
Hi Mr. Pasta, it's fortunate to see you not being gulped down by philosophers.
@Psychopatz
@Psychopatz 6 ай бұрын
I feel the struggle of the cpu from scanning that algorithm grid lmao
@YellowCardx
@YellowCardx Жыл бұрын
What library did you use for the visualization?
@KingOfTresune
@KingOfTresune Жыл бұрын
Where is your duck hunt vid? That was really great!
@HyperFocusMarshmallow
@HyperFocusMarshmallow 6 ай бұрын
Cool!
@brendenm8182
@brendenm8182 Жыл бұрын
Posted 7 seconds ago this is the earliest I've ever been anyways hello
@TheArchitectOfDreams
@TheArchitectOfDreams 3 ай бұрын
Sound effect should be low fart at the start, then get higher pitched as it gets closer.
@thomasames3789
@thomasames3789 Жыл бұрын
I would love to know what C++ Editor you use!
@CodeNoodles
@CodeNoodles Жыл бұрын
I use Visual Studios for my projects but in my videos I show the code with VS Code instead.
@thomasames3789
@thomasames3789 Жыл бұрын
@@CodeNoodles Thank you!
@absobel
@absobel Жыл бұрын
I still don't see why you don't have as many subscribers as other channels who do the same kind of content
@lailoutherand
@lailoutherand Жыл бұрын
New channels tend to get less traction, even if the content is basically a copy but modified. (pain)
@GordonWrigley
@GordonWrigley 5 ай бұрын
It's a nice enough video, but A* was kinda base level when I studied computer science more than 20 years ago so there are many many videos explaining it. It'd be nice to see videos that go into the various improvements that have been created since then.
@CodeNoodles
@CodeNoodles 5 ай бұрын
I agree. I made this video when I had a very limited understanding of pathfinding algorithms, so I should do something better in the future.
@lightsinthedarkness
@lightsinthedarkness Жыл бұрын
What happened to your duck hunting video, I saw it and liked it but now it's gone?
@LilCalebW
@LilCalebW Жыл бұрын
Niiiice
@osabga6877
@osabga6877 Жыл бұрын
HI, how did you created grafics for c++?
@Pheonix1328
@Pheonix1328 Жыл бұрын
You could totally make music with this, and each algorithm would have different methods to do so...
@CakeCh.
@CakeCh. 6 ай бұрын
0:43 Oh is that a "Sounds of the Mandelbrot set"? (colorful ♪)
@PikalaxALT
@PikalaxALT 6 ай бұрын
Is there a combination of layout and algorithm that would make the audio sound like the harp intro to Zelda's Fairy Fountain theme?
@CodeNoodles
@CodeNoodles 6 ай бұрын
That's such a cool idea, but I don't know if such a layout like that exists.
@ragemodegaming7962
@ragemodegaming7962 5 ай бұрын
8:24 R2D2 on drugs
@isaiahates9533
@isaiahates9533 Жыл бұрын
Wow that's why I am subscribed for free codes
@MAREKROESEL
@MAREKROESEL Жыл бұрын
The efficiency of the second algorithm seems a little suspicious, when you start in x+ direction and the target is exactly in the x+ direction. It would be nice to add at least a part of the c code, to give a hint, what you are doing there.
@DenisTrebushnikov
@DenisTrebushnikov 8 ай бұрын
it tooks the closest tile to targetTile as first tile to move, so if target in x+ direction it goes x+ (Fcost is lower in that direction, it's greedy to get target faster as it can inspite of correct shortest way), It doesn't take other direction until it reaches dead end in first direction, and other tiles get additional cost if not selected, so it's hard to back to previous tiles. The best con of this is speed of calculations (it even needn't closed list to use algorithm, I guess)
@user199x
@user199x 7 ай бұрын
Would've been fun to see an algorithm that picks at random, just for the sound of it
@anibaldk
@anibaldk 6 ай бұрын
8:21 Me telling a story. 8:24 My gf telling the same story.
@nathanfisher6925
@nathanfisher6925 Жыл бұрын
I can't help but wonder if your a* method would have problems if the optimal route to the goal involved substantial back-tracking, especially at the start. All your examples involved only forward-pathing.
@CodeNoodles
@CodeNoodles Жыл бұрын
You're correct. The A* algorithm isn't always the fastest, it just is well balanced for most situations. Good observation!
@beeble2003
@beeble2003 6 ай бұрын
A* copes wih that just fine. But, like any algorithm that explores the best-looking regions first, it'll have to do a lot of backtracking if the things that look good turn out not to be good. And there's plenty of backtracking shown in the video. In the example that starts at 8:24, you can see that the algorithm starts by heading broadly in the right direction, but it gets stuck in a bit of a dead-end at about 8:30. It then spends quite a while investigating minor deviations closer to the source, before finally breaking through.
@Knittely
@Knittely 6 ай бұрын
Now give this to some music producers and they will make a song by creating a maze!
@djtimo
@djtimo 10 ай бұрын
Hey Noodles! Where/How would I get the code for this. I wanted to experiment with the program but I wasn't sure how to do that.
@CodeNoodles
@CodeNoodles 10 ай бұрын
It's on my Github, which is in the description of my videos.
@davepullin8572
@davepullin8572 6 ай бұрын
You should generate a sound in sync with the drawing of the final path. (instead of the silence!)
@RenatoT66
@RenatoT66 Ай бұрын
Wow!
@nopparuj
@nopparuj 7 ай бұрын
4:28 Generous best-first dearch
@lod4246
@lod4246 Жыл бұрын
7:49 lmfao oof sound
@jeremiahlyleseditor437
@jeremiahlyleseditor437 3 ай бұрын
This works wonderfully but most of the outcomes are not the shortest distance. Have you improved this algorithm to always give the shortest distance?
@user-dp9dg4tb3i
@user-dp9dg4tb3i 6 күн бұрын
bro im doing packman and i looked this up for the algortythm the chances
@shadow_jem_YT
@shadow_jem_YT 6 ай бұрын
7:49 it sounds like the oof sound efect
@morgandonze7798
@morgandonze7798 7 ай бұрын
8:24 best one
@Unfilteredcallinshow
@Unfilteredcallinshow Жыл бұрын
Your videos are great, but flashing back to the white background has destroyed my retinas. Please fix in the next patch
@empireempire3545
@empireempire3545 9 ай бұрын
Now i wait for Jump Point Search
@frankdieter9907
@frankdieter9907 Жыл бұрын
I believe your videos would be even better if you had less clips of other people laughing or saying something and instead just have yourself, you are way cooler than you probably think, to me at least
@hypercoder-gaming
@hypercoder-gaming 6 ай бұрын
Why not make both the start and end pathfind to the other until they meet in the middle and make a path? Would it be faster or slower?
@the_cheese_cultist
@the_cheese_cultist 6 ай бұрын
this is called a bidirectional search. it's usually faster, but the implementation is more complex
@BelldofersMatlack
@BelldofersMatlack 7 ай бұрын
7:50 "OOF"
@DarmaniLink
@DarmaniLink 6 ай бұрын
7:18 to get to the part of the video you clicked for
@Haxses.
@Haxses. 11 ай бұрын
Watching this made me hungry for noodles...
@isaacmurray8490
@isaacmurray8490 9 ай бұрын
You should use this to make a pathfinding algorithm play never gonna give you up
@AngFan1
@AngFan1 Жыл бұрын
if polibeus existed this is tha music
@kippesolo8941
@kippesolo8941 6 ай бұрын
Nice Vid but did you seriously compare A* and BFS ?? A Path finding algo vs a path optimization algo.
@mission2858
@mission2858 Ай бұрын
7:50 Oof
@jayronbaello3645
@jayronbaello3645 Жыл бұрын
codenoodles i have a question
@invisiblevfx
@invisiblevfx 9 ай бұрын
Nice job. Now use only the notes in the a minor key
@wurdleturtle1
@wurdleturtle1 6 ай бұрын
I wonder if someone could make music with this…
@c3cris2
@c3cris2 Жыл бұрын
Love your videos, but there’s a jarring feeling when you insert loud laugh gag clips. I know you are trying to add humor like other KZfaqrs I love such as @codebullet and @civvie11.
@tt_thoma
@tt_thoma Жыл бұрын
Could you fill your character eyes ? It's real scary NGL
@explodingwolfgaming8024
@explodingwolfgaming8024 Жыл бұрын
Commenting 4 algorithm
@heyhey97777
@heyhey97777 Жыл бұрын
hello there
@frankdieter9907
@frankdieter9907 Жыл бұрын
General Kenobi
@Marioloverr2012
@Marioloverr2012 Жыл бұрын
How this comment get 5 likes?
@tovarischkarno4390
@tovarischkarno4390 6 ай бұрын
3:43 : Try saying that 3 times fast Me: Greedy Breast F- wait what?
@treska7688
@treska7688 Жыл бұрын
That last part, with the noise... feels like it should come with some kind of warning. "Those of sensitive hearing, beware!" or maybe "Please don't listen to this part with headphones in, for your own sake"... something like that. Nice video otherwise, though!~
@jayronbaello3645
@jayronbaello3645 Жыл бұрын
its that where did you discover coding and where did you use to code before making custom games
@CodeNoodles
@CodeNoodles Жыл бұрын
Good question. I am a self taught programmer and began with Python. One of my first projects was making a game so I've kinda been making games forever.
@jayronbaello3645
@jayronbaello3645 Жыл бұрын
@@CodeNoodles oh ok im still a beginer in coding
@callmemondy
@callmemondy Жыл бұрын
Hello
@rcookman
@rcookman Жыл бұрын
No Dijkstra's algorithm???
@the_cheese_cultist
@the_cheese_cultist 6 ай бұрын
on a graph with uniform edge cost, dijkstra works identically to bfs
@moth.monster
@moth.monster Жыл бұрын
i apprecated the greedy worst-first search
@Lightyboii
@Lightyboii Жыл бұрын
ThAt soUnd
@Frezi23
@Frezi23 10 ай бұрын
Maybe it's better to use vectors here instead of straight lines, to optimize it's movement
@microwavedcaprisun9
@microwavedcaprisun9 Жыл бұрын
hi
@professorcube5104
@professorcube5104 Жыл бұрын
7:58 why does this sound like the roblox death sound
@marcd.1166
@marcd.1166 6 ай бұрын
"Manathan distance" ... use the proper math term "Euclidian distance"
@the_cheese_cultist
@the_cheese_cultist 6 ай бұрын
those are different. Manhattan distance is abs(x1-x2)+abs(y1-y2). Euclidean distance is sqrt((x1-x2)^2 + (y1-y2)^2)
@MC5677
@MC5677 13 күн бұрын
bet you can't port it to 3ds
@theguywiththewhiteblanket
@theguywiththewhiteblanket 12 күн бұрын
Try ds
@paul10724
@paul10724 Жыл бұрын
2:51 pls don‘t use Nikocado clips. Its satisfying to look at those paths. A cool video.
@Periwinkleaccount
@Periwinkleaccount Жыл бұрын
I think you should put this online so other people can use it.
@drakovangorder8160
@drakovangorder8160 Жыл бұрын
give us the link lmao
@drakovangorder8160
@drakovangorder8160 Жыл бұрын
i want to mess with the funny noise generator
@ImXyper
@ImXyper Жыл бұрын
then
@newbite6394
@newbite6394 Жыл бұрын
lol 6:40 ratio
@callmemondy
@callmemondy Жыл бұрын
Earn your early ticket here! Only for 1h
@microwavedcaprisun9
@microwavedcaprisun9 Жыл бұрын
claimed
@emperorstorm3266
@emperorstorm3266 Жыл бұрын
demialc
@Bottle_Goat
@Bottle_Goat Жыл бұрын
Claimed
How AI Discovered a Faster Matrix Multiplication Algorithm
13:00
Quanta Magazine
Рет қаралды 1,3 МЛН
I Coded Pacman but it's Procedurally Generated
11:01
CodeNoodles
Рет қаралды 108 М.
Заметили?
00:11
Double Bubble
Рет қаралды 1,3 МЛН
Chips evolution !! 😔😔
00:23
Tibo InShape
Рет қаралды 42 МЛН
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 97 МЛН
The hidden beauty of the A* algorithm
19:22
polylog
Рет қаралды 824 М.
How Dijkstra's Algorithm Works
8:31
Spanning Tree
Рет қаралды 1,3 МЛН
I Coded Snake but there's a Catch...
9:45
CodeNoodles
Рет қаралды 2,8 МЛН
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 4,9 МЛН
Using Image Recognition to DESTROY Fruit Ninja
10:08
CodeNoodles
Рет қаралды 487 М.
I Made a Neural Network with just Redstone!
17:23
mattbatwings
Рет қаралды 323 М.
Making a difficult game about fitting in - Acerola Jam 0
19:17
jess::codes
Рет қаралды 88 М.
A Comparison of Pathfinding Algorithms
7:54
John Song
Рет қаралды 704 М.
Simulating Particle Life
18:18
Digital Genius
Рет қаралды 126 М.
ChatGPT vs. REAL Programmer... Who Will Win?
9:12
CodeNoodles
Рет қаралды 13 М.
Pratik Cat6 kablo soyma
0:15
Elektrik-Elektronik
Рет қаралды 8 МЛН
Which Phone Unlock Code Will You Choose? 🤔️
0:14
Game9bit
Рет қаралды 12 МЛН
iPhone 15 Pro vs Samsung s24🤣 #shorts
0:10
Tech Tonics
Рет қаралды 9 МЛН