I ran into a similar issue when experimenting with pyglet sprites. The sprite batch draw calls seem to work well, but I wasn't able to find any way of batch updating sprite positions (perhaps I didn't look hard enough?). I found that the actual x += dx operations - in pure python - were essentially negligible, when compared with the cost of calling set_position on each sprite.
If the bottleneck is actually performing large numbers of floating point operations rather than updating the sprite positions then I'd also recommend numpy. On Jul 15, 1:05 am, Eric Burgess <[email protected]> wrote: > Pyglet provides some great ways to reduce function-call overhead for > sprites (groups and batches). But I still find myself looping through > X sprites Y times a second, where X*Y can get quite large, doing > things like "x+=dx;y+=dy". I know there are packages like SciPy that > can add an entire "dx" array to an "x" array at C-speed, but I'd > rather not add the dependency. > > Is there a "best practice" for doing this sort of thing in pure Python? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
