Download

RTS terrain grid

Hi guys. I’m trying to create a simple rts game on UE 4 and had stuck on implementation of building logic. I have terrain generated from heightmap and textured with four textures (grass, stone, sand, snow). It should be only possible to build objects on terrain textured with stone texture. As far as I understand, I need to have a grid which covers this generated terrain in order to mark areas I can place buildings (and to store which texture is in each grid tile). Something similar to this:

(this image is not from my project)
I can’t find the way to generate such grid for terrain. Maybe you can give me some ideas/clues about it?

Thanks in advance

I’m looking into same problem. Two choices I see so far is either make smart terrain material with some logic based on world coordinates (so it would apply texture grid texture on top of normal ground in specific area). Second choice would be to apply grid decal.
Maybe some mix of that would work best?

I think you understood me wrong. I don’t need to actually draw grid, just have it to perform some logic and store some useful data in each cell. For example see definition of such cell structure here: RichardsSoftware.net - Pathfinding 1: Map Representation and Preprocessing (Tile Map Structures section) . I want to have smth similar to this.

Hey Shockwave-peter!

I know I’m replying to a necro thread, but I was looking into optimizing my current grid system.

The way I currently handle it is by creating a simple actor, which has a struct,
containing Position, and any other details about that tile. (E.G., whether there is a building there).

When I move the actor, or change max grid size, or grid spacing, it auto rebuilds, (I can give the logic if you want),
which takes about 0.5-2 seconds-ish.

I then have custom functions which can highlight around a specific point, detect which points are closest to a given vector, and tell me if any of them have been used.
It’s rather simple, although the issue I’m having is:

In game, and in editor, while the actor isn’t selected, I’m getting around 120fps.
The second I select it i get 2-40fps. Then back to 120fps when it’s not selected, which makes no sense to me.

But yea, I hope this helped!

-Peace