Generatig a medium-sized hexagonal grid with complex objects - Performance problems

I am afraid that all your worries may be true. I also had hopes for procedurally generated sandbox city, but Unreal is not there yet (at least blueprints are not).

You need to heavily optimize your way of doing things. While separate blueprints for each hex look nice, they are easy on your coding but quite heavy for unreal to handle. More, when you start spawning blueprints inside blueprints all that mess will get unstable very fast. I have almost finished random maze generating example (and its 10x10 cells), but for some reason child blueprints inside master bp do not work well. You need to dodge some bugs (or features).

So for you better approach would be making single blueprint for whole map. And that is quite complicated, so much that i would say, forget blueprints and code that thing in C++ as single object. Blueprints are great for small tasks, but they become unstable very fast when you try nested blueprints. And then you want your factory to be tiny bp that has animated gate, smoke lights (each of those is even smaller bp). They marketed UE4 as such, but it does not work (yet).

Some hints that could make it working for you:

  • make all those hex meshes are part of single blueprint. instead of static mesh make them all instanced meshes.
  • then for instanced mesh you have 2 options: all hexes same, you apply different material that is world coordinate mapped, or you have few versions of hex with different material.
  • make sure to turn off “create shadow” calculating shadows for so many dynamic meshes may be slow. For prototyping make all materials unlit with emmisive and no lights in level.

Try this first:

  • if any hex bp is reading other hex bp positions/rotations in construction script, dont! Not all hexes are spawned in construction time. Sometimes some of them read wrong values (first one created do not see ones created after them, and that order changes every time you move master bp). Variables inside other hexes work fine, its things like location, rot, transform that are messed during construction. Solution to this is to store all variables for those hex tiles inside parent blueprint. Or to spawn (just spawn) them all in construction, then at beginning of play fill their variables correctly (but that makes few seconds delay on begin play).