On 9/9/08, josch <[EMAIL PROTECTED]> wrote: > > well i just did not want to have the overhead of all those mighty > cocos transformations and animation stuff. i need it small and simple. > i just read a bit into the cocos tile engine code and it seem that on > each draw it fills a new pyglet batch with sprites - just as i > proposed in my first post. > maybe this really /is/ the best way to do it?
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. I use Batch.add(..) to create the vertices for the tile map. If all the images are located in the same texture, the entire screen can be drawn as one primitive. Culling is done by creating separate vertex lists for approximately screen-sized areas of the map. These can then be added and removed from the batch on-demand as the player moves around (tuning this took quite some time). I didn't have any animated tiles, but these can be done by either modifying the vertex texture coordinates to point into the desired frame, or by swapping entire vertex lists (which would probably be faster but more memory heavy). I'm afraid the code in Make Me is far from publishable (it was written in a week for a single game, after all), but you may find it useful to mine for ideas. 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 -~----------~----~----~----~------~----~------~--~---
