Posts tagged windows

I’ve recently started doing more work on the levels for PhysiBricks. I found that the Farseer Physics Engine was behaving differently in Windows Phone 7 than in Windows. Of Course, I wasn’t sure why this was, but believed it had more to do with the differing performance between the two devices. This was a big concern for me, because I wanted to be able to edit the level files while the game is running in windows and just reload it (No in game editor yet.) My hope was that if I could get the physics behaving the same in Window Phone 7 and Windows, I could do all my level development in Windows and then do final testing in Windows Phone 7.

After much searching on the internet I found that my problem was related to the “IsFixedTimeStep” and “TargetElapsedTime” properties on the XNA Game object. In Windows “TargetElapsedTime” defaults to 0.01667(60fps) and “IsFixedTimeStep” was false. In my Windows Phone 7 build, “IsFixedTimeStep” was true and “TargetElapsedTime” defaults to 0.03333(30fps).

By setting IsFixedTimeStep to true in both builds and setting the TargetElapsedTime to something that worked well in both environments 0.02(50fps), I was able to get the physics to behave the same in both environments. Yay!

Of course, it looks smoother in Windows cause it renders at 60fps, but at least the physics behave the same.