[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Pygame tutorial



John,

Thanks for that! I'm running it on an 800MHz machine, so I don't realy
notice it ;-)

As you say, the writing is of a high quality, but the code is, well, I'm a
beginner with Pygame anyway, hence I wanted people to check it out so I wasn't
teling other beginners rubbish, or giving them bad ideas!

I'll integrate your patches asap :)

Tom

> Hi,
> 
> just been trying out this pong tutorial and noticed that it ran very 
> poorly on my machine. Had a quick look at the code and noticed this:
> 
>     screen.blit(background, ball.rect )
>     screen.blit(background, player1.rect )
>     screen.blit(background, player2.rect )
> 
> this code renders the ENTIRE background image (clipped to the screen) 
> at the locations of the ball and players. 
> 
> Thats three times.
> 
> It was slowing to a crawl when the ball and the bats approached the top 
> of the screen.
> 
> Should look like this:
> 
>     screen.blit(background, ball.rect, ball.rect)
>     screen.blit(background, player1.rect, player1.rect)
>     screen.blit(background, player2.rect, player2.rect)
> 
> which copies a small rectangular region from the background image
> to the screen, erasing the old ball/player position.
> 
> This seems to be an amusing demonstration of what happens when 
> people are let-loose on massively over-the-top hardware. Goodness 
> knows what you people must be using not to have noticed this :-)
> 
> I test on a P166Mhz-MMX, (that's 166Mhz not 1.6Ghz). I find that it 
> keeps me frosty.
> 
> On a more positive note, the journalistic quality of the tutorial 
> itself is good, you just need to sort out the code,
> 
> good-luck and best regards,
> John.
> PS the attached patch for tompong-0.4 fixes this and another 
> performance related issue: font creation.
> 

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org