Jump to content
  • Advertisement
drwuro

Pygame - alternatives?

Recommended Posts

This sounds like a common problem from ages ago when game coordinates were using integer/pixel location vs floats. Every loop/iteration would lose some precision and rounding/truncating would cause jitter every few updates like you have described because pixels would be gained/lost in the math. The idea that a fluctuation of 2-5 frames/second could cause a noticeable display issue like this, as others pointed out, is a very unlikely. I wont say impossible but this all rings very familiar to me even recently when working on HTML5 canvas games where browsers have wide ranges of deltas between updates and even display rates.

Share this post


Link to post
Share on other sites
Advertisement

@Julie.chan It is exactly ONE iteration of the main loop. But every measurement shows exactly the same result. Because it is actually how I described: The game loop code takes very little time and thus on my machine the game has hundreds of FPS when running without limitation.

Share this post


Link to post
Share on other sites

I have now done a different kind of testing. I have limited the game's FPS to 60 using pygame.Clock, and I have measured the duration from one frame to the next, which should be a very constant value in a perfect world. And if I would do this in a C++/SDL game, it would work too. However, in Pygame, I have the following results:

0.0159058570862

0.0160629749298

0.015741109848

0.0169258117676

0.0149910449982

 

I picked out some values just to show the variance. As you can see, the numbers range from 15 ms to 17 ms, in a quite unstable manner. This is what I am talking about. I hope now it's clearer.

Share this post


Link to post
Share on other sites

It is exactly ONE iteration of the main loop.


That's not going to tell you anything useful whatsoever.

But every measurement shows exactly the same result. Because it is actually how I described: The game loop code takes very little time and thus on my machine the game has hundreds of FPS when running without limitation.


Of course the game loop takes "very little time". All game loops do. But you've completely missed the point that running such a short test is completely useless because all your results are getting rounded, and as a result you have zero information about when the slower parts are, which is the meaningful result. Getting multiple results with this pointless single-loop test you have is never going to get you any closer to understanding what's going on because of this.

This is what I am talking about. I hope now it's clearer.


Yes, I know what you're talking about. You're worried that a 0.2% difference of timing, which is perfectly normal, must somehow be the cause of all your problems. But if you want to actually solve the real problem, that being the thing you describe as "jittering" (which is quite vague, and you haven't clarified what you mean by it), you need to drop the pretentiousness and think outside this box you have constructed.

Otherwise, feel free to just drop all your work and start over with C if that's really what you want to do.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!