This project has moved and is read-only. For the latest updates, please go here.

Performance - loading objects

Dec 19, 2009 at 6:29 PM
Edited Dec 19, 2009 at 10: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?



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.



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