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

Re: [pygame] groups drawing optimization



Hi,

depending on how you've done it, it could be skipping those things
anyway.  This is because a surface does not draw stuff outside of it's
area... things get clipped.

However it may be worth doing, if you can calculate what not to draw
quickly enough.

Another trick is not running the AI for things off screen too.
Depending on your game that could work too.

cheers,


On Mon, Dec 22, 2008 at 7:54 AM, Luca <lucafbb@xxxxxxxxx> wrote:
> Hi all.
>
> I've a non yet optimized game that works on level bigger that the screen.
> So on my levels, sprites can be found outside the viewable part of the screen.
>
> I'm just wondering if adding some code that didn't draw those sprites
> when they are outside the viewable area can be good, or pygame low
> level procedures do this itself.
>
> What I'm thinking is to rewrite the draw method of the Group class, to
> skip all sprites that aren't viewable.
>
> Any comment about this? Is a useless work?
>
> --
> -- luca
>