I did a test, filling the screen with animated sprites.  It does slow
down a lot, although this machine was still able to maintain 30fps.

Based on my reading of the sprite class, it looks like using sprites
for tiling is perhaps not ideal - even less so with animated
textures.  Because the sprite class allows for animations of variable
dimensions per frame, and different sprites sharing the same animated
texture are not necessarily in sync, every time the animation changes
the sprite has to recalculate several things.

If you are willing to go with the following restrictions, and write
some code for tile layers, I think you could get excellent
performance:

- all tiles oriented the same, all the same size
- all animated tiles animate in sync
- all frames of animation the same size

With the above restrictions, it should be possible to avoid most of
the recalculations which occur per animation frame when using
sprites.  And each layer can be translated/scaled/rotated.  If the
animations are in sync, the texture can be changed once per group,
regardless of whether the tile is animated or not.

So you would have a tile layer group, then a group for each texture
(animated or not).  Each layer would be a static mesh of textured
quads, with a state change per base tile.  Your performance would
depend more on the number of different textures, rather than the
quantity of tiles.  Unless your levels are very large, you should not
have to worry about paging the tiles in/out, but doing so would not be
terribly hard.


-price

On Sep 9, 5:26 am, josch <[EMAIL PROTECTED]> wrote:
> yeah i just tested other few things.
> batches seem the only choice as whenever i try to draw all sprites
> individually it slows down beyond 1fps (for simple sprites and
> animations).
> if i draw the sprites in a batch then the fps goes all up to the 60fps
> vsync value.
> but with animations in the batch instead of raw sprites i still get
> poor framerates so maybe i should prepare multiple batches for every
> animation step so that this doesnt suck either.
>
> On Sep 9, 3:33 am, Richard Jones <[EMAIL PROTECTED]> wrote:
>
> > On Tue, 9 Sep 2008, Alex Holkner wrote:
> > > My PyWeek entry from March (http://partiallydisassembled.net/make_me/)
> > > used tile rendering using batches.  I didn't use sprites because the
> > > creation time for each sprite was too high.
>
> > Cocos tile engine uses sprites in a single batch, creating and destroying as
> > needed. It doesn't appear to suck when scrolling :)
>
> >     Richard
--~--~---------~--~----~------------~-------~--~----~
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