Tilemap PATHFINDING in Godot 4.2

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 132

  • @cashewolddew
    @cashewolddew  11 หลายเดือนก่อน +19

    Hello everyone! I've been blown away by your response to this video. I did not expect this. I am very thankful!
    I have decided to create a repository for future tutorials in order to give you the option to directly copy the projects from there. For this video, the project can be found here:
    github.com/cashew-olddew/godot-tutorials/tree/main/4.2/1%20-%20tilemap%20pathfinding

  • @gaetanjacquemin526
    @gaetanjacquemin526 11 หลายเดือนก่อน +30

    DUDE! I can't tell you how much your video was helpful to me: I have been struggling for WEEKS to make navigation work properly with Tilemaps. I could not find any helpful insight anywhere. Your video popping in my feed was litterally a Chrismtas miracle!! THANK YOU SO MUCH

    • @cashewolddew
      @cashewolddew  11 หลายเดือนก่อน

      I'm really glad it helped you! Happy holidays!

    • @tylerdavault9604
      @tylerdavault9604 8 หลายเดือนก่อน

      Man, im still stuck on trying to call animations from my animation tree 😅😅😅

    • @cashewolddew
      @cashewolddew  8 หลายเดือนก่อน

      @@tylerdavault9604 Don't worry, it gets easier! Here's a peanut 🥜

    • @juliap.5375
      @juliap.5375 6 หลายเดือนก่อน

      Weeks? 😮 for that time it is possibly to write own layer of graphics to replace whole godot for own code. And as result to spend 30 mins to write path-finding algorithm.

    • @cashewolddew
      @cashewolddew  6 หลายเดือนก่อน +1

      @@juliap.5375 While that might be possible for an experienced developer, I think it's important to encourage each other in the learning process.
      To be honest, I also had moments in my programmer journey in which I spent way more than I should have on a subject and I do not regret it, as it was a huge step towards honing my skills and becoming a better programmer. 🥜

  • @enachematei1926
    @enachematei1926 3 หลายเดือนก่อน +5

    I know it's a 7 month old video, but I just wanted to say THANK YOU.
    I've been spending hours on trying to figure out how to automatically detect which layers should be baked and which shouldn't be baked so that I dont have to manually set NavRegion points arounds all my objects. This was perfect, all the way through. Much love

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน +3

      I know it's a 7-month-old video, but I am still thrilled to get such amazing comments on it.
      This video is actually what got me started with Godot tutorials, and it holds a special place in my heart.
      So, in the same way, I just want to say: THANK YOU! 🥜

    • @enachematei1926
      @enachematei1926 3 หลายเดือนก่อน +1

      @@cashewolddew ❤keep at it, good content will get the recognition eventually, I for one will surely keep watching your videos.

  • @nahruz.w3044
    @nahruz.w3044 9 หลายเดือนก่อน +5

    I love the fact that youtube algorithm know what kind of game im making that by now, and got recommend your video.
    Thanks for uploading btw, hope you channel will grow bigger👍🏻

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน +2

      Thanks a lot for the support! 🥜

  • @reesensix9755
    @reesensix9755 9 หลายเดือนก่อน +3

    Thank you! I saw maybe 10 tutorial on how to make a pathfinding but no one of these tutorial is for godot 4.2. You saved my life

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน +2

      You are very welcome! :D

  • @adrianmankidiyan
    @adrianmankidiyan 3 หลายเดือนก่อน +2

    Bro the second I gave up on this, you pop up on my feed! THANK YOU SO MUCH!

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน +1

      Ha ha, I'm glad I appeared just in time! 🥜

  • @brett6759
    @brett6759 10 หลายเดือนก่อน +3

    Great video, I think you have a real talent for explaining clearly without dumbing it down too much. As is evident by the comments your content is appreciated. Good luck on your youtube journey.

  • @joederksen7441
    @joederksen7441 4 หลายเดือนก่อน +2

    Thanks for the awesome video, its well explained and clear, even for a beginner at godot with a few months experience. Remember for other beginners out there, usually the issue is between the keyboard and chair. thanks Cashew OldDew for taking the time to make these videos, it saves us from a lot of headscratching and hairloss !

    • @cashewolddew
      @cashewolddew  4 หลายเดือนก่อน +1

      Reading comments like yours brings me a lot of joy. The fact that I'm probably saving some people's time or even getting them a bit closer to releasing their game really motivates me to make more and better videos.
      Thanks a lot for this! 🥜

  • @Ryxbar
    @Ryxbar 6 หลายเดือนก่อน +3

    This was SO useful, and very well-explained. Great job, homie, and thank you!

    • @cashewolddew
      @cashewolddew  6 หลายเดือนก่อน +1

      Thanks a lot! 🥜

  • @focusedphoenixgames6700
    @focusedphoenixgames6700 6 หลายเดือนก่อน +1

    I've been struggling with this for a couple days now and your tutorial worked quite nicely!

    • @cashewolddew
      @cashewolddew  6 หลายเดือนก่อน +2

      Glad it helped! 🥜

  • @Inuzika
    @Inuzika 9 หลายเดือนก่อน +2

    what an extremely powerful tool, thanks for the major insight !

  • @jshxb14
    @jshxb14 11 หลายเดือนก่อน +2

    thank you so much for making this video. i was able to make a simple code for an enemy in my game project ❤

  • @Erfan_Al
    @Erfan_Al 11 หลายเดือนก่อน +3

    this video was actually quite useful for me... got a new sub! pls make more tutorials on godot tips & tricks!

    • @cashewolddew
      @cashewolddew  11 หลายเดือนก่อน +1

      Thank you for the kind words. Will make sure to do more ^^

  • @Ness_of_the_Abyss
    @Ness_of_the_Abyss 11 หลายเดือนก่อน +4

    Thanks this has been very useful. I've been using NavigationAgent's Avoidance cause didn't know how to bake the obstacles within the polygon heheh

  • @tsumoso
    @tsumoso 3 หลายเดือนก่อน +1

    ohhh, I didn't knew auto tilling, that's useful

  • @j-kevinampong1379
    @j-kevinampong1379 11 หลายเดือนก่อน +2

    Damn I learned a lot from this tutorial, you got my sub for sure and thank for the wonderful tutorial ❤

    • @cashewolddew
      @cashewolddew  11 หลายเดือนก่อน +2

      I'm happy to hear that! Thanks a lot! 🥜

  • @rml1203
    @rml1203 5 หลายเดือนก่อน +1

    That bake button stuck me forever.

    • @cashewolddew
      @cashewolddew  5 หลายเดือนก่อน +1

      Hope you are unstuck now! ^^

  • @benhurworth1499
    @benhurworth1499 5 หลายเดือนก่อน

    Thanks so much! Way more useful than the others. I have set Source geometry mode to "Group Explicit" and then added my TileMap and any trees etc to the "navigation_polygon_source_group". Seems it might be a bit nicer than them as a child maybe? Thanks again!

    • @cashewolddew
      @cashewolddew  5 หลายเดือนก่อน

      Thanks for letting me know the video helped you! At the time of making it I was not aware that you could specify the source_group, but you're right, it's much cleaner that way.
      Thanks for letting others know about this! 🥜

  • @martinithechobit
    @martinithechobit 11 หลายเดือนก่อน +1

    Thank you. I have issues as well with the latest build.

    • @cashewolddew
      @cashewolddew  11 หลายเดือนก่อน +1

      Ha ha, it's better if we struggle together 😅

  • @Someone-tc4wu
    @Someone-tc4wu 9 หลายเดือนก่อน

    Very helpful and well explained!

  • @HampterLover985
    @HampterLover985 11 หลายเดือนก่อน +2

    This was super helpful, thanks!
    Though it would be nice if it considered all layers of the tilemap and not just the top most one ;P

    • @cashewolddew
      @cashewolddew  11 หลายเดือนก่อน +3

      Ha ha, I know what you mean! I also thought the same thing, especially since the 'layer 0' detail can be easily overlooked. However, the good news is that they have in plan to adjust this eventually: github.com/godotengine/godot/pull/80796#issuecomment-1689234510
      I'm happy I was able to help you! 🥜

  • @Korn1holio
    @Korn1holio 9 หลายเดือนก่อน +1

    Thank you very much for the tutorial. I must say though, that the Tilemap + Navigation integration looks really poor as of now - lots of unintuitive actions are required.

  • @darkcatsup1323
    @darkcatsup1323 10 หลายเดือนก่อน

    Really need this one, thanks!

  • @Viktor-xp2su
    @Viktor-xp2su 24 วันที่ผ่านมา

    Thank you so much for this guide! My friends and I are developing a game and have been trying to figure out navigation for a week now. You've been very helpful. How would you like me to mention you in the credits?
    P.S. - I apologize for possibly misspelling some words. I don't know English very well.

    • @cashewolddew
      @cashewolddew  24 วันที่ผ่านมา

      Woah, I would be honored to be in your credits! Cashew OldDew is fine!
      I'd love to hear from you once the game is finished 🥜

  • @signoraw
    @signoraw 11 หลายเดือนก่อน +1

    Thank you so much!

  • @吴鑫杰-k6n
    @吴鑫杰-k6n 9 หลายเดือนก่อน

    谢谢,讲得很清晰

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน

      不客气 🥜

  • @philly2548
    @philly2548 10 หลายเดือนก่อน +1

    Please tell me that this is going to be an ongoing series...your tutorials are so helpf

    • @cashewolddew
      @cashewolddew  10 หลายเดือนก่อน

      I'm really happy to hear your feedback! I want to make more tutorials. I actually added one just yesterday 🥜

  • @danielhuayta4434
    @danielhuayta4434 8 หลายเดือนก่อน

    u are my hero, TYVM

  • @alekseydanchin
    @alekseydanchin 4 หลายเดือนก่อน

    Very well! Thanks )

  • @abradotcs
    @abradotcs 11 หลายเดือนก่อน +2

    Cool!

  • @iakobs
    @iakobs 10 หลายเดือนก่อน

    Hey! very helpful video, thanks a lot! Do you really need the NavigationRegion, though? If I'm using a navigation layer painted into my tiles, that's also working fine for me.

    • @cashewolddew
      @cashewolddew  10 หลายเดือนก่อน

      Thanks for the kind words! Were you using multiple layers while designing your tilemap? At the moment of making the video I had some problems making it work with the navigation layer of the tiles.
      I'd be glad to find out there's a better way of doing this! Thanks for letting me know. I will explore it more!

    • @iakobs
      @iakobs 10 หลายเดือนก่อน

      @@cashewolddew I'm actually having problems with layers, but as far as I keep all navigation tiles in layer 0 of the tilemap, it looks like it's working. I'm now struggling to make the agent follow the path "more strictely" but I think that's just a configuration problem. Reading through the docs right now :)

    • @cashewolddew
      @cashewolddew  10 หลายเดือนก่อน

      @@iakobs If what you're looking for is a way to strictly follow a Tilemap grid, I also touched that subject in this video: th-cam.com/video/OMrDS0zlr-k/w-d-xo.html

    • @iakobs
      @iakobs 10 หลายเดือนก่อน

      @@cashewolddew you're god tier! thanks!

  • @lwl3788
    @lwl3788 11 หลายเดือนก่อน

    Sensei! Thanks

  • @betterine
    @betterine 10 หลายเดือนก่อน

    Brilliant tutorial! Wonderfully explained. Only one issue - it seems the collision between the enemies and the fence doesn't work. In other words something seems to be going wrong with layers that you mentioned at the 15:00 mark. Any thoughts why this might happen?

    • @cashewolddew
      @cashewolddew  10 หลายเดือนก่อน

      Thank you for the kind words! Have you made sure that the collisions are in layer 0? Currently, it only works that way. See 16:44 and this github.com/godotengine/godot/pull/80796#:~:text=TileMap%20navigation%20mesh%20baking. Hope it helps you!

  • @dlandsvolka4046
    @dlandsvolka4046 8 หลายเดือนก่อน

    nice tutorial

  • @freiaz494
    @freiaz494 3 หลายเดือนก่อน

    This was really useful, but I have a question: Can the enemy or "seeker" have a threshold between the collision on the tilemap? I mean, to not touch it if possible. For example, if I want to avoid an enemy to get really close to the walls but in case that there is no other way to go allow it to get closer

    • @freiaz494
      @freiaz494 3 หลายเดือนก่อน

      I think in that way it would look more natural

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน

      Sorry for the late response.. Godot supports agent avoidance which would allow the behavior you describe between an enemy and your character. docs.godotengine.org/en/4.0/tutorials/navigation/navigation_using_agent_avoidance.html
      I also have another video on pathfinding which also covers that. Hope this helps: th-cam.com/video/yT22SXYpoYM/w-d-xo.htmlsi=u73oSTMn8h_Lt2tq&t=875

    • @freiaz494
      @freiaz494 3 หลายเดือนก่อน

      @@cashewolddew I already made a system of steering behaviors, but thanks tho, your tutorial was really useful to begin with

  • @k4gi
    @k4gi 11 หลายเดือนก่อน

    thank you :)

  • @FelinaFaerlaingal
    @FelinaFaerlaingal 7 หลายเดือนก่อน

    I got most of it to work, except one thing: when I bake the navigation with a polygon that surround my tilemap (it's a dungeon tilemap, so I drew the rooms and I want to navigate inside them) it generate traversable zones Outside the rooms. The rooms are not covered in blue at all. I don't understand how to tell it to also calculate the inside of the rooms. I did the navigation layer of the tilemap, selecting all the inside bits of the tiles to mark them as navigable spaces.
    I dunno if I'm super clear, I can send some screenshots maybe?

    • @cashewolddew
      @cashewolddew  7 หลายเดือนก่อน

      What you wrote is actually very clear. Great job!
      To be honest, I never tried generating a navigation area on an enclosed region. I'll have to try it out myself before I can say for sure.

    • @cashewolddew
      @cashewolddew  7 หลายเดือนก่อน

      ACTUALLY, I remember now that I did that. I did it in the video at the 19:39 minute. As you can see, the area is enclosed, but the navigation area is generated.
      One thing to bear in mind is the order in which you draw the nodes. For example, here github.com/godotengine/godot/pull/80796#issuecomment-1721091034 someone said that regions weren't properly drawn when putting the region nodes in a Clock-wise order. Try putting them counter clock-wise.
      Hope this helped! 🥜

  • @The_K1tten_Earter
    @The_K1tten_Earter 11 หลายเดือนก่อน +1

    Is it possibe to do this while using a moving KinematicBody2D as the obstacle?

    • @cashewolddew
      @cashewolddew  11 หลายเดือนก่อน +1

      If you're thinking about navigation polygon recalculation based on the position of the KinematicBody2D at runtime, you can bake it with the bake_navigation_polygon method: docs.godotengine.org/en/latest/classes/class_navigationregion2d.html#class-navigationregion2d-method-bake-navigation-polygon However, I'm not sure if this would be the best solution for your problem

  • @dailyfunnytv358
    @dailyfunnytv358 9 หลายเดือนก่อน

    can you bake programatically? so that we can do dynamic tilemap editing for positioning walls or breaking blocks

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน

      I saw a similar question recently. If you have the polygon set, you can bake it with the bake_navigation_polygon() method. See more here for other functions you might need: docs.godotengine.org/en/stable/classes/class_navigationregion2d.html#class-navigationregion2d-method-bake-navigation-polygon
      However, if you want to be able to do pathfinding easier, in case you are working with a precise tilemap, you could use Astargrid2D. I also have a pretty recent video covering that topic.

  • @goncalocascais
    @goncalocascais 6 หลายเดือนก่อน

    the idea behind the video works flawlessly, but I have an issue. On my testing project I have a layer for walls and another for decorations (that have collision shapes as well) and right now I can only get the pathfinding to work when setting the walls to the top spot of the layers (as the video explains and this works flawlessly). The issue comes when I want to have pathfinding to take into consideration the objects that are scattered around the map as well. Right now, my enemies get stuck on this objects. Is there any workaround for this? Great video btw mate :)

    • @cashewolddew
      @cashewolddew  6 หลายเดือนก่อน +1

      Indeed, as you noticed, this is currently a limitation. I heard there will be some more features coming regarding pathfinding and Tilemaps in Godot 4.3. However, until then, maybe you could try finding all elements on that layer and remove the navigation from there? I did a similar trick in this video: th-cam.com/video/yT22SXYpoYM/w-d-xo.html
      Hope this helps you!

    • @goncalocascais
      @goncalocascais 6 หลายเดือนก่อน

      @@cashewolddew Thanks for the video, ill give it a look! and tysm for the quick answer, as someone who is brand new to gamedev its videos like this that make or break my newbie experience ❤

    • @goncalocascais
      @goncalocascais 6 หลายเดือนก่อน

      @@cashewolddew IT WORKED! This is an amazing workaround and seems to work flawlessly. On your example you used code on the tilemap for just one layer, but I can add as many layers as I want to it just by using "or"
      if coords in get_used_cells_by_id(2) or coords in get_used_cells_by_id(1):
      this is line 4 at 23m32s on the other video!
      its working flawlessly now tysm :D

    • @cashewolddew
      @cashewolddew  6 หลายเดือนก่อน

      @@goncalocascais I'm very happy you did it! Hopefully these comments will also help others. 🥜

  • @robinvandervegt3422
    @robinvandervegt3422 9 หลายเดือนก่อน

    Thanks , the only problem I have is that I have a moving obstacle2d but it doesn’t get avoided (and yes it is enabled and good layers and masks) any tips?

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน

      My guess is that the obstacle does not get avoided because the area does not get recalculated based on the new position of the obstacle at each frame. There are ways to programmatically regenerate the NavigationArea2D, but it's to be seen in practice how much that would affect your performance.
      Another possibility would be to have a different functionality for the avoidance of the moving obstacle. For example, I'm thinking you could have an Area2D on your obstacle and when your character enters that area runs a script which makes it move away from the obstacle.
      I haven't tested these yet, but they should be good starting points. I'm sure that you'll manage to find a solution after some exploring!
      Hope that helps! 🥜 ^_^

  • @noise_dev
    @noise_dev 6 หลายเดือนก่อน

    Dude your tutorial is great and I thought I can use it with an issue I am facing in my project but unfortunately not. Either way maybe you know how I could face my problem?
    I have an issue with the navigation agent.
    I have created an enemy node, added a navigation agent node to it, set up everything and the enemy is chasing the player which is making everything work 90% good. The 10% is that it is getting stuck on trees in the map.
    My map has 2 layers:
    1st, the base one is grass or a walkable surface where I have added a navigation layer for the nav agent
    2nd layer is set on top of the 1st layer and those are different obstacles like for example trees.
    Can I somehow define in the navigation agent to avoid the second layer when calculating the path?
    My map has trees with defined collisions and my navigation agent has avoidance set for the same layers as tree collisions. No idea why it doesn't work as desired. I think I can't add navigation area to my enemy node becouse I am planning to make my maps randomly generated so i just prefer to trigger navigation and chase player around as long as he is in the chase proximity of my enemy.
    Any idea how or what I could do? Discord is not helping this time 😢

    • @cashewolddew
      @cashewolddew  6 หลายเดือนก่อน +1

      Are you using NavigationObstacles docs.godotengine.org/en/4.0/tutorials/navigation/navigation_using_navigationobstacles.html for avoidance? That could help.
      Otherwise, if the trees do not move (I hope trees don't move 😀), maybe you could define them in a similar fashion to what I did for the fence in this tutorial.
      Hope this helps at least a bit!

    • @noise_dev
      @noise_dev 6 หลายเดือนก่อน

      @@cashewolddew I will check navigationobstacles and if not I will just use your solution :) thanks for the reply man

    • @noise_dev
      @noise_dev 6 หลายเดือนก่อน

      @@cashewolddew oh god. I am blind :D Seems like I haven't payed too much attention to your description but now I see that exactly this is what I need and this is the best suitable idea for me! Hours wasted because of my lack of attention :D Thanks for this video!

    • @cashewolddew
      @cashewolddew  6 หลายเดือนก่อน

      @@noise_dev Happens to the best of us! 😄

  • @zbyszggo4626
    @zbyszggo4626 2 หลายเดือนก่อน

    I make the same thing but enemy is stuck on obstacle but navigarionregion2d is not baking to new shape, any idea?

    • @cashewolddew
      @cashewolddew  2 หลายเดือนก่อน

      If you're using a Tilemap you can solve this issue by excluding the tiles from the navigation baking. I have a video in which I do precisely that: th-cam.com/video/yT22SXYpoYM/w-d-xo.html
      Hope it helps! 🥜

    • @zbyszggo4626
      @zbyszggo4626 2 หลายเดือนก่อน

      @@cashewolddew OMG you just saved at least 4 hours of pain in my a**. Thanks for help and quick replay

  • @Dmitriy15486
    @Dmitriy15486 9 หลายเดือนก่อน

    Hi, friend! Tell me, why when the enemy reaches the goal, he does not stop, but trembles? How can this be resolved using pathfinding settings?

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน +1

      This generally happens because the pathfinding nodes are trying to generate closer and closer to your target, never quite reaching it.
      One way to avoid this would be adding a threshold which, once reached, stops the enemy (or swaps it from moving to attacking state). You can achieve that with 'distance_to'. If the distance from the enemy to your character is less than a set threshold (say, 10 units), then you simply don't run the pathfinding code anymore.
      Here's the same question asked by someone. forum.godotengine.org/t/how-do-i-stop-nodes-from-shaking-with-navigationagent2d/102/2
      Hope this helps! ^_^

  • @paulkoch7439
    @paulkoch7439 10 หลายเดือนก่อน

    Any idea how to bake the NavigationRegion2D at runtime?

    • @cashewolddew
      @cashewolddew  10 หลายเดือนก่อน +2

      If you have the polygon set, you can bake it with the bake_navigation_polygon() method. See more here for other functions you might need: docs.godotengine.org/en/stable/classes/class_navigationregion2d.html#class-navigationregion2d-method-bake-navigation-polygon

  • @The_Soup_Wizard
    @The_Soup_Wizard 9 หลายเดือนก่อน

    I'm using a CharacterBody2D as the target instead and every time I save the scene it erases "target" from the inspector to the side and navigation doesn't work. It's still exported in the script. Is there something wrong with using CharacterBody2D as the target?
    Edit: I don't know for sure that this was the issue, but I use VS code as an external editor and I switched from 4.1 to 4.2 for the nav updates. Something was going on where Godot had the old enemy script within the editor but VS code had the updated script. Somehow it was mixing everything up between the 2 and when saving it would read the script from the internal editor rather than the external. So stupid and unnecessary.

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน

      I'm happy you quickly found a fix. Good job! 🥜

  • @pichitosmalltown3239
    @pichitosmalltown3239 10 หลายเดือนก่อน

    how would you go about using navigation regions with an automatically generated world?

    • @cashewolddew
      @cashewolddew  10 หลายเดือนก่อน +1

      I think I would look for a way to dynamically bake the map once it is generated.
      I see in the docs that there is a bake_navigation_polygon method which could be called in your scripts: docs.godotengine.org/en/stable/classes/class_navigationregion2d.html#class-navigationregion2d-method-bake-navigation-polygon

  • @deakattila
    @deakattila 8 หลายเดือนก่อน

    Is it possible to do all this from code? What I want to do is to spawn a lot of enemys continuously, automatically get the path to travel on , and when they reach the destination they despawn

    • @cashewolddew
      @cashewolddew  8 หลายเดือนก่อน

      If you do not mind making them follow a grid, I have a video which does the most functionality from code: th-cam.com/video/OMrDS0zlr-k/w-d-xo.html
      However, if you want to keep the same behavior as in this video, then most of the documentation for navigation can be found under: docs.godotengine.org/en/stable/tutorials/navigation/navigation_introduction_2d.html or in the description of this video. There are usually code equivalents for all possible actions done in the editor. Let me know if you need help with anything! 🥜

    • @deakattila
      @deakattila 8 หลายเดือนก่อน

      ​@@cashewolddew Thank you, I will watch your video. I only started working in Godot yesterday, so I only know a few things. And I have never worked in any game engine before. So if I'm stuck, I just look up videos and find a proper tutorial for it.

    • @cashewolddew
      @cashewolddew  8 หลายเดือนก่อน

      @@deakattila It's so great to hear that you started with this. It might not always be easy, but make sure to keep it up and you'll manage to make good games!

  • @Limited_Film_Works_
    @Limited_Film_Works_ 9 หลายเดือนก่อน

    isn't delta applied automatically in the move and slide function? I wonder if it's necesary to apply that to velocity when moving the enemy

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน +1

      You are correct! move_and_slide does take delta into account so having it in our calculations doesn't make sense. Thanks for pointing that out. This shouldn't affect the overall scope of the tutorial, but I'll make sure to that watchers aware of that error.

    • @Limited_Film_Works_
      @Limited_Film_Works_ 9 หลายเดือนก่อน

      @@cashewolddew I mean, yeah. I'm telling you because I used to do it. I've been enjoying watching your videos, man. Keep it up.

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน +1

      @@Limited_Film_Works_ Really appreciate it!

  • @dreadge
    @dreadge 9 หลายเดือนก่อน

    is there a way to make the pathfinding avoid open areas and be restricted to near walls?

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน

      I'm not really sure what you mean by open areas, but if you want to follow the path close to the walls, there is a neat setting a NavigationAgent2D has for path post processing: docs.godotengine.org/en/stable/classes/class_navigationpathqueryparameters2d.html#enum-navigationpathqueryparameters2d-pathpostprocessing

    • @dreadge
      @dreadge 9 หลายเดือนก่อน

      im trying to make a wall crawler type pathfinding@@cashewolddew

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน

      @@dreadgeIn such a case I would define his walkable area to only be the walls

  • @raidev_
    @raidev_ 10 หลายเดือนก่อน

    why would it require the collision to be in layer 0 and the region to be the parent of the tilemap? It's so arbitrary and implanting this would break my game

    • @cashewolddew
      @cashewolddew  10 หลายเดือนก่อน +1

      There also is an option to have the tilemap added to a group and then specify the group in the Geometry Source Group Name field of a navigation polygon from a navigation region 2d. Regarding layer 0, from the discussions I attached in the description, it looks like it is subject to change later on, but for now, that's how it is, sadly.

  • @Korn1holio
    @Korn1holio 9 หลายเดือนก่อน

    Another thing I wonder, why did you to go through all the steps of using a "NavigationRegion2D", when you could simply create a navigation layer in the Tileset, and add all walkable tiles to it? It works so much simpler, and you don't need to parent the Tilemap to the Region, Bake navigation etc. Or I am missing something?

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน +1

      That's actually the whole reason I made the tutorial. I expected things to work a simple as you wrote here: Put a navigation layer into the Tileset, add all walkable tiles to it. However, this was not the case. I think I spent a week or so looking for a reasonable explanation or alternative.
      After I managed to come up with a solution, I wanted to show it to others so they don't have to go through the same pain 🥜
      However, I could revisit the topic in a future video if things get simplified or changed.

    • @Korn1holio
      @Korn1holio 9 หลายเดือนก่อน

      @@cashewolddew thank you for the response. Maybe I'm mistaken. But navigation absolutely works for me without NavRegion or baking. Here's my enemy code (as mentioned, the Tileset has the walkable tiles added to the navigation layer, of course):
      extends CharacterBody2D
      @export var speed := 50
      @export var nav_agent : NavigationAgent2D
      var target : Node2D
      var home_position : Vector2
      func _ready():
      nav_agent = $NavigationAgent2D
      home_position = self.global_position
      nav_agent.path_desired_distance = 4
      nav_agent.target_desired_distance = 4
      func _physics_process(_delta):
      if nav_agent.is_navigation_finished():
      return
      var axis = to_local(nav_agent.get_next_path_position()).normalized()
      velocity = axis * speed
      move_and_slide()
      func recalculate_path():
      if target:
      nav_agent.target_position = target.global_position
      else:
      nav_agent.target_position = home_position
      func _on_recalculate_timer_timeout():
      recalculate_path()

    • @Korn1holio
      @Korn1holio 9 หลายเดือนก่อน

      @@cashewolddew I see. I've dug into the problem a bit deeper and... looks like one can totally make Navigation work with just a navigation layer, however you won't be able to use layered tilemaps, which is obviously unacceptable. So only single layered tilemaps are supported without baking... too bad. Which is, incidentally, what you've already written in the video description, I should have been more attentive :)

    • @cashewolddew
      @cashewolddew  9 หลายเดือนก่อน +1

      @@Korn1holio No worries! You did great by writing about it. If there are better or more ways to do things I'm really happy to find out about them.

    • @Korn1holio
      @Korn1holio 9 หลายเดือนก่อน

      @@cashewolddew thanks! Yes, I am looking for more ways to do it, since the approach with NavRegion2D, while definitely working, looks a bit too 'manual' or complex to implement for procedurally generated or streamed tilemaps. Will post any updates.

  • @JuddGledhill
    @JuddGledhill 7 หลายเดือนก่อน

    I think I am a bit lost. I thought you could do all the navigation in the tilemap instead of needing that additional region node to make it all come together. Is that incorrect?

    • @cashewolddew
      @cashewolddew  7 หลายเดือนก่อน

      I thought the same thing, especially since a Tilemap has navigation layers. However, when I tried to do exactly that I stumbled upon a lot of troubles.
      This was actually the reason I made this video. I tried so hard to make things work that I didn't want anyone to go through that again :D
      I added some notes in the description regarding those issues and some discussion on Github. I'm actively checking this and if I find that an issue is fixed or that I was not doing something properly, I'll make sure to come with an update!

    • @JuddGledhill
      @JuddGledhill 7 หลายเดือนก่อน

      Wow. So what do those navigation layers do in the tile map..?

    • @JuddGledhill
      @JuddGledhill 7 หลายเดือนก่อน

      @@cashewolddew I am working on something now and the stars aligned. I am using the tilemap with nav layers and it is working! If you want it, I can share. LMK.

    • @cashewolddew
      @cashewolddew  7 หลายเดือนก่อน

      @@JuddGledhill I'd be really interested to know. Please write to me on any of my social media!
      Thanks!

    • @nameisnotdan
      @nameisnotdan 7 หลายเดือนก่อน

      ​@@JuddGledhill I'd also be interested. Was attempting to learn and use the navigation layers, struggled a bit, learned Godot 4.2 added some changes, and am now in a rabbit hole lol.
      This video is great, btw. Thank you.

  • @vader9133
    @vader9133 11 หลายเดือนก่อน

    For some reason Godot 4 doesn't work with my Nvidia graphics card. Do any of these features not exist in versions before 4.0

    • @cashewolddew
      @cashewolddew  11 หลายเดือนก่อน

      If I remember well, tilemap layers were not a thing in godot 3.x. This would probably imply that the navigation baking for the tilemap does not work as well, as there would be no concept of 'layer 0' without layers.
      I hope you get the Nvidia graphics problems fixed. I'm not sure if it would help, but try checking that you also have the latest drivers for your graphics card.

    • @customdevvv
      @customdevvv 11 หลายเดือนก่อน

      Try updating your drivers, that worked for me atleast

  • @martinithechobit
    @martinithechobit 11 หลายเดือนก่อน

    My baking does not always bake close enough.

    • @cashewolddew
      @cashewolddew  10 หลายเดือนก่อน +1

      Hello! Sorry for missing your comment. What do you mean by that? Is the generated region too small? Try checking if making the navigation polygon larger would help.

    • @martinithechobit
      @martinithechobit 10 หลายเดือนก่อน

      @cashewolddew yes yes the generated region is always smaller than the area I selected. But I got it now thanks.

  • @nibir4878
    @nibir4878 3 หลายเดือนก่อน

    Bro make your video fast😂 (7-13m)
    It’s too long
    (IT will be so helpful if u make shot videos thank you)

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน

      Thank you for the feedback! I am looking to condense the videos a little in the future in order to have them be easier to watch.