Unreal Engine City Building Game - The Grid - EP 5

Unreal Engine City Building Game - The Grid - EP 5

The Game Dev Channel

4 года назад

53,637 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@henryjohnson-ville3834
@henryjohnson-ville3834 - 22.12.2024 22:10

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. 😣

Ответить
@Jake-ChenYiRan
@Jake-ChenYiRan - 20.12.2024 06:22

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.

Ответить
@officialgreenhero1435
@officialgreenhero1435 - 30.10.2024 20:39

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.

Ответить
@Daniel537Daniel
@Daniel537Daniel - 14.07.2024 22:50

thx man, great tutorial! 🔥

Ответить
@axelivens1707
@axelivens1707 - 08.07.2024 22:47

What is actually the hard way to implement the grid system?

Ответить
@alexanderwagner8199
@alexanderwagner8199 - 09.04.2024 14:56

Thnx a million!!

Ответить
@oliverholmberg1462
@oliverholmberg1462 - 19.01.2024 16:43

Thank you!!! This is the only good tutorial i've seen of grid based building systems. You literally saved my game!

Ответить
@MuriloFernandoFloriani
@MuriloFernandoFloriani - 01.11.2023 02:41

I'm 100% sure I know you man! ;)

Ответить
@joeanrachelmiller6529
@joeanrachelmiller6529 - 24.04.2023 11:58

The grid i have from UE 5.1 seems to be 800. Already having the flexibility is giving me other ideas. Thanks man

Ответить
@Nio0B
@Nio0B - 17.04.2023 21:37

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.

Ответить
@xaxao649
@xaxao649 - 30.03.2023 09:11

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

Ответить
@CrimsonWoods
@CrimsonWoods - 27.03.2023 16:31

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.

Ответить
@powerpc6037
@powerpc6037 - 14.03.2023 07:23

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?

Ответить
@adam4designss
@adam4designss - 14.02.2023 22:45

Still only 3 spot highlight the forth one doesn't appear ,follow your stepts

Ответить
@BOTS31
@BOTS31 - 23.01.2023 02:33

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

Ответить
@ZenoFar853
@ZenoFar853 - 11.01.2023 00:11

U didn't add save load system

Ответить
@mahmoudhhammdybakheet2411
@mahmoudhhammdybakheet2411 - 07.01.2023 23:48

Is this system goog for match 3 game

Ответить
@murnoth
@murnoth - 07.12.2022 08:26

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

Ответить
@gladiusstudios01
@gladiusstudios01 - 28.07.2022 10:43

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

Ответить
@安荣-f5g
@安荣-f5g - 18.05.2022 03:58

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.

Ответить
@GHSTLurker
@GHSTLurker - 11.05.2022 21:34

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.

Ответить
@GaryParkin
@GaryParkin - 31.03.2022 19:05

Thank you very much. Still hanging in there.

Ответить
@fabriziogiorgi8405
@fabriziogiorgi8405 - 31.01.2022 15:02

How is this sooo expensive I don't understand , my framerate gets half when I use a 15x15 grid size

Ответить
@shifugurugaming
@shifugurugaming - 02.01.2022 01:03

Is this possible to do on a sphere instead of a plane? great tutorial thanks

Ответить
@hansknut2284
@hansknut2284 - 19.12.2021 15:28

Again Awesome Video!

Ответить
@rifz42
@rifz42 - 08.11.2021 11:02

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

Ответить
@xdahid22
@xdahid22 - 31.10.2021 19:08

Great tutorial, thank you very much!

Ответить
@Hydra_Studioz
@Hydra_Studioz - 16.09.2021 20:09

In the Future Can you make it so that you can change the grid snap

Ответить
@Hydra_Studioz
@Hydra_Studioz - 16.09.2021 19:41

quick question how do i add an input action that will adjust the height above the ground

Ответить
@BrianDeric
@BrianDeric - 07.09.2021 16:26

Maybe you should use hierarquica instances instead of spheres.

Ответить
@give_me_aspirin
@give_me_aspirin - 28.08.2021 09:42

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

Ответить
@TheAbbadon178
@TheAbbadon178 - 10.08.2021 16:02

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 ?

Ответить
@notcaszhar
@notcaszhar - 13.07.2021 17:36

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!

Ответить
@supermariogolden6444
@supermariogolden6444 - 05.07.2021 18:32

There’s only one layer of the grid cell it doesn’t cover the entire thing

Ответить
@Neekhaulas
@Neekhaulas - 05.07.2021 15:48

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?

Ответить
@gamerdweebentertainment1616
@gamerdweebentertainment1616 - 01.07.2021 20:48

Works, kinda... maths off a bit or I missed something, 1st cell is at 550;550 -.-'

Ответить
@danielacosta6084
@danielacosta6084 - 29.06.2021 05:05

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!

Ответить
@JOWNATANN
@JOWNATANN - 24.06.2021 05:16

If someone is having trouble getting distance between two vectors: use the vector subtraction node connected to a vector length node.

Ответить
@MadMax-mw3og
@MadMax-mw3og - 22.06.2021 22:45

Mate your gonna go big, keep this up, each video I watch I feel more like im watching entertainment than learning, but its both

Ответить
@raditsyz
@raditsyz - 20.06.2021 01:02

Thanks for the vid! This one was a breeze.

Ответить
@thelandsavior402
@thelandsavior402 - 06.06.2021 09:00

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)

Ответить
@devuegames
@devuegames - 02.05.2021 00:03

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)

Ответить
@gadji2011
@gadji2011 - 28.04.2021 22:43

Спасибо тебе. У тебе приятный голос!
Покажи пожалуйста как можно сделать сетку как в цивилизация 5/6?

Ответить
@teratocarcinoma3142
@teratocarcinoma3142 - 28.04.2021 18:03

i need this on unity and in spanish :c

Ответить
@VetskuGaming
@VetskuGaming - 12.04.2021 07:51

I dont understand how you only have 171 subscribers. Well lets up that to 172!

Ответить
@kiwivideobeast8602
@kiwivideobeast8602 - 01.04.2021 18:11

Can u pls tell Ur pc specs and i subcribe and like ur video

Ответить
@MohamedSamy-vp2pq
@MohamedSamy-vp2pq - 16.03.2021 11:53

I hope if u can road spline curves

Ответить
@videorowtv5198
@videorowtv5198 - 11.03.2021 22:54

I'm either retarded, or it doesn't work :(

Ответить