Poor Performance with minecraft-style geometry

I am currently playing around with a cube-only world geometry. I have 50*50 cm cubes, which the player can place, and make them emit light. So as soon as the game hits a couple of hundred cubes, performance drops below 20 fps…
How can a game like minecraft pull something like that off, or what am I doing wrong? The cubes are implemented with blueprints, so each cube is an actor with cubegeometry and a few functions like change materiall or look for neighbors etc. Would it be more efficient to have just one actor for the world geometry, and add cubegeometries to that? Are there other ways to optimize simple geometry like that?

Are you spawning new cubes or creating instances of single one? Instances require much less resources to work with. Look up Add Instances and Update Instance Transform nodes.

You can try the Brickgrid plugin: “The BrickGrid plugin adds a component that imitates Minecraft’s bricks. The bricks are cubes that may contain some material, arranged in a 3D grid.”

And if you want some examples you can check out the open-source brickgame by AndrewScheidecker or if you want to take the easy way, you can just modify his game to your likings.

Well, within the game I’m using SpawnActor, in the Editor I use ctrl+c/v. I’m assuming all of these spawn new cubes. That seems like a good thing to try.

Ok, I’ve read a little bit about it, and it seems to need quite a bit of rework. Am I getting the gist of it right, in that I would need to have one actor for each type of cube for the entire level and add instanced static mesh components with world locations to it for each of the thousands of cubes?

If I were you, I would’ve made a one universal actor that holds a set of parameters to become any type of cube you’ll need. So that in the game when you choose a type, for example soil, it will make an instance of base actor with a certain properties, like destroyable, safe to walk on, with soil shader and so on. Don’t flesh out everything. You only need a proof of concept so you could develop it later.

I am so sorry, but that confused me more. I thought that was the way I set it up already? I am confused by the word instance. I have one blueprint set up to be any kind of cube (concrete, glass etc). I place them in the Level with ctrl+v, so I can see Cube1,Cube2… Cube6000 in the World outliner on the right. Isn`t each of These entries one instance of the blueprint class cube?

Duplicating (Copypasting) and Instancing is not the same thing. When you simply create a copy of your actor the engine treats it as a new actor despite it using the same geometry, that’s why you see Cube1, Cube2 in your outliner. When you instance a bunch of meshes the engine renders them as one mesh. You can check it by examining the amount of draw calls the engine takes to display your actors. Draw Call is the major term you need to think about when optimizing graphics in your project. Look up CPU and GPU profiling in documentation.

I did a test with the most basic setup and instanced 500,000 cubes (6m polys) in a single blueprint before my fps reached 30. This is quite a lot and it can be optimized even further with c++ but I’m not competent enough to go into that discussion.

So all the building blocks should be inside a single blueprint in your level.