p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 (http://p2p.wrox.com/forumdisplay.php?f=325)
-   -   Pong and Breakout weird jerk moves. (http://p2p.wrox.com/showthread.php?t=58392)

alexmbr May 26th, 2007 04:25 AM

Pong and Breakout weird jerk moves.
 
I finished now the chapter 2, and after trying the breakout game, I notice that the ball and paddle sometimes make some weird jerk moves. And that was also happening with the Pong game.
Why this is happening?


Zulbaric May 29th, 2007 08:09 AM

Maybe youve got a slow PC??


abi.exdream.com May 29th, 2007 03:44 PM

The framerate might be too high or too low. You can fix it by setting a fixed framerate in the Initialize method, maybe that helps. The first couple of games were developed really rapidly, the later games should work better.

http://abi.exdream.com

alexmbr May 30th, 2007 07:23 PM

Zulbaric, my machine is not a slow one.

abi.exdream.com, I just tried the xna shooter and racer and I still see the same problem, but with so much intensity as the pong and breakout games.


glenncottrell June 14th, 2007 07:14 AM

I too noticed this occasional jerking of game movement and tracked it down to spikes in the elapsed time.

moveFactorPerSecondTotal: 0.008294599 : 16.5892
moveFactorPerSecond: 0.008 : 16
moveFactorPerSecondTotal: 0.0078088 : 15.6176
moveFactorPerSecond: 0.008 : 16
moveFactorPerSecondTotal: 0.0167239 : 33.4478 <-
moveFactorPerSecond: 0.008 : 16
moveFactorPerSecondTotal: 0.0167239 : 33.4478 <-
moveFactorPerSecond: 0.008 : 16
moveFactorPerSecondTotal: 0.00822645 : 16.4529
moveFactorPerSecond: 0.008 : 16
moveFactorPerSecondTotal: 0.00827825 : 16.5565
moveFactorPerSecond: 0.008 : 16

So from this I simply changed the following
Code:

//float moveFactorPerSecond = 0.5f * (float)gameTime.ElapsedRealTime.TotalMilliseconds / 1000.0f;
float moveFactorPerSecond = 0.5f * (float)gameTime.ElapsedGameTime.Milliseconds / 1000.0f;




alexmbr June 15th, 2007 05:42 PM

That didn't help.


TomPinnock June 26th, 2007 07:42 AM

Has anyone else had this problem and managed to fix it?
Like the original poster, all the projects move quite jerkily.
I've not got a slow computer.
I tried Glenns idea - Better, but still jerks.

Maybe the framerate's the way to go, but I'd like a way of setting that up per PC configuration? Otherwise it would look great on my pc, but rubbish on others.

Other than this, everything's working brilliantly, and can't wait to knock up my own game with the engine!

Cheers,
Tom.

emor June 26th, 2007 11:05 AM

Tom,

a bit of a spill over from my other post on blank screens but I am curious... when you say "other than that everything is working brilliantly" are you including the XBox 360 too? Because I agree everything is working very well on Windows (I see the issue with some jerkiness too, notwithstanding) but on the XBox I can't get the games to work for the reasons explained in my other post...

thanks for your comments.

TomPinnock June 26th, 2007 11:57 AM

Ah... no.
Afraid I don't own a 360 yet. I was planning on seeing how far I got with my game before splashing out on that.
I was hoping Ben would have had some time to look at this problem.
Ah well, maybe I'll actually look at it myself instead!

Tom.


llonden June 26th, 2007 01:42 PM

I too am having the same problem, and the suggestion I get the most is to check the game's framerate. Any clue on how to do that???


All times are GMT -4. The time now is 06:21 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.