Performance - loading objects

Dec 19, 2009 at 5:29 PM
Edited Dec 19, 2009 at 9:55 PM

What is the best approach considering performance in a sidescroller game using Farseer? The thing is that I lose FPS in the bigger levels.

A: Load all objects and use the inactivity controller and disable everything outside the screen boundary. The problem is that enemies and projectiles cannot be updated outside the screen boundary.

B: Load only the objects within the screens boundary. Meaning that as soon as someting leaves the visible area it get's disposed and when the player walks back again the objects are always restored in their original state :(.

C: Some better solution or am I doing something else wrong?

 

P.S.

Currently I use large objects instead of a tiled approach. For example, I use 1 1024x32 tile instead of 32 32x32 tiles. I thought large objects are better vs tunneling and the less objects for Farseer to handle the faster the collision detection.

 

EDIT:

I got it. Placing sensors that trigger the geometry loading/unloading/enabling/disabling did the trick :).