Performance problems with StaticMesh
Posted: Sun Mar 04, 2012 5:34 pm
Hi.
I'm building a game which has really large procedurally generated environments. At the moment, I'm generating the world in 16m3 cubes and then streaming the geometry of the cube into the graphics engine and the physics engine. So whenever one of these cubes is updated, I do this:
I assumed that large numbers of static meshes wouldn't be a problem for the physics engine, but as the world grows I start getting pretty bad performance problems. When geometry is streaming (and the method above is being run) I'm seeing update steps taking 20-30ms, even once streaming is done and it's just a static level with a single FPS character running around I'm seeing Space.Update take a fairly steady ~13ms
I profiled the game loading in a 1Km2 city block, which is ~25000 StaticMesh objects, and got these results:
As you can See, for some reason the Broadphase is taking up a huge amount of time, even once the level has finished loading at no more StaticMesh objects are being created!
Any suggestions for how I can improve performance here?
Thanks
I'm building a game which has really large procedurally generated environments. At the moment, I'm generating the world in 16m3 cubes and then streaming the geometry of the cube into the graphics engine and the physics engine. So whenever one of these cubes is updated, I do this:
Code: Select all
public override void MeshUpdated(StaticMesh mesh)
{
//Remove the old version of this mesh
if (PhysicsMesh != null)
physics.Remove(PhysicsMesh);
//Add the new updated mesh to the engine
PhysicsMesh = mesh;
physics.Add(PhysicsMesh);
}
I profiled the game loading in a 1Km2 city block, which is ~25000 StaticMesh objects, and got these results:
As you can See, for some reason the Broadphase is taking up a huge amount of time, even once the level has finished loading at no more StaticMesh objects are being created!
Any suggestions for how I can improve performance here?
Thanks