On 3/25/08, Lucio Torre <[EMAIL PROTECTED]> wrote:
>
>  On Tue, Mar 25, 2008 at 3:30 AM, Simon Wittber <[EMAIL PROTECTED]> wrote:
>  . IMO this makes pyglet.sprite great
>  >  for static sprites, but less great for lots of moving sprites.
>
>
> aren't sprites supposed to be things that you move around in the screen?

Imagine a game consisting of some static background images, some
occasionally animating images (the princess waving in the tower,
animated water tiles, ...), often moving foreground characters (the
player, bad guys) and some particle effects (sparks from an
explosion).

Of these, only the particles are likely to be moving every single
frame.  The other elements may move every two frames, every ten
frames, once a second, or even less often.

pyglet.sprite is highly optimised for the case where an image is drawn
at the same place more than once (even updating only once every two
frames really takes advantage of the architecture).

Of course, some games are made up entirely of images that move every
single frame (for example, the astraea example provided in the pyglet
distributions).  pyglet.sprite is not crippled for these cases (note
that astraea runs with upwards of 100 on-screen elements on a low end
computer while maintaining a high framerate), in fact it's not far off
as optimal as you can get in pure Python, especially without
introducing a lot of OpenGL-like state dependencies into the
application.

Rather than come up with different names for modules for representing
background tiles, particle images, occasionally animated images, and
so forth, we opted to just call everything a sprite.  Like Simon says,
in order to get much better performance for oft-animating sprites, you
really need to invest in some native code (see also the rabbyt
project, which uses PyRex); Python just can't cut it.

Alex.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to