Комментарии:
I have such an amazing idea of a game but I'm doing basic research of how much work it will be and alas, I will not do it. Making the grid itself seems like a pain, I wish I was talented with game development. 😣
ОтветитьFor anyone who doesn't want to do a For Each loop to find the closest grid cell, here's a quick, performance-friendly solution:
Create a new Vector variable called gridOrigin
in your PouplateGrid Function, at the very end, set gridOrigin to the GetWorldLocation(Default Scene)
in your GetClosestCell (or where your for loop currently is) function, delete all the code except for the return node (and the function's starting node).
From the in position, drag out and subract the GridOrigin from the in position. Drag out from this result and divide by worldGridSize. Next split the result's struct pin into x y and z. Drag out of each and round them. Next create a make vector node, connect each of the rounded results. Multiply your make vector by worldGridSize. Add the result to your gridOrigin.
Lastly set your ClosestPosition to the result of the last addition mentioned above, then return the output into the return node.
You should use the “get actor of class” for grid manager on begin play and save as variable. The description of “get actor of class” specifically says do not use every frame. if anyone’s game is extremely laggy or crashes then blame this dude.
Ответитьthx man, great tutorial! 🔥
ОтветитьWhat is actually the hard way to implement the grid system?
ОтветитьThnx a million!!
ОтветитьThank you!!! This is the only good tutorial i've seen of grid based building systems. You literally saved my game!
ОтветитьI'm 100% sure I know you man! ;)
ОтветитьThe grid i have from UE 5.1 seems to be 800. Already having the flexibility is giving me other ideas. Thanks man
ОтветитьI'm a bit confused if i start to make a 100*100 grid i can't believe spawning 10 000 actors is the solution.
ОтветитьIm confused on the definition of GridSize and WorldGridSize
Is GridSize the size of a single grid cell? or is the the WorldGridSize?
Or is GridSize the number of individual cell(s)?
From what I understand from poking around is WorldGridSize=Size of a single cell, GridSize=Number of cell
You can pull off a 2d array by utilizing the map container type instead of an array and use a 2d vector as the key. Maps are just like arrays but let you choose a specific type to key what you store. both the keys and values you store can be pulled as arrays aswell.
ОтветитьIsn't it easier to calculate the closest vector by looking at the coordinates and with the worldgridzsize and gridsize, calculate in which gridposition your mouse is, instead of looping through the array every frame and calculate distances for every single gridposition?
ОтветитьStill only 3 spot highlight the forth one doesn't appear ,follow your stepts
ОтветитьFor people wanting to have the grid in a specific area what you need to do is:
Get the "Default Scene Root" World location of the gridmanager and "add/+" it to the output of the "make vector" (at 8: 48) and at the outcome of the add\+ into the "Make Transform"
This way you will have the grid lay-out and it will spawn at the world location of where you put the BP
U didn't add save load system
ОтветитьIs this system goog for match 3 game
ОтветитьGreat video, thanks for the ideas! I think I'm gonna try and store my actors in a Map with vectors as the Keys. As long as I have my cursor hit event locations ran through a subtract the modulo, it should be able to look up everything quickly while saving on storage space on a huge grid
ОтветитьHi I was wondering I’m planning to do this video tutorial is there a way you can do a building system that isn’t grid based like more free form building but still don’t clash when building on top of each other
ОтветитьI can't wrap my head around why you would loop through all grid cells in the world per frame just to find the closest grid location. Just divide the X and Y by the grid width, round to nearest int, multiply by grid width and add grid width/2 to it. If the grid system becomes more complicated than this later, we should check if there exist a grid cell on the location, and if not, search around the location to get the nearest, or just refuse to display.
ОтветитьFor whatever reason this grid system quit running smoothly and started lagging hard. I even went to back ups of my project that I knew ran smoothly and they were also lagging.
ОтветитьThank you very much. Still hanging in there.
ОтветитьHow is this sooo expensive I don't understand , my framerate gets half when I use a 15x15 grid size
ОтветитьIs this possible to do on a sphere instead of a plane? great tutorial thanks
ОтветитьAgain Awesome Video!
ОтветитьCool Channel! it's great to see some unique ideas for tutorials.
How would you save all the blocks that are placed in game? thanks
Great tutorial, thank you very much!
ОтветитьIn the Future Can you make it so that you can change the grid snap
Ответитьquick question how do i add an input action that will adjust the height above the ground
ОтветитьMaybe you should use hierarquica instances instead of spheres.
ОтветитьHey would you be able to tell me how you can place a block on top of a block? Like as in green box on top of green box? that would really help me out
ОтветитьFirst of all great Tutorials ! I have been following up until the Citizen Tutorial.
I was wondering how I can increase the performance on the Grid.
When cranking up the Size of the Grid to a 100 it starts to perform really bad when placing buildings and rotating the Camera.
You got any Solution for this ?
Heya, awesome tutorials! Great for reference :) I have a question about using the grid not at runtime, where would you start with placing buildings on a grid when not at runtime, for instance creating a level and having buildings / zones allocatted before runtime?
Thank you for the invaluable tutorials!
There’s only one layer of the grid cell it doesn’t cover the entire thing
ОтветитьThanks for the video! When you talk about snapping, you talk about the easy and hard way, what's the hard way you're talking about?
ОтветитьWorks, kinda... maths off a bit or I missed something, 1st cell is at 550;550 -.-'
ОтветитьIs it possible to apply this to the building pieces in the previous video? I want the pieces to be able to snap onto eachother. I want to make a modular building system, and if I can apply this system to the building pieces, that would be exactly what I need. Thanks in advance!
ОтветитьIf someone is having trouble getting distance between two vectors: use the vector subtraction node connected to a vector length node.
ОтветитьMate your gonna go big, keep this up, each video I watch I feel more like im watching entertainment than learning, but its both
ОтветитьThanks for the vid! This one was a breeze.
ОтветитьGreat video, i would like to makea game and i hope you can teach me everything along the way~ (like Hay Day or Japan Life)
Ответитьincredibly grateful to you for the lesson 💖💖💖💖💖
I have found another lesson for you, and if I combine them, I will apply the mechanics I need, like Fieldrunners 2. When you drag the tower into place, you will have a green grid where you can place the tower.
I hope Google translated correctly)
Спасибо тебе. У тебе приятный голос!
Покажи пожалуйста как можно сделать сетку как в цивилизация 5/6?
i need this on unity and in spanish :c
ОтветитьI dont understand how you only have 171 subscribers. Well lets up that to 172!
ОтветитьCan u pls tell Ur pc specs and i subcribe and like ur video
ОтветитьI hope if u can road spline curves
ОтветитьI'm either retarded, or it doesn't work :(
Ответить