ATTBT Basics #4 Height

September 28, 2024

hey everyone so in this video I will be talking about height maps so how we can get the grid manager to take into account the height of the various tiles and meshes placed in the grid area so if we check the properties of the grid manager and scroll down we can find this procedure all set up here where we have height map setup we can also see that trace four walls is set up to true as per the last tutorial and crisper walls so and you have three options here for height maps yeah false one level and multi levels so false is what I've been showing in the videos till now and what this means is that the grid manager just assumes by default that every tile and within this range that we set up within 12 tiles should be added to the grid as locations and and unless we do something to remove them from the grid like adding and a tireless that block movement to them or so on so at the moment we have a flat grid here so if we set this to one level or multi-level or anything then there will not be any changes since it's a flat grid right and so when you go from false and to one level you will see that this box appears around the grid and this box it shows the area in which the grid manager will attempt to look for tiles what is meant by tiles here then or any meshes or anything else that blocks the path trace collision channel so if height map is set to one level this means that the grid manager will try to trace a line trace down from the top of this bounding box to the bottom of this box and anything that it hits will be added as a grid location we can change the bounding box here through the max and minimum grid height so we can see here that we go from a height of a thousand and until a minimum grid height of zero it is possible to go below zero and I will show that later so let's see how this works I can add a cube again to the grid and resize it here and this as I've said in previous tutorials if I find the collision the default for meshes is to block path trace so it should block this line trace that we used to set up the various grid locations so now that the height map is set to one level we should be able to walk on top of this tile and we can so that works great however if we choose where we set up another one which we make a lot taller you will see that we cannot move on top of this tile and this is because of how we have set it up in the procedural settings here which is the height in impassible cut off and this is the cut off in unreal units at which point that will get will say that a difference in height between two tiles is too great and the edge between between them will be removed so we can change this to something much higher like five hundred and I will change this as well I will talk about this shortly and that was not enough let's add some more hmm ah I know what is going on so this might be instructive so I'll leave this in and since we're tracing four walls here and we are tracing then from the center of a tile to the center of another tile and at this trace four walls height so it goes 100 unreal units above this and tries to trace to the center of the tile adjacent to it and this cuts through this corner here because the difference in height is so great so if we turned this off and then we are able to move on top of this but yeah this will really be an issue since I don't assume people to want to have this these large height differences but if you do in your game and you need both just ask me on the forums how to tweak it and I'll let you know but yeah for any reasonable height that will not be an issue this height difference is relative to the tiles that are next to it so if we inked and set it to 115 yeah then we can see so we can move into this tile we can't move directly down to the others but we can move through this other time there are reasons you might want to use height maps at one level even if your grid is flat and this is if you have sort of a sparsely populated grid let's see if you're making a dungeon or something like that so to set up an example actually before I start doing that lets let me show a handy trick if you go to edit and edit your preferences you can change the various grid snapping settings in the editor so if I go here and I search for grids we will find yea that there are decimal grid sizes here and we can add another one which is the size of our tiles which by default is 200 so I can add one that is 200 and drag this into place now we should be able to yeah we can choose 200 I see a snap size here so this is useful if you're working on a square grid and you're placing actors that are not you know tiles or units that automatically snap or in any case it might be useful for exactly no grids you will of course not be able to use this feature though and but yeah so then we can place easily these meshes at the center of tiles so let's build a mini dungeon we will resize this a bit there that's nice and just make a couple of rooms like this and we can have like a path between them oops let's see something like this and now we can walk on top of them now of course we can still move on the rest of the grid here so this doesn't really do much but we can then disable walkability on this grid so if we turn off collision plain workable now our entire playable space is really within this little two room setup here but we can still see all of these tiles of course we can just turn off let's see yeah so default tile and now this is our entire playable area we can do some more work here maybe turn this into I could let the stair here and now we can walk up but if we go the other way let's see it might still be within the bounds okay if I choose all of these and I move them down a bit let's see you can see that I'm not able to move down here and this is because these meshes now are below the bounds that we've set up but we can always change that so if we go here to the minimum grid Heights I'm gonna change this to minus 400 and now we can see that we can move even below the height that the grid manager is placed at we can visualize how the grid manager looks for tiles by going into the grid manager and let's see in the event graph here again we still have the set up grid arrays in the beginning and here it creates grid locations and here you have three different types depending on which height map we're using at the moment we're using one level so we can see here that we're tracing then from the top of the grid or this defined box to the bottom and we can display this line trace so that we can see it during gameplay and you can see want a trace going from the very top of this box here and looking for it until it reaches the bottom here if it ever hits any or anything that blocks path trace on the way it adds that grid location to the grid as we can see it does here what happens if we play something above here though if I take this and I drag this up to create like a roof and if we try playing now we can see that we can no longer move below this we have you can see that we can reach this by shooting but yet we can't move on to it because now these tiles are blocked by these measures up here so to make this work we need to have multi-level grids or if you're just using like a cosmetic roof so this is not supposed to be work walked on you can just turn off collision and again you'll be fine let's see let's turn off this trace debug display but say you want both of these to be walkable and then we reset this back to normal and then if we select our grid manager and we go to multi-level we will see oops nothing hmm what happened here oh yeah more informative mistakes during testing earlier I changed this value so let's set it back to default this is the height between levels so this is when we're generating the multi-level grid and any tile that it is found it traces our words to see if it has at least this space between itself and the roof above it so this was set way too high at the moment this is the level between the minimum level that has been to be between one tile and a tile above or below it so the default is set to 200 as we now try we should be able to move below it yeah great and it should also be possible now to move up to this level here provided we have some form of access so we can go to let's see geometry and not a stair why not and let's see there like this then the number of steps let's see yeah now we are able to walk to the top and we can walk below again and I can change the move of this guy to make it clear that we can access both at the same time so if we change to move to 20 we can see it is possible to move both up here and to the level below a problem of course is that this roof area secluding the tiles below so it's pretty awkward to be able to move to these tiles here so there's a built-in way you can fix this problem if we search for a platform there is an actor called platform which turns translucent if you have zoomed a certain distance and this is a child actor that's just a larger platform so we can place this and move it up like so let's see a bit to the side yeah and we can see now we can move on top of this and if we want to move below we can zoom in and then we can access the tiles below we are still included though by the markers here on top and this also looks a bit weird with the stairs here so if you have a map where you are have X landed places you can stand and so on so these tiles don't look good on your map it's possible to change these markers for decals so you can choose the grid manager and it's just for decal and if we check Hugh's decals we can now see that these conform to the mesh here and they also disappear if you zoom through them so that's useful decals are also useful if we're using landscapes so if we add a landscape here just a small one you can use the grass texture included in the toolkit and create here's the landscape let's add some bumps here and there and then back into select mode there we are so now we have a landscape so like I've said something that blocks paths tres doesn't need to be a simple static mesh it could be something like a landscape so if we now hit play we see that we can move on top of this landscape and the unit will move as appropriate on the curved landscape below and the reason we see the borders here is of course that's where we've decided to find the area of the grid so we can increase the size of the grid manager to something larger so we can move on a larger area so there are a couple more options that I haven't mentioned if we go to the grid manager in the procedural options here so we have this Auto Edge cost based on height this sets the costs between adjacent tiles based on the height difference between them so that's what what means that they can't be moved between if they are a certain height apart but this cannot be disabled if it's multi level because it's that's a part of how my multi level grids are set up if it's one level or false this can be disabled if we want to and then there's this height slow increment so you have an impassable cutoff this is the height between adjacent tiles at which you can no longer move between them well the slow increment it decides how much extra movement it costs to move between tiles that are a certain height apart so if you set this to be 75 that means that the difference between these tiles is lower than 75 that the cost is one to move between them if it's Hardware between 75 150 then it is - if it's 150 then it's impassable if we increase this then it would be no 0 to 75 it costs of 175 to 150 a cost of 250 to 225 a cost of 3 to move between them and so on and so that's something I added when I first made this tool kit I don't know if many people actually use that function I don't know what any games that apply movement costs between tiles in that way but yeah there you have it in case you're the one person who needs that feature ok I think that will do it for this video thanks for watching


Profile picture

Written by Urakaiketsuya , just a guy who codes. You should follow them on Twitter