How can i increase performance with my 3D PCG world?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RelicFinder

I’m making a procedurally generated world for a Minecraft like game. I’m using OpenSimplexNoise.new() in a sprite and taking the 3dv. I can generate a 16x16x16 cube and its fine… except a texture error but that’s not a priority. I can generate up to a 40x40x40 cube but I have little or no framerate. Also, it takes quite a long time. Each type of block is a scene that gets instanced as a child of my “world” scene. Is this the issue?

How exactly do you generate those cubes? Do you use MeshDataTool for that? If you are creating geometry from scratch, that might explain why your game is so slow. I would recommend that you create a Gridmap node an populate that with predefined cubes instead. Would this work for you?

johnygames | 2019-08-20 11:21

block scene:
the number shows the indent level.
(1) Spatial
(2) Spatial
(3) Sprite X6 (1 for each side of the cube)
(2) MeshInstance (CubeMesh)
(3) StaticBody
(4) CollisionShape (BoxShape)

I will look into Gridmaps. Thank you.

RelicFinder | 2019-08-20 20:34

After a family vacation, I’ve returned and completed implementing a grid map. However, when I generate a world chunk I see only the blue collision boxes of the blocks. how can i get the MeshLib to read my sprite textures? do i have to use models?

RelicFinder | 2019-08-28 05:46

Could you post the steps you took to create the Gridmap? Generally speaking, you do have to use models for your MeshLib.

johnygames | 2019-08-29 17:06

first, I made a “blocks.tscn” the root is spatial and each block is a MeshInstance with a
StaticBody and CollisionShape. I gave each MeshInstance an albedo with texture in VS shaders (I don’t know anything about shaders)… i then used the scene tabs convert to mesh library and used the meshlib file as my theme in my “gridmap.tscn” but i don’t see the albedo changes and when i generate the world the albedo change still isn’t there.

RelicFinder | 2019-08-29 19:30

Check this discussion: MeshLibraries don't preserve editor-created materials · Issue #24130 · godotengine/godot · GitHub

What I did to retain the materials and all is I saved those separately in my materials folder and I then reassigned them to the meshes of the MeshLib and it works.

Other than that, does this Gridmap solution work for you? Does it make your game run faster? Tell me so that I can write an appropriate answer to this question.

johnygames | 2019-08-30 21:41

Works for me? No, or at least not how I’m currently implementing gridmaps. I can spawn 4 times than before and there isn’t frame rate lag. However, 200 thousand blocks aren’t much when I’m thinking each block is 6 inches and I want a whole world. Is there a way that i can improve it further?

For added detail.
20 x 100 x 100 is the largest I can generate. It has about a 30-second start-up time and if I tell it to go any bigger… well I haven’t found the start-up time for that because it’s so long. It just sits there no errors or anything.

RelicFinder | 2019-08-31 07:05