[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Re: Fullscreen Performance



Pete Shinners wrote:
> Gerrit Holl wrote:
> >My game, Brian, is not tile oriented, so this discussion won't
> >help me much. I don't know exactly what psyco is, but I will
> >have a look at it.
> 
> psyco is a sort of just-in-time compiler for python code. it 
> is very easy to make use of in your application (just pick 
> which functions you want the extra compiling for). it 
> usually makes a noticeable difference on games, but your 
> mileage will definitely vary.

Strangely, psyco halves speed for my game. I do not know what
is really going on, but adding 'import psyco; psyco.profile()'
to the top of my code slows down the run of a test level with
30 sprites constantly colliding with each other from 14 to 7 fps.

> first, when rendering the background, you always clear it 
> with the background color (currently black). even when the 
> area is covered by a platform. it is well worth your time to 
> not fill these areas, as the "overdraw" costs much more than 
> the time needed to compute things a bit smarter.

I tried to think of a way implementing a solution to this. The
only way I can think of, is calculating the difference between
the viewport and all sprites within it, resultin in a set of
rectangles on which I should redraw the background after
scrolling 1 frame. However, I have no idea how to implement this.
I can implement 'subtracting rectangles' for 1 rectangle within
1 other, but for more, I have no idea.

Gerrit.

-- 
212. If this woman die, he shall pay half a mina.
        -- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Kom in verzet tegen dit kabinet:
	http://www.sp.nl/