Closed TheJosh closed 2 years ago
This shows up as massive slowdowns with more than 15 to 20 zombies in the game world - even on a high end machine
I've done some testing on my main computer, an i7 4970K with 16G ram and a GeForce GTX 650. I'm aware the game isn't multi-threaded, so will only be using one core. Also it's so simple that the GPU is barely doing anything.
The two game types were dropping in 50 powerups, and dropping in 50 zombies. All of the game types and maps are in the test
mod. The zombies were spawned with a dummy AI which doesn't do anything.
Map | Powerups | Zombies |
---|---|---|
General | 430fps | 14fps |
General | 448fps | 15fps |
Blender import | 632fps | 28fps |
Blender import | 613fps | 30fps |
Caves | 645fps | 90fps |
Caves | 645fps | 87fps |
It's pretty clear that the issue is with the zombie physics, and while it's better on mesh maps (e.g. caves), it's still pretty bad - those frame rates wouldn't hold if you had a real game going on. Of course, heightmap based maps are horrible.
I did a quick test on my work computer as well, and also included a game type which does absolutely nothing:
Map | Powerups | Zombies | Nothing |
---|---|---|---|
General | 130fps | 7fps | 196fps |
Blender import | 232fps | 17fps | 257fps |
Caves | 239fps | 37fps | 345fps |
This computer is older and slower - Athlon 7750 dual core, 4 gig of ram and a much crappier GeForce 9600 GT video card - so I'd expect worse scores, but this is also much more in line with my target hardware, so this is where the scores matter much more.
I just commented out this (critical) line in the Unit
class:
st->physics->addAction(character);
And got these figures on the "General test" map on my work machine: Crates 137fps, Zombies 52fps
Obviously I cannot have units without the KinematicCharacterController
, but I've at least confirmed where the problem lies now.
This has been ongoing.
I've isolated it to the convexSweepTest from the KinematicCharacterController. When it hits a btHeightfieldTerrainShape, it takes forever to convex sweep (most of the time is in
processAllTriangles
). When the same test is done against a btBvhTriangleMeshShape, it appears to be much faster.