My game is getting some pretty poor performance, and I’m wondering what to do about it.
My rig - Mobile 3060, I9-11980HK CPU, 64 gig ram.
Base FPS - 70.
For every 6 characters I add to the scene I lose ~12 fps (down to 24 fps with 24 characters).
Each character has 12 mesh components (mix of static and skeletal, they represent the characters’ equipment pieces which can be changed on the fly). It doesn’t seem to be a problem with my meshes/materials/textures; I’ve tried out some different meshes/materials/textures and always get a similar result.
Am I wrong in thinking that UE5 can handle this many meshes? I want to be able to have 80+ characters on screen without breaking the game. Should I be welding the different meshes together for each character and then starting over and welding another mesh for them each time they change any piece of equipment?
My game is top-down, so I don’t think LODs are the solution, since all characters are pretty much the same distance from the camera.
Well in the current state each component is a separate draw call. If you factor in separate materials then it’s going to be pretty dire pretty fast
1 character = 12 components + 12 materials + base mesh + base material.
Probably around 26 draw calls per character and even more if the materials are layered and complex.
Are you at least using the master pose component to offset some of the mesh deform calculations or are you just running animations in parallel?
It is very unlikely that the number of components is the problem by itself. While there is some overhead per component, that usually starts showing up when you’re talking 10,000 components, not a dozen.
First, is this in editor, or in a release built game?
Second, if you make the window smaller/bigger, does it change FPS? If it doesn’t change, then you’re CPU limited much more likely than GPU limited.
Reducing window size does improve performance by a decent amount, but it’s kind of hard to tell by exactly how much, because I lose screen space to render everything (viewpoint shrinks).
That said, reducing my screen resolution from 2k to 1080 gives me a boost from 24 fps to 29 fps.
29/24 is about 1.2, so you’re pixel shader limited to that degree then.
Note that the editor will also use some available resources, so the best benchmarking is done in a packaged and built stand-alone game (in release mode.)
In general, there are many things that can affect performance (textures, filter modes, pixel shader complexity, geometry complexity, driver versions, CPU performance, cooling solution, disk performance, available RAM, available VRAM, …) and you need to carefully consider and measure each of these parameters to figure out where optimizations will help.
There are some tools built in to the engine itself to do this, and a fair number of articles about performance debugging and tuning. Part of developing a high-end game is doing this work to run on your target hardware – no way around it!