Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

low framerate #186

Closed
aaarbk opened this issue May 18, 2019 · 5 comments
Closed

low framerate #186

aaarbk opened this issue May 18, 2019 · 5 comments

Comments

@aaarbk
Copy link

aaarbk commented May 18, 2019

Consider this simple program:

alien = Actor('alien')
alien.topright = 0, 10

WIDTH = 1000
HEIGHT = 600

def draw():
    screen.clear()
    alien.draw()
    
    
def update():
    alien.left += 10
    if alien.left > WIDTH:
        alien.right = 0
        

It's essentially the same example as on the Introduction to Pygame Zero page, except I've made the window size larger.
On my mid-2018 Macbook pro, this runs very choppily. If I stick in the optional time argument in the update function and print its value, it reveals a frame-rate of around 10 fps. Decreasing the window size improves the framerate, and increasing it makes it worse.

Is this known behaviour, and is it because of the Retina display? Are there are workarounds?

@dowski
Copy link

dowski commented Sep 13, 2019

I've never seen anything near as low as 10 FPS. I'm running on Windows though.

I do notice occasional stuttering. I'm not sure if it's due to vsync/tearing or the fact that every now and then a frame takes longer than 16ms to render (when I calculate FPS I get around 58). If I modify pgzero/game.py and bump the frame rate from 60 to e.g. 120 it runs a lot more smoothly (although I don't get 120FPS - more like 110). Maybe b/c even when a frame is dropped there are so many more in between?

@gtoast
Copy link

gtoast commented Sep 18, 2019

I'm seeing this same issue on a 2017 MacBook Pro 13 inch. Same code as the example just change the dimensions to 800 x 600 and there a 10x drop in speed.

@unspam
Copy link

unspam commented Nov 18, 2019

I believe this might be the same issue reported here:
pygame/pygame#555

Today I was trying a simple example with pygame 1.9.6 and increasing the window size was causing performance to degrade on my Macbook Pro. I switched to pygame 2.0.0dev6 and (subjectively speaking) the problem went away.

Could pygame zero be made to use pygame 2.0.0 dev versions?

@lordmauve
Copy link
Owner

I believe this might be the same issue reported here: pygame/pygame#555

I think that issue is #145, although framerate issues are mentioned later in the thread.

Could pygame zero be made to use pygame 2.0.0 dev versions?

No, but when Pygame 2.0 proper is released we can pin to it.

I'd note that at a Python meet-up recently some users reported seeing it take tens of seconds to actually launch a window, even under Pygame 2.0, as I recall. Upgrading to a bleeding-edge version may come with other problems.

@lordmauve
Copy link
Owner

Closing as likely to be stale by now, several Pygame versions later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants