Godot Version
4.6 Stable
Question
Help me understand what is happening in this error. I tried google gemini AI for help, but it suggest me checking the things that are correct.
Errors in question
E 0:00:00:694 create_tile: Cannot create tile. The tile is outside the texture or tiles are already present in the space the tile would cover.
<C++ Error> Condition “!room_for_tile” is true.
<C++ Source> scene/resources/2d/tile_set.cpp:4985 @ create_tile()
E 0:00:00:694 has_alternative_tile: The TileSetAtlasSource atlas has no tile at (11, 0).
<C++ Error> Condition “!tiles.has(p_atlas_coords)” is true. Returning: false
<C++ Source> scene/resources/2d/tile_set.cpp:5437 @ has_alternative_tile()
E 0:00:00:694 has_alternative_tile: The TileSetAtlasSource atlas has no tile at (11, 0).
<C++ Error> Condition “!tiles.has(p_atlas_coords)” is true. Returning: false
<C++ Source> scene/resources/2d/tile_set.cpp:5437 @ has_alternative_tile()
(error repeats for 400 times indexing vector x+1 and y+1)
var source_id = 0
var water_atlas = Vector2i(0,8)
var coast_water_atlas = Vector2i(0,10)
var sand_atlas = Vector2i(0,0)
var grass_atlas = Vector2i(0,2)
var forest_atlas = Vector2i(3,3)
func _ready():
noise = noise_height_text.noise
# use base terrain clear to clear any existing blocks
#base_terrain.clear()
generate_world()
func generate_world():
print("Water is at: ", water_atlas)
print("Forest is at: ", forest_atlas)
print("Grass is at: ", grass_atlas)
for x in range(-width/2, width/2):
for y in range(-height/2, height/2):
var noise_val :float = noise.get_noise_2d(x,y)
if noise_val < 0.0:
# Water
base_terrain.set_cell(Vector2i(x,y), source_id, water_atlas)
else: # noise_val >= 0.0
if noise_val > 0.3:
# Forest
base_terrain.set_cell(Vector2i(x,y), source_id, forest_atlas)
else:
# Grass (Only place this if it's NOT forest)
base_terrain.set_cell(Vector2i(x,y), source_id, grass_atlas)
tile map image:
What I checked so far:
-
ensured that I don’t have any tiles preplaced, checked the tileMapLayer in 2D to check visually. And also checked with .clear() before generation to wipe everything (in the code its now commended out)
-
Checked tile map to check if I am autogenerating 11th tile, and I don’t think I am.
-
checked variables (water_atlas etc) if I am pointing incorrectly. I am not.
The only reasonable guess that I have is that I am trying to generate things outside of the scene, but is that a problem? I do want to generate a larger map than my scene just for testing, if thats the case, do these errors mater?
