Hey guys, I've been coding a game for a few months and we ended up implementing Farseer into the game a while back. It's been really awesome for all of the 2d stuff that we need to do, however we're now running into performance issues now that we've got
a lot of stuff going on.
What we're doing is pretty much this (Same functionality as this game):
The game runs fine when you're flying around a ship and bouncing off of static objects. But when we start getting a lot of bullets on the screen, it gets mega laggy. The SolveIsland (Or whatever it's called) in the CLR shows 95% utilization of the game when
we have about 600 bullets on screen. I'm not sure if that's normal or not, but it's been frustrating trying to debug. I've been working on it for weeks now with minimal success. I've toggled the isBullet flag, I've manually told stuff to sleep or be awake.
Sleeping is allowed. I'm disabling bodies that aren't in use. We've got an object pooling for bodies. I've used Body.Deepclone(). Got a lot to think about!
What's come to mind recently is multithreading. That seems like the key, because when the physics engine gets laggy it's in the same thread as the drawing and player input. So if we can draw at 60fps while the physics runs at 10, I don't think the player
would mind as much. The thing that really is unnerving is not being able to close the application while the game is crunching away. :P
I'm hoping that I'm making a newbie mistake and that somebody can direct me to a thread that makes me go 'doh!' but I haven't found anything like that on google. There are not many threads that are applicable that I can find.