In any case, I just tried the los.py program.
$ python los.py 100
best FPS: 514.567314839
best us per sprite: 19.4338033366
avg us per sprite: 21.6097511322
$ python los.py 1000
best FPS: 66.0796080254
best us per sprite: 15.1332616806
avg us per sprite: 16.897357462
I suppose I can explain how I'm creating my animations. Most
animations come from a sprite sheet file that I convert into an
ImageGrid.
image = pyglet.resource.image(imagePath)
# Right now, all sprites are supposed to fit in a 32x32 square
width = image.width // constants.TILE_SIZE
height = image.height // constants.TILE_SIZE
imageGrid = pyglet.image.TextureGrid(pyglet.image.ImageGrid(image,
height, width) )
animation = imageGrid.get_animation(period)
Sometimes I have multiple animations inside a single sprite sheet, one
animation per row. It is these types of animations that seem to cause
slowdown when used in large quantities. When I have about 100 of these
kinds of Sprites (on top of any animated Sprites I already have) I get
noticeable slowdown.
image = pyglet.resource.image(imagePath)
width = image.width // const.TILE_HALF_SIZE
height = image.height // const.TILE_HALF_SIZE
imageGrid =
pyglet.image.TextureGrid( pyglet.image.ImageGrid(image, height,
width) )
animationSet = [
pyglet.image.Animation.from_image_sequence(
[imageGrid[(y, x)] for x in xrange(width)],
period
)
for y in xrange(height)
]
# Not actually how I use animationSet.
sprite0 = pyglet.sprite.Sprite(animationSet[0], x = x, y = y,
batch = batch, group = group)
sprite1 = pyglet.sprite.Sprite(animationSet[1], x = x, y = y,
batch = batch, group = group)
--
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.