Quick Godot Tips: Gridmaps and Navigation Nodes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello you glorious gotta be people yan here from canopy games with a really quick tip to do with grid maps now if you don't know what a grid map is grid map is godo's 3d version of tile maps and they are awesome although they can be a little fiddly to use in this video i'm going to talk about how to set up navigation nodes to work with grid maps because it's actually very simple but i keep forgetting how to do it so by recording this video i'll remember i've made a ridiculously simple little cube character made him glow so that we can really see them and i've just put in a simple script that's going to use that's going to use make simple path to use a navigation node which i'm going to set as the direct parent of this character in a moment to move through a level okay this is not a tutorial on how to use navigation nodes if you want to know how to use those you can go into the documentation go to navigation node and click on it and the methods you need are in here it's very simple but out of scope for this what i'm going to do is i'm going to make a very simple grid map i'm using the canopy games dungeon kit i'm not trying to advertise it just when i've got handy and let's make a ridiculously simple dungeon i'm just going to put a floor corridor and a floor and let's put in some walls and floors just uh walls and doorways rather just to make this nice and easy as you can see grid maps are really really great for making quick levels okay so we have a very simple level i'm also going to put a camera in here so we can actually see the level when it's running and let's just drag that nice and high go to preview mode uh that's actually not bad is it a little bit higher and a little bit closer we should be able to see most of it from here and we probably don't need that and let's go uh zero on the x 30 on the x should be not 20 on the x great that's exactly where we want to be okay so we have our camera we have our grid map i'm not gonna make this look pretty let's just make this work first i'm gonna do i'm bringing my navigation mesh my navigation node rather then i'm gonna bring in my navigation mesh navigation mesh instance okay i wanna instance my character uh because of the way of my script the character wants to be a child of navigation just makes things simpler and now i want to create this in that measurement over the nav mesh and create navigation mesh so this is exactly as you would do it with any other 3d scene let's also have a place where we're going so i'm going to make a position 3d node just so i can have a place and you know let's put this up in the corner right here i'll call you target and i'm going to make sure that my node path and my target is pointing to the right place so the character knows where it's supposed to go so how do we get a grid map to work with this and the answer is amazingly easily you see normally we would put our level as a child of navigation mesh instance so let's do that let's take dungeon grid grid map and drop it in there go back to my navigation mesh and bake it i'm just going to tweak it a little bit so we don't get caught on corners i don't imagine we will do right now but just in case someone click on the navigation go to agent and assume we have a radius of one meter re-bake it and it's a little bit narrow around the doorways and let's run that see how we go and we're moving we're moving very slowly so i'm actually going to speed my character up a bit let's give you a speed of 15. try that one more time bro okay so this is not that impressive but what if we decide we want a more complicated level well we're using a grid map so this should be nice and simple right let's go this way and then turn this way and go this way you know what we're going to make this a little bit of a choice i'm going to put this floor right here so let's uh there we go put a floor right here and a doorway and a couple of walls okay camera how are you doing with being able to see things let's take a look preview not great so let's just move our camera to be like this let's see minus 90 on x how's the preview uh yeah we're almost in position aren't we so let's just go a little bit further on the z-axis a little bit further on the x and make ourselves a nice top-down adventure okay one more thing i'll do i'm going to move my target so target you now live over here and go back into my my navigation mesh instance re-bake it and we now have the entire map and i can run this level and my npc can navigate the navigation mesh just fine there's a lot of settings you can play with i do recommend you know tweaking the navigation mesh instance and your pathfinding and your ai to work with it this is a very very quick and dirty thing and if i go back into my grid map and let's say i'm going to change this corridor so you are now blocked off and you are now a wall and i rebake my navigation and one more time with feeling and we now have yet another completely viable map look at that i hope that helped do check our website on canopy.games if you want more free tips as well as our paid courses and our asset packs i hope you enjoyed it and i will see you very soon
Info
Channel: Canopy Games
Views: 13,299
Rating: undefined out of 5
Keywords:
Id: 4VRut0D9dXo
Channel Id: undefined
Length: 6min 1sec (361 seconds)
Published: Fri May 07 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.