• General Chat
  • How make a terrain similar to Starcraft 2 whit GridMaps(Fixed)

How could something similar to the blank map of the Starcraft 2 editor? I have this: i use some code of a Tybobobo tutorial, Yes I know bad idea something like this but no to fancy xD i have this:

[code] func blankMap(columns,rows):

#TODO: hacer un terreno plano

print("Start Generator")

for x in range(0,columns+1):
	grid_map.append([])
	for y in range (0,rows+1):
		var rand_int = int(rand_range(0, 2))
		grid_map[x].append(rand_int)

for x in range(0, columns):
	for z in range(0, rows):
		
		var tile_1 = grid_map[x][z]
		
		var tile_value = tile_1
		
		get_child(1).get_child(0).set_cell_item(x,0,z,tile_value)

print("End generator")

[/code] ignore the spanish comments :wink: and my bad english

now i use a mesh for the terrian, it's only temporary(I lost my code)

2 months later

I can't realize what do you want to do, I've never played that game, Please explain a little what you want to do exactly. I think the code isn't properly attached.

No tengo muy claro lo que intentas hacer la verdad, nunca he jugado al Startcraft 2, explica un poco cómo debería funcionar y lo que tienes, creo que el código que pusiste no está bien puesto porque falta alguna línea según parece.

Por lo menos tu haces las funciones en inglés, yo lo escribo todo en español :) .

i feel this code confusing. What is the main reason to do array[x].append(int(rand_range(0,2))... I think that your grid discontinuity come from this line.

Starcraft screenshot mostly looks like pure 3d generated terrain. Even that tapering shape of camera view on mini-map indicates so. I am new to godot but for a long time I was bothering with different graphic engines. This type of terrain seems to be generated with VBO and lighting (baked lightmap), so I would create a simple TileMap with flat-shaded grass (or whatever) tiles and put a light mask on it with SUB or MUL blending mode. Different kind of noise/light maps can be easily generated with GIMP or Blender tools. Tile-generated shading doesn't really seem to be a good idea...

There is a nice example of light masking in standard examples library.

p.s.: Sorry if I look naive or too much obvious for this question

The first workaround to do with code confusions might be do "print" for the problem. If you replace the line 20 by print(grid_map) you can see in console the result of the iterated array. If you do that i'm sure you will see the bug.

6 months later

sorry to answer so far,

@hormahis said: My idea is using te GridMap Node for make the terrian, like Starcraft 2 does(but they used shaders),I do not know if I explained well :(

@807 said: The first workaround to do with code confusions might be do "print" for the problem. If you replace the line 20 by print(grid_map) you can see in console the result of the iterated array. If you do that i'm sure you will see the bug. lo de print era para no perderme en el codigo :p otra cosa segui un tutorial en youtube, pero era en 2D lo arregle hace tiempo, pero se me olvido postear el resultado :(