• 13
• 18
• 19
• 27
• 10

# My game becomes slow after editing

This topic is 2805 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi again!

I have a problem with my 2D platformer and it's editor. First of all, I load a saved map and I get ~80 fps. Not as much as I would like to have, but still acceptable. After loading it is in the Editor-mode, so no physics (Bullet library) is done. When I start the game now, the FPS drops to ~35. Still playable. But when I go out of the game mode then, and place some blocks, sometimes the FPS goes down to ~5! And the craziest thing is: When I save the map, restart the game and load it up again, I have my old FPS back!

I'm using Direct2D as renderer and as I said above Bullet for the physics. And I have no idea how to profile them [sad]

EDIT: I meant to put this into the Game-Programming forum...

[Edited by - mind in a box on July 15, 2010 5:53:34 AM]

##### Share on other sites
EDIT: Hey you posting deleter!

Oh. Thank you for pointing that out. The physics was still running.
However, the physics is darn slow. When I add more frames, it becomes slow and when I remove them my player gets stuck in a block [sad]

Physics.DynamicsWorld->stepSimulation(FPS.GetElapsedTime(),100,1.0f/500.0f);

##### Share on other sites
step 1 would be to drop your game in a profiler.

But it is obvious that you are leaking some resource when you switch between modes.
Are you deleting your Bullet btRigidBodys from the simlution?
Are you removing everything from your update/draw lists when you change modes?

For the most part, is there ANYTHING that you reinitalize when you switch modes? You just need to check that it properly removed all the resources before letting them get added in again.

##### Share on other sites
Quote:
 step 1 would be to drop your game in a profiler.

I tried the AMD Code Analyst, but I have no idea what it tells me. When dealing with Direct3D I'm using PIX but I don't know if that works with Direct2D, too.

Quote:
 But it is obvious that you are leaking some resource when you switch between modes.Are you deleting your Bullet btRigidBodys from the simlution?Are you removing everything from your update/draw lists when you change modes?

Thats not how my editor works. Everything is kept, but in EditorMode nothing but the (debug)rendering call is sent to the blocks.

I found an issue in the physics code I think: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=5412

But the last time I got the damn low FPS I only placed background blocks which have no btRigidBody at all. However, I can't reproduce it yet. It seems to happen randomly.

##### Share on other sites
Quote:
 EDIT: Hey you posting deleter!

yeah that's true, but I though my post was far to vague so I removed it.

I'm glad that my suggestion worked!