[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] groups drawing optimization
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] groups drawing optimization
- From: "René Dudfield" <renesd@xxxxxxxxx>
- Date: Mon, 22 Dec 2008 08:34:41 +1100
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sun, 21 Dec 2008 16:34:46 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=l/hr2VV9Ie0MIw8DLS0RO++j3CVdz60GzpI2O91/rFU=; b=lxgT8hlYl3s9ubwusALT5U2UeGwRTBYA4wdMjjEfIcQR9KW3YWDTP2QM9lQ8ZTo6QM jyL1uaMoGxjQB5wbjuN9FBS94NKAuWnsrsvGii4qjSVdRbbR2zCVaxLfDgzrbLkKK7Bh Y007IXOyZl+6ZwTajfXLMZU8AenWrRAzyFWw8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Cfg5QGIJVm+DSi6vTYC/9M7u8I13mbBR0auJZt5KxuBDaUpFnQluMW1Z40bHpV8pR4 k/d30YDOJtNn4xWkSz0i8/CghTBmc+JjKaF+md7uVzo4SVgkrzGNm1OmMae9ssOj/1mh XuNuGxpBbL8yPve90ohyJSwzYV5Fx034Hq8bo=
- In-reply-to: <27308d500812211254y1a4a2dc6jdf530ac192c37132@xxxxxxxxxxxxxx>
- References: <27308d500812211254y1a4a2dc6jdf530ac192c37132@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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
>