On Tue, Nov 1, 2011 at 8:13 PM, Mike Wyatt <[email protected]> wrote:

> Here's the problem:
>
> SpriteGroup and other built-in groups, which I modeled my
> PolygonModeGroup on, will only be grouped when the parent is the
> *exact* same object.  I think it would be better to use the same
> equality logic for parents as we do for siblings.  This simply means
> we just change `self.parent is other.parent` to `self.parent ==
> other.parent` and `hash((id(self.parent), self.mode, self.face))` to
> `hash((self.parent, self.mode, self.face))`.
>
> This made a huge difference in my game.  I don't remember the exact
> numbers, but I went from ~20 FPS with a few dozen objects to 60 FPS.
>
> I doubt you'd run into this problem with a simple two-level hierarchy
> like most of the demos probably have.  But I can't see how you'd avoid
> significant performance problems if you have three or more levels of
> groups.  Unless you manage each group object individually, to be sure
> children share the same parent.
>
> What do you guys think?  Is this a bug, or is there a reason for the
> existing behavior?
>

It sounds more like a bug than a feature to me, but it's been a long time
since I read all that code in pyglet (or the programming guide), so I
wouldn't feel comfortable changing this unless someone who analyzed it more
recently agrees (or better yet, someone who helped write it :-) ).

- Bruce Smith

-- 
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.

Reply via email to