love the video. you talked about changing the find closest tile system in the video. i found that if i you convert the coordinates to "Grid Coordinates" it makes it much easier to find the closest tile. the way to do so is to get the player X and Y position divide it by Tile Size (size of each tile), floor it and then multiply the Y with the Grid size (ammount of tiles you have) and then add the Y position. If you have a offset in the video then you need to do Grid Size * Tile size / 2 and add that to the players X and Y position before you floor it. This will give you the Array index. The following simplified formula should explain how it works. TileIndex = Floor((PlayerWorldPositionY + HalfGridDimension) / TileSize) * GridDimension + Floor((PlayerWorldPositionX + HalfGridDimension) / TileSize)
@mpattym2 жыл бұрын
Personally I would use a map for storing grid cells where the Key is an Int Point. The key itself would also represent a normalized location of where the cell is in the world. 3,6 being 300, 600 for example. This simplifies things so much and is easier to scale up. Each grid cell stores its own location and as you can imagine getting it's neighbors becomes as easy as adding or subtracting 1 on the x or y.
@IJCrothers6 ай бұрын
Hello Im racking my head against this trying to make minesweeper in U.E. Would you mind going into more detail or passing across any learning resources? Would be greatly appreciated as a bit stuck when it comes to selecting neighboring cells in a non janky way.
@joycelangman10 ай бұрын
I'm a bit late to the party, but at 31:21 you mention needing to get a ref instead of a copy, but if you look at the bottom right (It's more obvious on later versions) it's actually converted to a copy. There's no way to force it to do get (a ref). I assume since we're passing the actual actor around, it shouldn't matter because that's sort of a reference in itself, but I figured I'd point out that that was happening.
@tbunreall2 жыл бұрын
I don't know if you noticed, but unreal was changing your get ref back to a copy every single time lol
@Sparrow_of_Attrition Жыл бұрын
15:51 At this time stamp, I had to change the connection of Get from Target to Neighbour North and then pull the 'Array Element' from the 'For Each Loop' and plug that into the 'Target'. I did this because I was only getting three red dots, and this was the only difference I found amongst the other Neighbours.
@jared875 Жыл бұрын
Niice catch! TY
@flynngeddes7672 Жыл бұрын
thats why it was coming up with warnings and errors good catch
@SirMechlon3 жыл бұрын
Thank you very much! Got me in the right direction for my own grid implementation.
@hansknut22843 жыл бұрын
Awesome again:)!!!
@user-lj1qw5hv7l3 жыл бұрын
Im getting a Accessed None when trying to read North and East, and it always highlights the same 2 nodes never changes from the top right corner EDIT: Fixed 25:27 make sure you grab the variable array instead of off the for loop
@axlefoley63303 жыл бұрын
I'm getting the same error but for south & east. Now I am wondering which variable array & where are you talking about? because that time code you posted isn't that helpful. Cheers though. ::EDIT:: I managed to fix it the problem was I had nodes incorrectly connected or forgot a - (minus) node somewhere but it's all 100% now. Thanks for the videos!
@misterburger92722 жыл бұрын
Thank you! I was struggling with this issue !
3 жыл бұрын
This series is fantastic! Do you have a video planned where you can click and drag out multiple adjacent grid tiles and create like a 3x3 array of objects, or drag a line to create a wall or road?
@thegamedevchannel30633 жыл бұрын
Thank you for the support! Yes in fact I'm hoping that the episode on creating a road will be next week's, depending on how much time I get to spend on it this weekend! If not I'll have plenty of spare time over easter so it will be the week after!
3 жыл бұрын
@@thegamedevchannel3063 I know how much time this stuff can take! Thanks for the videos!
@jeejool283 жыл бұрын
Nice!
@thegamedevchannel30633 жыл бұрын
Thank you!
@MadMax-mw3og3 жыл бұрын
Hello! Love these! recomending to all my firends, Question: Would this work with Hex-tiles? if not, could it be achived easily?
@GlimmerTheo Жыл бұрын
Hey here! Any clue on how could I set the cardinal points based on my character forward vector ?
3 жыл бұрын
Fantastic... although I spelled neighbour... "neighbor" - still works! hah
@thegamedevchannel30633 жыл бұрын
Haha sorry I really should use American-English when programming but I can't help myself using British-English!
@FuzzyMelox2 жыл бұрын
If you're getting the "Accessed None" Error, delete the extra ( - ) in your East Neighbour.
@dominiczek072 жыл бұрын
I am getting errors for every single neighbour cells. I'm using ue5.1 and none of them are changing materials. The error says "accessed none trying to read property neighbour"x". Any solutions? did i mess something up?
@johnmccarrick31232 жыл бұрын
Two of my nodes seem to be off still. They're the ones that are on the Y axis - if positive X is "North", then I have a red dot on North-West and South-East corners as well as North/South as expected. Compiles and runs fine but worried this might be a problem if I don't fix it. Any advice?
@johnmccarrick31232 жыл бұрын
Nevermind I worked it out, was as usual my own fault and I didn't have the grid populating with an offset of -1 like you explicitly said to do.
@FurMuzzleGames2 жыл бұрын
Does anyone have a solution for getting access none errors, when you place them on the side of the grid?
@evantate12938 ай бұрын
Convert the Get for the N,S,W,E Variables into a Validated Get, plug the Valid into the debug, the debug AND the Is Not Valid into the next Validated Get. It's just a debug test so once it works it's, not necessary but this will stop the errors by simply moving on with the material change should the neighbour grid not exist.
@BrandonDolinski3 жыл бұрын
Had an issue at the very end with the debug not showing up correctly my bad but this video might help someone else if they are having issues : kzbin.info/www/bejne/e6OWiH6jot5mfa8
@Kriss-qp6nb3 жыл бұрын
Of course! Thanks for this!
@usman8872 Жыл бұрын
in C++ its that much easy: const int& GridCount = Grid.Num(); for (int i = 0; i < GridCount; i++) { //North[i + GridLength] if ((i + GridLength) < GridCount) { Grid[i]->North = Grid[i + GridLength]; } //South[i - GridLength] if ((i - GridLength) >= 0) { Grid[i]->South = Grid[i - GridLength]; } //East[i + 1] if (((i + 1) % GridLength) != 0) { Grid[i]->East = Grid[i + 1]; } //West[i - 1] if (i > 0 && ((i % GridLength) != 0)) { Grid[i]->West = Grid[i - 1]; } }