Modular destructible building optimization

Hi all. I need help with building optimization which is created from parts. I need the each part can take damage separately. So I created several peaces like wall 1x3, door, window, floor etc. After that I wrap each of them by blueprint (I expect calc damage here). So I created test house from arounf 100 peaces and faced with FPS drop. For empty map FPS falls to 80 from 120. After LOD generation 90. I guess it too much for empty map without lighting, decor stuff etc. How can I optimize it? Or maybe there is a different way to implement what I need.

Any help would be appreciated)

Hi, whats your result from the console command stat unit ? And you test performance in standalone, right?

1 Like

HI chrudimer! Thanks very helpfull command stat unit. Need to write it down) Unfortunatelly I can’t test it now because I fixed main FPS loss issue.
I tested it in Editor, not standalone. I guess it’s not correct way, but I was surprized when I had loss around 40-50 FPS for this simple geometry. But actually I’ve just found and implemented solution, which helped me return back 120 FPS. The key is Merge Actors and UInstancedStaticMeshComponent. I put all non-destructible geometry to single actor and rest doesn’t affect FPS to much. Maybe there is a way to combine destructible geometry to UInstancedStaticMeshComponent as well, but it’s seems too complicated (I want to use APEX destruction as well) and I don’t know how to register hit to specific component item ( one InstancedStaticMeshComponent may contain lots of walls for example and hard to calculate which is actually damaged)

You need instanced actors.
You could try placing the blueprints with the foliage tool maybe.

Otherwise the correct way to do it is to swap out instances at runtime so that not everything is a blueprint with a specific mesh.
Still, convert enough objects and you’ll have an fps drop unless you do things intelligently.
(Like swapping between different instances of destruction rather than having fully simulated breaking).

I guess you could do what my dynofoliage plugin does.
Swap all meshes in a predefined radius to blueprints so that they are ready for interaction.
Convert them back to static as you move away…
Heck, maybe even just a visibility cone that matches the cull fustrum instead of a sphere…

1 Like

Thanks you for reply, MostHost_LA. Yes Instanced Actor works good enough. Because my map is grid based, I could even calculate what part of instances actor was affected by hit and remove only that part of instance. I postpone if for now, will back to it a bit later.
OF topic, sometimes I don’t understand how local transform works in UE ) For example I added Destructible component to Actor where Static mesh is root comp. When I place this BP to map I have following issue

So Destructible component is placed to 0,0,0 in World coordinates instead of local.

NVM: ->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform); resolved the issue