Game Development Community

PC vs XBOX (Glitchy vs Non Glitchy) + Speed Issues

by Aaron Scovel · in Torque X 2D · 09/22/2010 (6:55 pm) · 4 replies

Since day one,
when I run "debug" on x86 and Xbox 360, the two platforms give me completely different results.

Example1:
#if XBOX
// Xbox
                powerWheel.Rotation += 1;
#else
// PC
                powerWheel.Rotation += 8;
#endif
Xbox/PC ratio 1:8

Example 2:
#if XBOX
// Xbox
                sprite.VisibilityLevel -= 0.01f;
#else
// PC
                sprite.VisibilityLevel -= 0.08f;
#endif
Xbox/PC ratio 1:8

Example 3:
#if XBOX
// Xbox
                Vector2 NewForce = new Vector2((-T2DVectorUtil.VectorFromAngle(gun.Rotation).Y * 8000) * (_power1 + _power2), (T2DVectorUtil.VectorFromAngle(gun.Rotation).X * 8000) * (_power1 + _power2));
#else
// PC
                Vector2 NewForce = new Vector2((-T2DVectorUtil.VectorFromAngle(gun.Rotation).Y * 1000) * (_power1 + _power2), (T2DVectorUtil.VectorFromAngle(gun.Rotation).X * 1000) * (_power1 + _power2));
#endif
Xbox/PC ratio 8:1

Example 3 (8:1) blows the whole 1:8 speed ratio theory I had out of the water!

Now besides the whole speed difference, there is a bigger, MAJOR issue:

PC run = Glitchy (basically, nothing works like it should - collisions are glitchy, I can glitch through walls, go into another items polygon, this is even noticed greater with the farseer physics engine - welds act like springs, static items can still be pushed, etc)

Xbox run = Solid (no glitches, and the ones I do find, I can fix)

I have been told to set UseFixedTimeStep to True
<UseFixedTimeStep>true</UseFixedTimeStep>
This fixes almost all the problems on the PC, however, now the XBOX is glitchy as H.E.Double Hockey Sticks!!

Does anyone else experienced this?? Is this just a workstation issue? Time to get a new computer?

Here are my PC specs:
Windows Vista - Home Premium
Intel Pentium (Dual Core) e2180 2.0GHz
2 GB of RAM

About the author

Previously a PHP/MySQL Programmer/Web Developer of 10 years. In Aug 2010 I decided to change careers, and this is were I landed! I also parent 3 kids full time. TopNotched.com


#1
09/22/2010 (8:05 pm)
Yeah... you are having issues because your math is not incorporating the delta time. Simply figure out how much you want your wheel to spin, and multiply it by the delta time /elapsed value in the process tick.

IE:

Spin once per second

MyObject.Rotation += 360*elapsed;
#2
09/22/2010 (8:55 pm)
@Will: Thanks for that pointer! I just got done testing with Example 1 & 2 and they have the same speed/duration on the different platforms. Do you suggest having the velocity of an object also based on the elapsed time? In regards to Example 3, I have this setup in my movement component:

public void Fire()
        {
            // Make sure the gun hasn't been fired already
            if (!_gunFired)
            {
                #if XBOX
                Vector2 NewForce = new Vector2((-T2DVectorUtil.VectorFromAngle(gun.Rotation).Y * 10000) * (_power1 + _power2), (T2DVectorUtil.VectorFromAngle(gun.Rotation).X * 10000) * (_power1 + _power2));
#else
                Vector2 NewForce = new Vector2((-T2DVectorUtil.VectorFromAngle(gun.Rotation).Y * 2000) * (_power1 + _power2), (T2DVectorUtil.VectorFromAngle(gun.Rotation).X * 2000) * (_power1 + _power2));
#endif
                
                // Apply the NewForce to the bullet/ball
                Ball.ApplyForce(NewForce);
                _gunFired = true;
            }
        }

Since ApplyForce only happens once, It would be pointless to update the vector in the processTick. The only thing I can think of is placing the ApplyForce in the process tick (but this would then take away the physics, unless... I ran it for say only 1 second).

@Anyone: Any ideas on the glitches, The "MAJOR" issue?
#3
09/22/2010 (9:45 pm)
Well setting an objects Velocity should be ok, since the velocity is also time based it will act the same way I said before. er, applying force should do the same thing.. Just changes it's velocity. As for the collision, um, two suggestions.

1. Move some of your walls around, or watch the speed of the objects as they approach them, if a specific set-up is causing issues, change the set-up, or get ready to get your hands dirty inside the physics engine.

2. Take a look at how you are integrating the two physics engines, Farseer and TX, if they aren't playing nice, try to separate them in those area's, so they aren't bouncing off each other too much, or anything, so you'r player can't collide with both simultaneously, if thats whats happening.
#4
09/28/2010 (6:05 am)
Thanks Will,

Regarding the Collisions: Its not like that (1 or 2), basically everything is defunct on the computer, and the issue was taking place before Farseer, just more apparent with Farseer. I will try to get a video up within the next few days so you can see what I'm talking about.

Maybe its because I'm running in debug and not actually publishing a windows game? I should test that out.