Windows 8 – Farseer Physics Engine – Different result in local machine and simulator

Topics: Developer Forum
Jul 20, 2012 at 1:49 PM

Hi,

I am developing one game with windows 8 and farseer physics. When I play the game in local machine while development, the result is excellent and it gives me 58-60 FPS.

However, when I check the same result in simulator, performance is 25-30 FPS and also the behavior of object seems different which is really strange.

Is there any specific property that I am missing right now which will make my game working fine in simulator too since ultimately the game should work in all platforms perfectly.

Any guidance would be great help. Thanks in advance.

David Jacob

Jul 20, 2012 at 3:12 PM

Is your timestep fixed?

Jul 21, 2012 at 4:53 AM

Hi,

We are using default TimeStep, however, we tried putting 0.2 but things fall down in simulator. We have removed restitution from floor and object. We kept in left and right wall only.

Is it fine?

Jul 21, 2012 at 6:17 AM

Hi,

Here is the code.

<FarseerHelper:PhysicsCanvas x:Name="PhyCanvase">

<FarseerHelper:PhysicsSprite x:Name="cnvBox" Height="64" Width="64" Loaded="cnvBox_Loaded">

<Image Source="box.png" ></Image>

</FarseerHelper:PhysicsSprite>

<FarseerHelper:PhysicsSprite x:Name="Floor" Canvas.Top="692" Width="1310" Height="120" IsStatic="True" FrictionCoefficient="1" RestitutionCoefficient="0.4"/>

</FarseerHelper:PhysicsCanvas>

C#:

Vertices ver = PolygonTools.CreateRectangle(0.53f, 0.53f);

PolygonShape poly = new PolygonShape(ver, 1.0f);

poly.ComputeProperties();

Fixture fix = cnvBox.BodyObject.CreateFixture(poly, cnvBox);

fix.Body.Friction = 0.5f;

fix.Body.Restitution = 0.3f;

When I play the game in local machine while development, the result is excellent but when I check the same result in simulator, the behavior of object seems different on both. The main issue is dynamic objects jumps sometime in the simulator. For that, I tried remove restitutionCoefficient from floor and objects but still issue is same? Can anyone please advice on this?

Thank you in advance.
David Jacob