My Farseer game is too slow... why?

Topics: Developer Forum, Project Management Forum, User Forum
Jan 4, 2012 at 6:17 AM
Edited Jan 9, 2012 at 6:58 PM

Hello everyone (again).

So, I've tried to do many things to solve it but I can't, one of these problems are that I have to use bigger numbers to apply forces, like 50000.

I thought that it was my mistake, but I've copied exactly another code that works ok, but the mine don't work as i want.

So, I know that my post is a little confuse, but i beg for your help, please. XD

Here is a link to download my project: http://www.megaupload.com/?d=VGQAMQM3

Jan 9, 2012 at 6:57 PM
Edited Jan 10, 2012 at 3:41 AM

14 people downloaded my archive, but no one could help me?

Developer
Jan 10, 2012 at 9:21 AM

Hi,

it seems you did not scale your units to mks (meter, kilo, seconds) but work with pixels instead. Do a search for "mks" and "scale" on this discussion board. It has come up here at least a dozen times.

Also take a look at the "Hello World" sample for a really simple example.

Jan 10, 2012 at 6:34 PM

thank you, now it is working rightly.

I've implemented the convert unit class that i found here

and this:

 

        private int RoundToInt(float inFloat)
        {
            int retInt = (int)inFloat;
            if (inFloat - retInt >= 0.5f)
            {
                retInt++;
            }
            return retInt;
        }

        protected override void Draw(GameTime gameTime)
        {
            spriteBatch.Begin();
            spriteBatch.Draw(charTex, new Rectangle(RoundToInt(ConvertUnits.ToDisplayUnits(character.Body.Position.X)), 
RoundToInt(ConvertUnits.ToDisplayUnits(character.Body.Position.Y)), 49, 65),
new Rectangle(0, 0, charTex.Width, charTex.Height), Color.White, 0,
new Vector2(charTex.Width / 2, charTex.Height / 2), SpriteEffects.None, 0.5f); spriteBatch.End(); base.Draw(gameTime); }

 

 

to draw my texture, thank you.

Jan 14, 2012 at 1:06 PM

round to int can be done better:

return (int)(inFloat + 0.5f);

Jan 17, 2012 at 11:49 AM

I'll try to do this.