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

Re: [pygame] Re: Fullscreen Performance



Pete Shinners wrote:
> Gerrit Holl wrote:
> >Resolution      %graphics   fps (+/- 5)
> >320x200         44          30
> >640x480         59          20
> >800x600         63          10
> >1024x768        76          7 (+/- 2)
> 
> this seems a little slow to me. i'm used to seeing the 
> numbers one notch up for fullscreen scrolling with software 
> based SDL pygame displays. so 640x480 would be around 30, 
> not 20.

Well, these figures do not really oblige the rules of
testing, because all other factors are not really constant
each time (monsters walk randomly so may collide more or
less in one case than in another case. Removing all monsters,
that is, having no collisions, I get other figures indeed.
I removed the '%graphics' column, because I don't do collision
checking when Brian is the only sprite, which means graphics
is almost 100%.

Resolution      fps
320x200         100
640x480         30
800x600         20
1024x768        12
1280x1024       9
1600x1200       7

These figures are without collision checking and constant
scrolling. When not scrolling, I can get up to 150 fps
even at 1024x768 because I don't have different sprites,
but when I run the game normally I get 10-50 fps at this
resolution non-scrolling, dependant on the number of
sprites in the neighbourhood (distant sprites, not
visibile in the viewport, won't move at all, because
otherwise it would be even slower)..

Oh, and these figures are with a tiled background image.
Without a background image, I also get very large numbers
of fps (>150 for 1024x768).

> going to a hardware display will help you out considerably. 
> i believe the 'fenyas quest' game previously mentioned on 
> the list is enabling directx hardware for its rendering.

I am using Linux. Windows may have different figures, I do
not have access to a Windows machine before next Friday.
I do not notice a big difference in passing DOUBLEBUF or
HWSURFACE to the set_mode function.

> there's a couple things to consider when switching to 
> hardware displays. first, the mouse goes funky on most 
> platforms, so you'll need to provide your own graphic 
> cursor. the other thing you absolutely cannot do with 
> hardware surfaces with alpha blended blitting. just don't 
> try, it will be scary slow. both these things don't look 
> like they will be a problem for you, so you may give it a 
> try. the first big step is passing FULLSCREEN|DOUBLEBUF to 
> the set_mode() function. also be sure to call convert() on 
> all your loaded and font rendered images, since that moved 
> them onto the video card too.

Earlier in the development process, I already speeded Brian
up by convert()ing all my loaded images. I forgot this for
font rendered images however: this is another 10% speedup for
the figures shown above. I don't have alpha images and the
mouse is not present, so it could be possible. Maybe a
difference can be noted on better hardware, so I did add
HWSURFACE anyway.

> maybe a year ago we had quite a discussion on tweaking out 
> the maximum speed from a fullscreen tile engine in pygame. i 
> remember we made some pretty nice progress on that. i also 
> recall that running psyco helped a bit too. you may just 
> turn that on and see if you get its 'free' performance benefit.
 
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.

> i'm sure we could once again attack your rendering main 
> loop. is this for the pybrian project? if so maybe i'll take 
> a peek under the hood.

Yes, it is for the (py)Brian project. I have had a long pause
in Brian development until last week, but the differences with the
last released version are still quite large, so those interested
may want to download through CVS - see sf.net/projects/pybrian for
information.

(the project UNIX name is pybrian only because Brian was already
 taken; in all other places, the name is brian, so the CVS module
 is called brian, the main file is brian, the game is referred to
 as brian, etc.)

regards,
Gerrit.

-- 
233. If a builder build a house for some one, even though he has not
yet completed it; if then the walls seem toppling, the builder must make
the walls solid from his own means.
        -- 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/