I was just experimenting with my game engine on top of pygame and was trying that to make sure its performant enough.
On Friday, 13 June 2014 19:36:33 UTC+5:30, ecs...@gmail.com wrote: > > Why do you want 60 FPS so bad anyway? for most 2D applications, 30 FPS is > more than enough. > > On Thursday, June 12, 2014 3:31:40 AM UTC-4, Abhas Bhattacharya wrote: >> >> The following code draws a circle and moves it by 4px to left every step. >> >> Problem is that at about 60 fps or more, the circle flickers and >> sometimes looks cut off to me (approx. illustration - >> http://i.imgur.com/4nKzsCP.png). The flickering is not like a screen >> flicker, more like state switching between full circle and cut-off circle. >> This problems doesnt occur at all upto 45 fps, couldnt be reproduced by >> screen capture or pausing the game, as if the problem is only visible to >> the naked eye. >> >> Now, there could be two possibilities: >> >> * Screen is not updated over the required region. >> >> None of the update code depends on the fps, so the flicker should have >> been fps-independent. But, the problem disappears at 30/45 fps. But, >> surprisingly, it is also fixed if display.flip is used instead of update. >> >> * V-sync/monitor refresh problem >> >> Some other pygame flicker questions mentioned this problem. I thought >> software rendering doesnt have this problem, but not really sure. Also, why >> would display.flip fix this? >> >> Ver- 1.9.2 a0 >> >> import pygame >> w,h=800,200 >> fps=60 >> pygame.init() >> screen = pygame.display.set_mode([w, h]) >> color=pygame.Color("white") >> clock=pygame.time.Clock() >> radius=20 >> x,y=800,100 >> def get_bbox(x,y): >> left = x - radius >> top = y - radius >> width = radius * 2 >> height = radius * 2 >> return pygame.Rect((left, top), (width, height)) >> >> while True: >> old_x=x >> x-=4 >> screen.fill(pygame.Color("black"),get_bbox(old_x,y)) >> pygame.draw.circle(screen, color, (x, y), radius, 1) >> pygame.display.update([get_bbox(x,y),get_bbox(old_x,y)]) >> clock.tick(fps) >> >