Visualizing Pathfinding Algorithms

Поделиться
HTML-код
  • Опубликовано: 2 янв 2025

Комментарии • 158

  • @plagosus
    @plagosus Год назад +40

    The sound effect turned up much cooler than I expected tbh. Great work here!

  • @andrewtoasterr9325
    @andrewtoasterr9325 2 года назад +256

    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 Год назад +5

      Isn’t that literally what he did?

    • @FriedMonkey362
      @FriedMonkey362 Год назад +24

      ​@@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 Год назад

      @@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.

    • @wokark
      @wokark Год назад

      ​@@jutube821, no, noise as in sound in general, not white noise

    • @aldobernaltvbernal8745
      @aldobernaltvbernal8745 Год назад

      ​​@@jutube821you know how when you say "loud noises", well noise as in that: a sound

  • @HyperFocusMarshmallow
    @HyperFocusMarshmallow Год назад +39

    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  Год назад +14

      Trust me, I don't need to create mistakes to show because I make plenty already 😆

    • @HyperFocusMarshmallow
      @HyperFocusMarshmallow Год назад +1

      @@CodeNoodles Sorry I doubted you XD

  • @plectro3332
    @plectro3332 2 года назад +59

    8:24, your algorithm just straight up played Flight of the Bumblebee

    • @CodeNoodles
      @CodeNoodles  2 года назад +9

      Lol you're right it kinda does 😆

    • @tylerb6981
      @tylerb6981 2 года назад +2

      Personally, I heard the screams of a desperate algorithm losing hope that it will accomplish its singular goal in life!

    • @Quizlz
      @Quizlz Год назад

      eh

  • @Ace73Streaming
    @Ace73Streaming 3 месяца назад +2

    Your explanation of breadth first search plus a short conversation with someone about how nodes work instead of tiles was enough for me to get a working breadth first search algorithm in a day, and I've never made a pathfinding algorithm before

    • @CodeNoodles
      @CodeNoodles  3 месяца назад +1

      That's awesome, I hope the video gave you sufficient information!

  • @u9vata
    @u9vata Год назад +30

    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.

  • @danyaeger12345
    @danyaeger12345 Год назад +5

    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  Год назад +4

      You're right. I love the sorting algorithm videos as well! Maybe I should do a video about them 🤔

    • @danyaeger12345
      @danyaeger12345 Год назад +1

      @@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

  • @woi1130
    @woi1130 5 месяцев назад

    Man, this visualization is phenomenal, and the sound is awesome. Thanks and subscribed.

  • @toffeejc
    @toffeejc 2 года назад +9

    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

  • @grassypaddy
    @grassypaddy 2 года назад +10

    this is a great pathfinding algorithm! thanks for the epic video!

  • @PumpkinBear
    @PumpkinBear 2 года назад +176

    This is really cool! What happens if the target is fully encased in solid tiles?

    • @CodeNoodles
      @CodeNoodles  2 года назад +135

      Thanks! If the target is fully encased once the algorithm runs out of tiles it just stops and no path is generated.

    • @ghlcit
      @ghlcit 2 года назад +17

      @@CodeNoodles I saw that coming but I don't think the algorithm did

    • @jasobk5258
      @jasobk5258 Год назад +1

      Bud dump dink

    • @jazzj2
      @jazzj2 Год назад +4

      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 Год назад

      You have to remember that 'no path' is a valid result sometimes and allow for that exit point once everything has been checked.

  • @thePrplMonkey
    @thePrplMonkey 2 года назад +14

    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  2 года назад +20

      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 2 года назад +1

      @@CodeNoodles what happened to the duck hunting game video?

  • @Speiger
    @Speiger Год назад +18

    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. Год назад

      You could probably get A* working with multiple targets without much issue

    • @Speiger
      @Speiger Год назад

      @@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 Год назад

      @@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 Год назад +2

    So glad i found your channel! Awesome video and your newer ones look even more interesting ^_^

  • @the_cheese_cultist
    @the_cheese_cultist Год назад +1

    you can make a c++ priority queue order from minimum to maximum like this:
    std::priority_queue

  • @XoIoRouge
    @XoIoRouge Год назад +3

    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.

  • @comeycallate9959
    @comeycallate9959 Год назад +2

    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

  • @Gravenilvectuto
    @Gravenilvectuto Месяц назад +2

    Spaggetiiiiii

  • @DarmaniLink
    @DarmaniLink Год назад +1

    7:18 to get to the part of the video you clicked for

  • @catmaxi2599
    @catmaxi2599 Год назад +7

    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 Год назад +2

      Or Jump Point Search

  • @wangtang32000
    @wangtang32000 2 года назад +1

    i didn't expect how satisfying the generation would sound lol

  • @richarddooley3655
    @richarddooley3655 2 года назад +1

    *Adds sounds*
    Algorithm:
    -I am cop
    -Now I am cat on piano

  • @yaroslawliker
    @yaroslawliker День назад

    Well, the sound is horrific and satisfying at the same time

  • @CakeCh.
    @CakeCh. Год назад

    0:43 Oh is that a "Sounds of the Mandelbrot set"?
    (colorful ♪)

  • @amoineau
    @amoineau Год назад +2

    Really cool piece of software !

  • @anibaldk
    @anibaldk Год назад +1

    8:21 Me telling a story.
    8:24 My gf telling the same story.

  • @blazester1018
    @blazester1018 2 года назад +6

    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  2 года назад +7

      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 2 года назад +1

      @@CodeNoodles Perhaps unlist them and put it in a playlist called "Old Videos" or something

  • @abraxas2658
    @abraxas2658 5 месяцев назад

    I know this is an old video, but at 7:33, it looks like your heuristic might not be pointing in the right direction. It should naturally go from top left to bottom right, not to the middle of the right side.

  • @ragemodegaming7962
    @ragemodegaming7962 Год назад +1

    8:24 R2D2 on drugs

  • @Mistereee
    @Mistereee 2 года назад +3

    another very epic and cool video

  • @YourAverageYoutubeCommentor
    @YourAverageYoutubeCommentor 6 месяцев назад +1

    Life changing video!

  • @nathanfisher6925
    @nathanfisher6925 Год назад +2

    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  Год назад +2

      You're correct. The A* algorithm isn't always the fastest, it just is well balanced for most situations. Good observation!

    • @beeble2003
      @beeble2003 Год назад

      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.

  • @MAREKROESEL
    @MAREKROESEL Год назад +5

    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 Год назад +2

      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)

  • @lightsinthedarkness
    @lightsinthedarkness 2 года назад +2

    What happened to your duck hunting video, I saw it and liked it but now it's gone?

  • @ocomolinaehain1795
    @ocomolinaehain1795 2 года назад +1

    This reminds me of, a bit obviously, echolocation, as well as Slime molds!

  • @PikalaxALT
    @PikalaxALT Год назад +1

    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  Год назад +1

      That's such a cool idea, but I don't know if such a layout like that exists.

  • @jakeaustria5445
    @jakeaustria5445 10 месяцев назад

    Hi Mr. Pasta, it's fortunate to see you not being gulped down by philosophers.

  • @MeriaDuck
    @MeriaDuck Год назад

    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🙂

  • @shripalmehta
    @shripalmehta 11 месяцев назад +1

    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.

  • @absobel
    @absobel 2 года назад +5

    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 2 года назад +1

      New channels tend to get less traction, even if the content is basically a copy but modified. (pain)

  • @thevalarauka101
    @thevalarauka101 2 месяца назад +1

    "it's time for the fun part: the noise" but you've already added noise, I thought, it's just simple white noise for the solid tiles
    probably should have said "sound" here instead

  • @GordonWrigley
    @GordonWrigley Год назад +1

    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  Год назад +1

      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.

  • @Hattonz
    @Hattonz 2 года назад +2

    Would be cool to make a game using this.
    Cool video! : )

  • @Psychopatz
    @Psychopatz Год назад

    I feel the struggle of the cpu from scanning that algorithm grid lmao

  • @jeremiahlyleseditor437
    @jeremiahlyleseditor437 10 месяцев назад

    This works wonderfully but most of the outcomes are not the shortest distance.
    Have you improved this algorithm to always give the shortest distance?

  • @Pheonix1328
    @Pheonix1328 2 года назад +1

    You could totally make music with this, and each algorithm would have different methods to do so...

  • @brendenm8182
    @brendenm8182 2 года назад +3

    Posted 7 seconds ago this is the earliest I've ever been anyways hello

  • @TheArchitectOfDreams
    @TheArchitectOfDreams 10 месяцев назад

    Sound effect should be low fart at the start, then get higher pitched as it gets closer.

  • @YellowCardx
    @YellowCardx 2 года назад +1

    What library did you use for the visualization?

  • @osabga6877
    @osabga6877 2 года назад +1

    HI, how did you created grafics for c++?

  • @shubhamkumar-tm6qq
    @shubhamkumar-tm6qq 6 месяцев назад

    Just wondering there is no glass header file in the repo ,could u please help with that???
    Please see ur github repo

  • @obvioustruth
    @obvioustruth Год назад +1

    Awesome video! :D

  • @Knittely
    @Knittely Год назад

    Now give this to some music producers and they will make a song by creating a maze!

  • @KingOfTresune
    @KingOfTresune 2 года назад

    Where is your duck hunt vid? That was really great!

  • @djtimo
    @djtimo Год назад +1

    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  Год назад +1

      It's on my Github, which is in the description of my videos.

  • @user199x
    @user199x Год назад

    Would've been fun to see an algorithm that picks at random, just for the sound of it

  • @acerbd8784
    @acerbd8784 2 года назад +1

    Really good video!

  • @frankdieter9907
    @frankdieter9907 2 года назад +19

    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

  • @davepullin8572
    @davepullin8572 Год назад

    You should generate a sound in sync with the drawing of the final path. (instead of the silence!)

  • @Nsaf_UKR
    @Nsaf_UKR 2 года назад

    Your videos are great, but flashing back to the white background has destroyed my retinas.
    Please fix in the next patch

  • @olillin
    @olillin 2 года назад +1

    Very nice video!

  • @Commielyn
    @Commielyn 2 года назад +2

    7:58 why does this sound like the roblox death sound

  • @paulaosegueda9053
    @paulaosegueda9053 2 года назад +1

    I love your videos

  • @hypercoder-gaming
    @hypercoder-gaming Год назад

    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 Год назад

      this is called a bidirectional search. it's usually faster, but the implementation is more complex

  • @VitorOzana
    @VitorOzana 3 месяца назад

    DUDE, it would be very fun if the topology of the grid - or map? - make the pitches purposefully sound like music hahaha

  • @shadow_jem_YT
    @shadow_jem_YT Год назад

    7:49 it sounds like the oof sound efect

  • @pptmtz
    @pptmtz 4 месяца назад

    (;24 example is very interesting, as it kind of get some steps back to find the solution

  • @kippesolo8941
    @kippesolo8941 Год назад

    Nice Vid but did you seriously compare A* and BFS ??
    A Path finding algo vs a path optimization algo.

  • @Hoxle-87
    @Hoxle-87 Год назад +2

    Nice!

  • @cabbageder
    @cabbageder 2 года назад +2

    So cool!

  • @empireempire3545
    @empireempire3545 Год назад

    Now i wait for Jump Point Search

  • @isaiahates9533
    @isaiahates9533 2 года назад

    Wow that's why I am subscribed for free codes

  • @AngFan1
    @AngFan1 2 года назад

    if polibeus existed this is tha music

  • @Mint-t4d
    @Mint-t4d 7 месяцев назад

    bro im doing packman and i looked this up for the algortythm the chances

  • @nopparuj
    @nopparuj Год назад

    4:28 Generous best-first dearch

  • @LilCalebW
    @LilCalebW 2 года назад +2

    Niiiice

  • @Haxses.
    @Haxses. Год назад

    Watching this made me hungry for noodles...

  • @achievementcava
    @achievementcava Год назад

    3:43 : Try saying that 3 times fast
    Me: Greedy Breast F- wait what?

  • @isaacmurray8490
    @isaacmurray8490 Год назад

    You should use this to make a pathfinding algorithm play never gonna give you up

  • @wurdleturtle1
    @wurdleturtle1 Год назад

    I wonder if someone could make music with this…

  • @jayronbaello3645
    @jayronbaello3645 2 года назад

    codenoodles i have a question

  • @BelldofersMatlack
    @BelldofersMatlack Год назад

    7:50 "OOF"

  • @SaudBako
    @SaudBako 3 месяца назад

    Damn it you forgot to put the titles of the algorithms.

  • @jayronbaello3645
    @jayronbaello3645 2 года назад +1

    its that where did you discover coding and where did you use to code before making custom games

    • @CodeNoodles
      @CodeNoodles  2 года назад +2

      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 2 года назад

      @@CodeNoodles oh ok im still a beginer in coding

  • @tt_thoma
    @tt_thoma 2 года назад

    Could you fill your character eyes ? It's real scary NGL

  • @lod4246
    @lod4246 2 года назад

    7:49 lmfao oof sound

  • @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!~

  • @rcookman
    @rcookman Год назад

    No Dijkstra's algorithm???

    • @the_cheese_cultist
      @the_cheese_cultist Год назад

      on a graph with uniform edge cost, dijkstra works identically to bfs

  • @HyperFocusMarshmallow
    @HyperFocusMarshmallow Год назад +1

    Cool!

  • @heyhey97777
    @heyhey97777 2 года назад +7

    hello there

  • @Frezi23
    @Frezi23 Год назад +1

    Maybe it's better to use vectors here instead of straight lines, to optimize it's movement

  • @moth.monster
    @moth.monster 2 года назад

    i apprecated the greedy worst-first search

  • @RenatoT66
    @RenatoT66 8 месяцев назад +1

    Wow!

  • @paul10724
    @paul10724 2 года назад

    2:51 pls don‘t use Nikocado clips. Its satisfying to look at those paths. A cool video.

  • @c3cris2
    @c3cris2 2 года назад +2

    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 RUclipsrs I love such as @codebullet and @civvie11.

  • @explodingwolfgaming8024
    @explodingwolfgaming8024 2 года назад +1

    Commenting 4 algorithm

  • @Periwinkleaccount
    @Periwinkleaccount 2 года назад

    I think you should put this online so other people can use it.

  • @MC5677
    @MC5677 7 месяцев назад

    bet you can't port it to 3ds

  • @marcd.1166
    @marcd.1166 Год назад

    "Manathan distance" ... use the proper math term "Euclidian distance"

    • @the_cheese_cultist
      @the_cheese_cultist Год назад +1

      those are different. Manhattan distance is abs(x1-x2)+abs(y1-y2). Euclidean distance is sqrt((x1-x2)^2 + (y1-y2)^2)

  • @Lightyboii
    @Lightyboii 2 года назад

    ThAt soUnd