Unreal Engine City Building Game - The Grid Advanced, Neighbouring Cells - EP 6

  Рет қаралды 18,556

The Game Dev Channel

The Game Dev Channel

Күн бұрын

Пікірлер: 32
@hanaka8735
@hanaka8735 10 ай бұрын
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)
@mpattym
@mpattym 2 жыл бұрын
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.
@IJCrothers
@IJCrothers 6 ай бұрын
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.
@joycelangman
@joycelangman 10 ай бұрын
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.
@tbunreall
@tbunreall 2 жыл бұрын
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
@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
@jared875 Жыл бұрын
Niice catch! TY
@flynngeddes7672
@flynngeddes7672 Жыл бұрын
thats why it was coming up with warnings and errors good catch
@SirMechlon
@SirMechlon 3 жыл бұрын
Thank you very much! Got me in the right direction for my own grid implementation.
@hansknut2284
@hansknut2284 3 жыл бұрын
Awesome again:)!!!
@user-lj1qw5hv7l
@user-lj1qw5hv7l 3 жыл бұрын
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
@axlefoley6330
@axlefoley6330 3 жыл бұрын
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!
@misterburger9272
@misterburger9272 2 жыл бұрын
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?
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
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!
@jeejool28
@jeejool28 3 жыл бұрын
Nice!
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
Thank you!
@MadMax-mw3og
@MadMax-mw3og 3 жыл бұрын
Hello! Love these! recomending to all my firends, Question: Would this work with Hex-tiles? if not, could it be achived easily?
@GlimmerTheo
@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
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
Haha sorry I really should use American-English when programming but I can't help myself using British-English!
@FuzzyMelox
@FuzzyMelox 2 жыл бұрын
If you're getting the "Accessed None" Error, delete the extra ( - ) in your East Neighbour.
@dominiczek07
@dominiczek07 2 жыл бұрын
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?
@johnmccarrick3123
@johnmccarrick3123 2 жыл бұрын
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?
@johnmccarrick3123
@johnmccarrick3123 2 жыл бұрын
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.
@FurMuzzleGames
@FurMuzzleGames 2 жыл бұрын
Does anyone have a solution for getting access none errors, when you place them on the side of the grid?
@evantate1293
@evantate1293 8 ай бұрын
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.
@BrandonDolinski
@BrandonDolinski 3 жыл бұрын
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-qp6nb
@Kriss-qp6nb 3 жыл бұрын
Of course! Thanks for this!
@usman8872
@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]; } }
Unreal Engine City Building Game - Building Roads - EP 7
46:39
The Game Dev Channel
Рет қаралды 19 М.
Unreal Engine City Building Game - HUD and Building Select - Ep 8
26:34
The Game Dev Channel
Рет қаралды 10 М.
My Wife and I Made an Indie Game and it Made Millions!
14:45
Eastshade Studios
Рет қаралды 1,6 МЛН
What's a grid? How to make? (Unreal Engine)
15:07
AziApps
Рет қаралды 4,7 М.
Unreal Engine City Building Game - The Grid - EP 5
17:28
The Game Dev Channel
Рет қаралды 49 М.
Unreal Engine 4 - Optimized Grid Tutorial (1/4)
21:54
Reids Channel
Рет қаралды 63 М.
How to Set Up a Grid for Level and Game Design Metrics
9:55
Tyler McCombs
Рет қаралды 10 М.
How to create GRID the RIGHT WAY - Unreal Engine 5
14:48
JemGames
Рет қаралды 1,2 М.
Intro to Flow Maps [UE5]
35:17
PrismaticaDev
Рет қаралды 23 М.
WTF Is? Snap to Grid in Unreal Engine 4 ( UE4 )
5:23
Mathew Wadstein Tutorials
Рет қаралды 24 М.