AI taxing GPU?

Hello,
Been doing some preliminary tests of performance and I noticed that enemy characters with AI attached are taxing the GPU quite heavily, but barely touching the CPU. I’ve transitioned my AI away from event tick and made it event/function based, so I wasn’t expecting any kind of heavy CPU hit. What doesn’t make sense to me is the GPU draw however.

In the picture below I have over 300 of these skeleton guys following me. Each is ~20k verts/polys. Expect that to be a decent performance hit (never intend to have these many active AIs at a time, this is just for testing):

Now in the next picture I have the same skeletal mesh, with no actual AI. Except they collapse after 3 seconds. This time there’s over 500 of them.

Roughly the same hit on the GPU. Alright, I can live with that. Even though there’s a lot more being rendered I guess that’s not too bad. Please note that adding an animation blueprint (the same animation blueprint) to the collapsing guys didn’t impact performance.

Now here’s the same skeletal mesh with AI attached, doing it’s shizzle. This time there’s only 77 of them.

So my question is, is this normal? Have I mucked something up horribly? I don’t understand why the AI would be so incredibly heavy on the GPU whereas the CPU draw is neglible. The only addition to rendering in the last picture is that each of my skeletal friends have a sword in their hand. Roughly 450 verts on that one.

Can’t imagine hardware specs would be relevant to this since, but i5-8600k and 1070 ti. Also tested with F5 (shader complexity) and it’s all perfectly green.

Here’s a picture of the GPU profile that I took while all of these guys are chasing me and GPU in the red @ ~80ms

Its quite the oposite, the GPU is limited by the CPU bottleneck. Game thread is the CPU one, the Draw ms is the GPU render time.

Ah so I’m just an idiot. Thanks :slight_smile: Seems like AI optimization is the key to progress here.

Thanks again for this, silly thing to get the two mixed up like that. Was able to nail down what was causing the issue in any case.

Same amount of enemies, still playing in viewport, less than a third of the cost. It was a simple BPI that was highlighting the enemy closest to the mouse position. I had set it to mouse movement for testing purposes which caused it to get fired all the time at anything that passed the cursor. Taking it off mouse input and setting it to a repeatable event completely changed the performance.

This was extremely helpful as I’ve been super stingy with my polys when designing characters and objects and this tells me that when I can have 70 of those guys animated on screen and still maintain 60 fps, I could easily increase the detail of my playable chars by double without any issues (it’s only 27k right now), which then allows me to do actual sculpting instead of trying to create every feature with textures. Of course this will be different in an actual scene with objects and lighting but still, it’s a load off my mind :slight_smile: