I tried running my test application on my reasonably fast Windows desktop, and it runs quite a bit differently than on my MacBook. While the physics seems to get updated at the same rate, the logic seems to run faster. In my case, this means a higher rate of acceleration can be applied to the marble, presumably because there are more applications of torque per second. It is, of course, essential that the internal clock of a game is paced with real-time so that game-play is consistent across machines.
I found a good thread on the forum addressing this issue. It appears that there are at least two ways to handle this. One is by using a built-in multiplier -- time-per-frame (tpf) -- when doing things like updating player positions. The other is by using FixedLogicRateGame. This second approach won't work for me -- I'm extending SimplePassGame -- but I may be able to add functionality from this class into my own.
For now I'm taking the easy approach: adding tpf as a multiplier when torque is be applied to the player. After tweaking the numbers to get the behavior I wanted on my Mac, I tested it on my Windows desktop. Both systems now behave identically.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment