Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualhaegarr

Posted 10 July 2013 - 01:29 AM

IMHO the loop suffers from the following quirks:

 

1. It makes no sense to render although the state isn't updated, because the rendering produces exactly the same image as the rendering before. (However, it is okay if you expect game->Render() to last longer than the 1/60 seconds in the real game.)

 

2. The conditional (elapsedMS % 1000 == 0) becomes true in exactly 1 millisecond per second, assuming that SDL_GetTicks has a real resolution of at least 1 millisecond. It is very unlikely that this condition is hit in the way as wanted. (See also Ectara's comment above.)

 

3. The way you compute FPS//UPS (letting issue 2 aside) gives the average FPS//UPS since the very beginning. This means that over time the shown values become more or less stable. You probably want to show the average of the last n seconds instead (i.e. a floating time window).


#1haegarr

Posted 10 July 2013 - 01:25 AM

IMHO the loop suffers from the following quirks:

 

1. It makes no sense to render although the state isn't updated, because the rendering would produce exactly the same image as the rendering before but would waste computational power.

 

2. The conditional (elapsedMS % 1000 == 0) becomes true in exactly 1 millisecond per second, assuming that SDL_GetTicks has a real resolution of at least 1 millisecond. It is very unlikely that this condition is hit in the way as wanted. (See also Ectara's comment above.)

 

3. The way you compute FPS//UPS (letting issue 2 aside) gives the average FPS//UPS since the very beginning. This means that over time the shown values become more or less stable. You probably want to show the average of the last n seconds instead (i.e. a floating time window).


PARTNERS