I'm making an editable generated map, and everything works but if it gets too big the add_child() function gets laggier and laggier. This is really not going to work for a multiplayer game if the loading screen takes ten minutes.
The biggest a map is probably going to be is 100x100, which means I need to generate 10000 CollisionShapes, one for each tile. The reason I'm only having one each tile is that when editing I don't want to have to re generate all collision, just the tile and the surrounding tiles.
This is the laggy code I'm dealing with:
convex_shape = ConvexPolygonShape.new()
$StaticBody.add_child(colsha) #-> Very Laggy
colsha.set_name(str("COLLISION_X_", x, "_Y_", y))
colsha.set_shape(convex_shape)```
I don't know what to do.