View Single Post
  #5 (permalink)  
Old June 14th, 2007, 07:14 AM
glenncottrell glenncottrell is offline
Registered User
 
Join Date: Jun 2007
Location: Brisbane, Qld, Australia.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to glenncottrell
Default

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;