Grid Terrain

Hi guys, I have read all forum topics about grids, and still can´t have a clear answer, so here I am, asking again :slight_smile:

First, sorry about my English, I´m from Brazil…

I´m working on a City Building game, it´s online, so all changes are validated by the server.
What we do now is, I create a grid using a script that create several squares side by side, for example, let´s use, 10 by 10 squares, which give me 100 grids. I save this on a prefab, called grid, and put it on the map.

On runtime, to create a building, you click the button on the menu, and go over the map, it highlight the squares that you can build on green, and the ones you can´t red… when you click it, the selected object is instantiate on the position of the square (grid), and it updates on the server, that square X, have building Y.
It´s the same when you login in the game, it goes on the server, and check to put the buildings on their specific locations.

This worked so far, because it´s a small test map, but now we´re doing larger terrains, with several grids, so it came to millions of squares on the grid… so it´s like, building X on square 564.234.122
Not so good… I´m sure there is a better way to do that?

It´s much like Simcity, so the grid needs to have some info on it, like pollution, if has water, etc…
I don´t see how I can do this, without use tiles… do you guys have a better idea???

Many thanks and regards.

What if you used a texture as the actual grid, and only created a prefab to indicate the highlighted area? Then the terrain information could be stored in an array that you can pull from when you have the coordinates.

This way you wouldn’t have to generate so many prefabs… just turn on the grid texture.

It worked thechest!
What I need was a idea.

Thanks!!!

Better English than most people at my school!
(Kind of sad huh?)

heheheehe…happens