Huge lag when using the Physics System
Posted: Sat Jun 23, 2012 5:28 am
Hi, I'm a newbie on programming and creating games, started testing everything a few days ago
. I'm using C# and XNA, and implemented the BePu physics (It was very difficult to discover how to and I didin't finish reading all the demos yet, but it's very organized and this physics system is helping me a lot, either to understand how to create a game and to learn more about programming, 'cause I don't know too much yet). It was very difficult to create this forum account because the questions were kind of complicated and I took many wrong guesses....
Anyway, it was everything OK until now: I'm creating a new game inside (with implemented) BePu physics (".dll" files) and I need to create many and many BePu Box objects in Kinematic state, for creating the map, that I want it to be editable inside game. So the problem is that, after creating just a few box (about 60), the FPS gets a very low rate. I don't know how much is the rate because I didin't create any FPS meter but I get a really huge lag when controlling my testing cube-character through the map. If I disable the physics, everything gets back to normal. And I saw some topics here: <http://bepu.nfshost.com/forum/viewtopic.php?f=4&t=1704> and <http://bepu.nfshost.com/forum/viewtopic.php?f=4&t=1614>, but I tried to use those orientations and I got no result. I don't know if that was because I don't know how to apply them correctly or if it's not the case. The thing is that I don't know too much about changing the time step (is there any code example?), but I did apply the "SuperSpeed" configuration but without successful results. I tried to create "space.TimeStepSettings.TimeStepDuration += 1 / 320" still with lag and "space.TimeStepSettings.TimeStepDuration += 1 / int.MaxValue - 1" with my objects teletransporting and disappearing
, and I programmed this setting at every game's "Update(GameTime gameTime)" call. I don't remember now, but i tried that StepDuration value with one that I got my physics stucked, not working. I guess it was "+= 2". How should I really configure that correctly?
So, is there any suggestion for what I could do?
I was creating the game until today and I'll pause a little until find for this problem a solution, otherwise my game won't run if only with 60 boxes it already slows down. Thanks for any reply.
Cordially, Arthur.
PS: there are just kinematic objects now, and my testing cube-character is the only one that is dynamic.

Anyway, it was everything OK until now: I'm creating a new game inside (with implemented) BePu physics (".dll" files) and I need to create many and many BePu Box objects in Kinematic state, for creating the map, that I want it to be editable inside game. So the problem is that, after creating just a few box (about 60), the FPS gets a very low rate. I don't know how much is the rate because I didin't create any FPS meter but I get a really huge lag when controlling my testing cube-character through the map. If I disable the physics, everything gets back to normal. And I saw some topics here: <http://bepu.nfshost.com/forum/viewtopic.php?f=4&t=1704> and <http://bepu.nfshost.com/forum/viewtopic.php?f=4&t=1614>, but I tried to use those orientations and I got no result. I don't know if that was because I don't know how to apply them correctly or if it's not the case. The thing is that I don't know too much about changing the time step (is there any code example?), but I did apply the "SuperSpeed" configuration but without successful results. I tried to create "space.TimeStepSettings.TimeStepDuration += 1 / 320" still with lag and "space.TimeStepSettings.TimeStepDuration += 1 / int.MaxValue - 1" with my objects teletransporting and disappearing


So, is there any suggestion for what I could do?


Cordially, Arthur.

PS: there are just kinematic objects now, and my testing cube-character is the only one that is dynamic.