Hi,
I'm developing an old-fashioned 2D RPG with Python + pyglet.
The map is made of several layers (up to 10), each of them consituted of
squared tiles (32x32 pixels). The sprites (party characters, NPC, and some
others things) are drawn between two layers (usually just before the last).
To render it, I use a single Batch, with many OrderedGroups : one group per
layer, and a group per sprite.
The problem with sprites is that they must be rendered in the decreasing
order of their y value, so groups are arranged as follow (let's suppose
there's 3 layers in the map, and that 2 sprites must be drawn just before
the last) :
g[0] = OrderedGroup(0) : first layer
g[1] = OrderedGroup(1) : second layer
g[2] = OrderedGroup(2) : empty, serves as a base for the following :
OrderedGroup(0, parent = g[2]) : the highest sprite
OrderedGroup(1, parent = g[2]) : the lowest sprite
g[3] = OrderedGroup(3) : the third layer
When I add layer-sprites to the batch, I specify that they are static. When
I add party sprites, they are 'dynamic'.
So my first question : since they all belong to the same batch, isn't it
contradictory ? (said differently : is 'static' or 'dynamic' a property of
the sprite object, or of the batch ?) (note : I precise that I have really
few knowledge about OpenGL and have no idea how batch and groups are
implemented)
For the time being, performance is correct (I want 60 fps, and I have them
up to 8 moving sprites), but perfomance decreases quickly with more than 8
moving sprites (which should not happen in the final game, but I'd like my
engine to be the most efficient possible without translating parts in
C/ASM).
So my second question : is the strategy I choose (use batch, and as few as
possible) the good one ?
Thanks in advance for answers
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/pyglet-users/-/wsZNj41n-0wJ.
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.