Download

Physics Question

Howdy all;
So I’m working on my game and its enemies run on physics. Right now they are just cubes. They spawn and force is applied to them and they are pushed along towards the player to attack when in range.
I am hitting a wall with enemy counts at around 500. Any more than that and the frame rate starts to take a nose dive. Its seem weird to me though that even if I add in more complicated lighting or textures the frame rate stays the same. I guess its not to weird since physics is most likely computed in one place and rendering of those things in another. So I guess my main question is:

Does anyone know what I could do to reduce the lag in physics computations so I can get more enemies on screen?

Thank you so much for any help :slight_smile:

The number of things there is the issue. I’m not sure you can use physics still and using instancing to decrease draw calls.

Using physics is probably the problem; that’s a lot of simulated physics actors.

The reason you can add more textures or lighting is because you are probably cpu bound and those only need more gpu.

You can use ‘stat unit’ from console to see gpu/cpu costs.

Could be draw calls or physics (both cause cpu load).

Thank you all so very much for the information. Yeah, its a lot of enemies, I am asking a lot of the physics engine, but that’s the fun heheh.
So first up I shall go run a Stat UNIT and take a screen shot to see if that will hopefully lead to some more clues to a solution.
ALSO! Perhaps… does anyone know if a slick way of cheating in some more enemies? Maybe having and additional enemy be located between existing physics enemy actors to add a third more?

You can try enabling Async scene in the project settings.

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/PhysicsEngine/FBodyInstance/bUseAsyncScene/index.html

Then in the physics actors check “UseAsyncScene”

Dynamic objects that will block the physics actor need to have “CheckAsyncSceneOnMove” turned on. Otherwise static geometry will block them by default.

Good Luck!

Saweeet :smiley: . Thank you so much. This should totally help.

Well Async did get my frame rate up by about 4 fps wich is a nice big jump, but sadly all my physics characters are now flying around as if they are in zero G. Any idears there?

ecd3f69191d503bd3949015d5219e86d10c572b2.jpeg

Also here is the results of the Stat UNIT and FPS

The stat unit stuff is missing?

My apologies, I guess my image prolly didn’t load right I shall type it in

Without Async
Frame:24.12
Game:24.15
Draw:14.28
GPU:24.15

With Async
Frame: 23.03
Game: 23.06
Draw: 14.45
GPU: 23.15

So it was a very noticeable improvement. Especially while wearing the VR headset, there were no sudden stutter steps or hang ups in frame rate. Where as without Async there are a couple here and there that were pretty jarring. I tried only self illumination too and that changed nothing so its defiantly a physics wall. BUT, I may just have to call it good at 500. Which is a veritable **** ton lol. I can add a second character following just behind each of the physics character with a random offset of some kind and that should do the trick :slight_smile: . If I can get the physics to behave itself while Async is on though that would be awesome.

Do I need to change anything else besides turning Async on in the project settings then turning it on inside the actual physics actors physics object?

Thanks again so very much for any help, Its all very very appreciated .