Your approach to the math plays on the strengths of numpy and shows great performance benefits. Keep us posted...who knows maybe some of your work could make it back into the pyglet project in the sprite module...we are often talking about ways to improve it.
On Saturday, January 2, 2016 at 5:18:32 PM UTC-6, elliot wrote: > > Hi all, > > Not a question here. More of an announcement and making sure I'm not > duplicating efforts or digging a hole with unforeseen serious limitations. > Any feedback is much appreciated. > > I'm interested in making a simple 2D game engine using pyglet. One issue > that came up was that translating and rotating every object every frame in > pure python was dominating the execution time (~90%). I tried using numpy, > but since each object has < 20 vertices it was actually a performance hit > rather than a gain. This got me interested in a more Data Oriented > Programming approach. All of the data needed for rotations could be > batched and operated on in one numpy vectorized operation. > > I wrote a simple proof of concept which you can find here: > https://github.com/Permafacture/data-oriented-pyglet > > Of course, using numpy correctly has reduced the heavy maths to 1/10th of > it's original execution time, increasing the max frame rate for 100 > spinning objects from ~225 fps to ~625 fps on my little thinkpad. > > I have spent some time reading through the graphics module of pyglet. I > really like the way it is set up. I originally thought I'd use batches, > and use ctypes to access the attribute buffers directly. But now I'm > thinking to just implement something very much like a domain (use pyglet's > allocator and the rest of pyglet graphics's Data Oriented Programming > style) and have it be a more general data oriented ORM which could render > it's vertices through glVertexPointer, glColorPointer and glDrawArrays (see > third.py in the repo). > > Thanks for reading and Happy New Year, > > Elliot > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
