I’m working on a scene where I need around 100 characters with character movement. I’ve made the characters run as efficient as they can in their Behavior Trees, but I can’t get my in-game frame rate above 30 FPS. And this is on a pretty beefy PC:
i7 6700K
32GB DDR4
8GB GTX 1070
The odd thing is I tested the exact same scene on two different friends’ lower end PCs and they were running at 60-80 FPS with worse hardware. And on my own PC, if I replace the characters with static actors, the game jumps to 90 FPS.
Is there something I’m missing on characters and character movement? What could be making it so much more expensive to run on my system than anyone else’s?
Side note: I’ve tried reformatting, virus scanning, malware scanning, registry cleaning, etc. and nothing has yet improved by PC’s performance.
Was in your tests the game playing with exactly same scalability settings? Which was the scalability for each equipment tested? Which is the main light type in use in the scene?
It might be your equipment is running on Epic and theirs High or Mid. From the FPS range, theirs might be in Mid. Also, dynamic lighting has significant difference in Mid settings when compared with High and Epic whish uses far more robust shadowing.
Changing engine quality settings down to Medium and even Low has no impact on frame rate, unfortunately. My friends’ settings were on Epic just like mine as well.
So I ran a few tests on the scene with 100 characters with different settings to see the FPS differences:
Remove any code that moves characters: 40 FPS
Remove AI controller from characters: 55 FPS
Spawn static actors instead of characters: 95 FPS
My hope is that on my pretty beefy machine the game should run at least at 60 FPS. So the fact that even with no code running on characters I can’t hit that is a bummer.
Dumb hardware question. Do characters tax CPU, RAM, or GPU in a way that static actors don’t? My only other thought right now if there’s something wrong with one of my computer’s hardware that is causing this issue.
Is there an integrated video in your system? Maybe the onboard integrated video (which usually is slower) is being used to calculate physics instead of main GPU.
Having 100 characters all animating at full LOD, and using BTs/Perception/etc can strain the PC. If they are not on screen, there are tricks like not updating the skeleton with animations when you cannot see them (or using level streaming). If you have 100 characters, I’m assuming the AI isn’t too detailed. Could you run some of it in the Controller, instead?
I checked and scrubbed everywhere in the NVIDIA settings just to be sure. Nothing but my GTX1070 is being used in applications.
Yes, I have profiled my game before. It helped a lot to cut out inefficient code. For instance, in an early version, I was having all of my 100 characters run a ForEachOf loop every few frames. That was a bad idea! So I switched that to a global game state. I think I have the characters to as efficient as I can get them. There are probably a few more tricks to save a few more frames here and there, but it’s gotten pretty clean by now. Now character movement is account for about 70% of the performance hit in my profiling.
The real issue is that on any system that isn’t mine, the game runs much better. So this is an issue with the game disagreeing with my particular hardware. I was hoping maybe there was some setting I wasn’t aware of in UE4 that could be causing the issue.
I’ll run some diagnoses on my GPU. What I’m gathering is that is the thing taxed the most on character movement. I’ll update the thread if I find anything from that.
Do you think you can package a test demo with all those 100 characters for me to run in my system? Just for the sake of having another machine running it and for me to observe. I got two hardware setups to test it: AMD 9370 at 4GHz with GTX 1080 32GB RAM and R7 1700 at 3.7GHz with GTX 1080 32GB RAM (exactly same GPU, 8 vs 16 cores, DDR3 1600 vs DDR4 2133.
Trying to package up the level is hitting some build errors for me, sorry! I haven’t packaged up projects for external testing yet, so I’m probably doing something wrong. I’ve been sharing the full project file with friends through our Perforce server up to this point.
Yeah sometimes fails packaging for a number of reasons. If you want to try you just delete the Saved and Intermediate folders, if it is a C++ project you right-click the .uproject file and select “generate the visual studio project files”, open your project and try build again. I would hold until you can package, the profiler stats file would not be of any help right now, without seeing the whole thing in action.
Are the characters using physics assets? I found in my game that disabling collision on the skeletal mesh till it was needed really helped with so many characters.
Might be a little bit late to the party but for those who might come across the issue at some point. Check your Animation Blueprint and under the Anim Graph tab, check that Root Motion Mode is set to No Root Motion Extraction. This instantly resolved my issue after looking through my blueprints. Hope it helps.