Unreal Engine City Building Game - The Grid - EP 5

  Рет қаралды 44,018

The Game Dev Channel

The Game Dev Channel

Күн бұрын

In this video I make a grid system in our world that will be used for snapping objects, roads and buildings to each other!
00:00 - Intro
01:00 - Creating the Grid Manager
09:00 - Creating a Grid Cell
11:30 - Snap Buildings to Grid
---------------------------------------------------------------------------------------
Leave a comment below for any unreal tutorials you would like to see in the future or for any extra help you might need! This Channel is all about making games, discussing game development and helping out those trying to get into the gaming industry. Like and Subscribe for more content

Пікірлер: 76
@BOTS31
@BOTS31 Жыл бұрын
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
@xaxao649
@xaxao649 Жыл бұрын
Could you elaborate a little more? I tried working on this by myself before seeing this comment and couldn't get it. Still can't get it haha 😅
@oliverholmberg1462
@oliverholmberg1462 5 ай бұрын
Thank you!!! This is the only good tutorial i've seen of grid based building systems. You literally saved my game!
@xdahid22
@xdahid22 2 жыл бұрын
Great tutorial, thank you very much!
@hansknut2284
@hansknut2284 2 жыл бұрын
Again Awesome Video!
@raditsyz
@raditsyz 3 жыл бұрын
Thanks for the vid! This one was a breeze.
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
Glad it helped!
@GaryParkin
@GaryParkin 2 жыл бұрын
Thank you very much. Still hanging in there.
@CrimsonWoods
@CrimsonWoods Жыл бұрын
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.
@alexanderwagner8199
@alexanderwagner8199 2 ай бұрын
Thnx a million!!
@joeanrachelmiller6529
@joeanrachelmiller6529 Жыл бұрын
The grid i have from UE 5.1 seems to be 800. Already having the flexibility is giving me other ideas. Thanks man
@rifz42
@rifz42 2 жыл бұрын
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
@Neekhaulas
@Neekhaulas 3 жыл бұрын
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?
@VetskuGaming
@VetskuGaming 3 жыл бұрын
I dont understand how you only have 171 subscribers. Well lets up that to 172!
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
Thank you so much for the support!
@user-ld4jc9je3o
@user-ld4jc9je3o 2 жыл бұрын
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.
@Crackasa19
@Crackasa19 Жыл бұрын
You can use FMath::GridSnap in c++ or BP node. See my last comment
@user-ld4jc9je3o
@user-ld4jc9je3o Жыл бұрын
@@Crackasa19 yes but it’s easy math, so doing our own math helps when we want to customize it in any way
@Crackasa19
@Crackasa19 Жыл бұрын
Ouh okey, I understand what you are telling me
@tbunreall
@tbunreall Жыл бұрын
Can you expand on this? I don't quite understand :/
@devuegames
@devuegames 3 жыл бұрын
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)
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
I'm really glad it helped you! Thanks so much for the support :)
@paradox8425
@paradox8425 2 жыл бұрын
​@@thegamedevchannel3063 Can you give us some clue about hard and more optimized way?
@sonny5974
@sonny5974 2 жыл бұрын
Is this possible to do on a sphere instead of a plane? great tutorial thanks
@joshua7baker
@joshua7baker 2 жыл бұрын
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!
@MadMax-mw3og
@MadMax-mw3og 3 жыл бұрын
Mate your gonna go big, keep this up, each video I watch I feel more like im watching entertainment than learning, but its both
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
Thanks so much for the support! And your email, I'll get back to you shortly
@murnoth
@murnoth Жыл бұрын
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
@Hydra_360
@Hydra_360 2 жыл бұрын
quick question how do i add an input action that will adjust the height above the ground
@GEARINSADE
@GEARINSADE 3 жыл бұрын
If someone is having trouble getting distance between two vectors: use the vector subtraction node connected to a vector length node.
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
There's also a vector distance function you can plug two vectors into I believe, thanks for the tip!
@Hydra_360
@Hydra_360 2 жыл бұрын
@@thegamedevchannel3063 there is only a distance to point segment node
@TheAbbadon178
@TheAbbadon178 2 жыл бұрын
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 ?
@prototy
@prototy 2 жыл бұрын
A few optimizations I implemented was to not spawn actors to store the grid info and instead make a structure with all the info I need for each grid. Then I used the modulo (or modulus, always get those mixed up) of the x and y of the world location under the mouse to get a unique vector 2D for each grid that I can use as a key in a map with the structure I mentioned being the data in the map. At 100x100 I am getting 90 fps :)
@MuriloFernandoFloriani
@MuriloFernandoFloriani 7 ай бұрын
I'm 100% sure I know you man! ;)
@BrianDeric
@BrianDeric 2 жыл бұрын
Maybe you should use hierarquica instances instead of spheres.
@gamerdweebentertainment1616
@gamerdweebentertainment1616 3 жыл бұрын
Works, kinda... maths off a bit or I missed something, 1st cell is at 550;550 -.-'
@thelandsavior402
@thelandsavior402 3 жыл бұрын
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)
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
I hope so too!
@thelandsavior402
@thelandsavior402 3 жыл бұрын
@@thegamedevchannel3063 Don't discourage me, ur my everything! Gambateh!
@danielacosta6084
@danielacosta6084 3 жыл бұрын
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!
@danielacosta6084
@danielacosta6084 3 жыл бұрын
Ah nevermind, I spent all day working around this and somehow I managed to pull through. Only issue is that since its run every second I have some very taxing commands and my game does not run too well lol. Also the circles used are messing up the overlap so its considering itself invalid... I'll probably find some way to fix it...
@Hydra_360
@Hydra_360 2 жыл бұрын
In the Future Can you make it so that you can change the grid snap
@mahmoudhhammdybakheet2411
@mahmoudhhammdybakheet2411 Жыл бұрын
Is this system goog for match 3 game
@powerpc6037
@powerpc6037 Жыл бұрын
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?
@xmlstudios
@xmlstudios Жыл бұрын
what I did was to use line traces to detect cell meshes that I made invisible and its pretty good
@xaxao649
@xaxao649 Жыл бұрын
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
@adam4designss
@adam4designss Жыл бұрын
Still only 3 spot highlight the forth one doesn't appear ,follow your stepts
@give_me_aspirin
@give_me_aspirin 2 жыл бұрын
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
@thegamedevchannel3063
@thegamedevchannel3063 2 жыл бұрын
You could probably keep track of how many blocks are already in each grid cell (0,1 ect) and then when trying to place a new one if you want them to stack add (height of one block * number of blocks already in the cell) to the position of your new one?
@gladiusstudios01
@gladiusstudios01 Жыл бұрын
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
@elizabethlaplume2267
@elizabethlaplume2267 Жыл бұрын
Have you found any good resources or do you have any advice for doing a freeform building system? I really don't want to be confined to a grid but still want to have roads connecting buildings
@gladiusstudios01
@gladiusstudios01 Жыл бұрын
@@elizabethlaplume2267 no I haven’t sorry
@ZenoFar853
@ZenoFar853 Жыл бұрын
U didn't add save load system
@KieDK
@KieDK 2 жыл бұрын
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.
@supermariogolden6444
@supermariogolden6444 3 жыл бұрын
There’s only one layer of the grid cell it doesn’t cover the entire thing
@fabriziogiorgi8405
@fabriziogiorgi8405 2 жыл бұрын
How is this sooo expensive I don't understand , my framerate gets half when I use a 15x15 grid size
@danielmarco4818
@danielmarco4818 2 жыл бұрын
It's the For Each loop. As he said, it is expensive.
@xmlstudios
@xmlstudios Жыл бұрын
expensive to set up but nothing to run
@gadji2011
@gadji2011 3 жыл бұрын
Спасибо тебе. У тебе приятный голос! Покажи пожалуйста как можно сделать сетку как в цивилизация 5/6?
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
Hi, thanks for the support! (I'm sorry I don't read Russian so I had to translate what you said through Google). Hopefully it translated correctly! What I would do is a very similar system but offset each row by half of the previous row if that makes sense? I'll try and represent that by the numbers table below if you imagine they are the X values of the Grid Cell 0 2 4 6 8 10 1 3 5 7 9 0 2 4 6 8 10 1 3 5 7 9 0 2 4 6 8 10 And then obviously for the North/South neighbours you should an extra for the two attached cells. hopefully that helps!
@MohamedSamy-vp2pq
@MohamedSamy-vp2pq 3 жыл бұрын
I hope if u can road spline curves
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
I'm hoping to get to that in the future, however I think that will be the "advanced" implementation. The plan is to have a sim running on a simple grid system and then expand the features to include curved roads, changeable terrain and other cool stuff :)
@MohamedSamy-vp2pq
@MohamedSamy-vp2pq 3 жыл бұрын
@@thegamedevchannel3063 I hope if u can do it this things for beginner's is really impossible, thank u for awesome series
@kiwivideobeast8602
@kiwivideobeast8602 3 жыл бұрын
Can u pls tell Ur pc specs and i subcribe and like ur video
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
Hi, thanks for the support! Right now I'm in desperate need of upgrading haha. I'm still on an i5 and a 1060 Graphics card, 32 GB RAM
@kiwivideobeast8602
@kiwivideobeast8602 3 жыл бұрын
@@thegamedevchannel3063 thanks
@Nio0B
@Nio0B Жыл бұрын
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.
@jared875
@jared875 Жыл бұрын
Give the guy a break. He's said before that he's still new to all of this; At least when this series was current
@Nio0B
@Nio0B Жыл бұрын
@@jared875 well my comment was not offensive and i never saw a programmer who ask for a break after a comment on algorithm optimisation.
@teratocarcinoma3142
@teratocarcinoma3142 3 жыл бұрын
i need this on unity and in spanish :c
@thegamedevchannel3063
@thegamedevchannel3063 3 жыл бұрын
Sorry about that! The logic should be transferable but the syntax won't be :(
Unreal Engine City Building Game - The Grid Advanced, Neighbouring Cells - EP 6
31:22
Why Solo Developers Should Use Unreal
10:55
Thomas Brush
Рет қаралды 321 М.
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 105 МЛН
1❤️#thankyou #shorts
00:21
あみか部
Рет қаралды 88 МЛН
What's a grid? How to make? (Unreal Engine)
15:07
AziApps
Рет қаралды 768
How to make a Grid Layout Level Unreal Engine 4.25  (Ep. 1 / ??)
10:55
Code, Tech, and Tutorials
Рет қаралды 22 М.
Creating a HexGrid System in Unreal Engine (UE4/UE5)
9:04
StayAtHomeDev
Рет қаралды 28 М.
Introducing EasyFog for Unreal Engine 5
20:23
William Faucher
Рет қаралды 308 М.
Casting Explained | Unreal Engine 5 Tutorial
11:14
Tyler Serino
Рет қаралды 28 М.
I Struggled With Blueprint Interfaces for Years!! (Unreal Engine 5)
16:48
Glass Hand Studios
Рет қаралды 173 М.
How to create Modular and Scalable UI systems in Unreal Engine
19:15
Alat Seru Penolong untuk Mimpi Indah Bayi!
0:31
Let's GLOW! Indonesian
Рет қаралды 5 МЛН
Невероятный талант😮
0:20
Лайтшортс
Рет қаралды 1,8 МЛН
Which water gun won??
0:30
toys AS
Рет қаралды 6 МЛН
Невестка с приколом 😱
0:23
ТРЕНДИ ШОРТС
Рет қаралды 1,9 МЛН
Моя супер находка для велосипеда #находки #wildberries #топ
0:14