Closed ravenironwing closed 4 years ago
Thats a good point. I have not added a bounds check for game sprites because I assume that it is being done before sending sprites and camera info to pyscroll, since the sprites are expected to be transformed to screen space. When developing, I was filtering out sprites which are on on the screen and the additional check would have been redundant. I think a good compromise would be "bounds checking by default", with an option to turn it off. Patches are appreciated :D
I realize now that you are specifically talking about the PyscrollGroup and I agree that it should have bounds checking by default. The lower-level code which I was referring to earlier doesn't need it though.
Yeah, I was talking about the pyscollgroup :)
Implementing bounds checking in my game made it go from under 30fps to about 60. So, it definitely improves performance a lot. I can't remember if I attached to code that shows I patched it....
On Thu, Jan 2, 2020, 7:30 PM Leif Theden notifications@github.com wrote:
I realize now that you are specifically talking about the PyscrollGroup and I agree that it should have bounds checking by default. The lower-level code which I was referring to earlier doesn't need it though.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bitcraft/pyscroll/issues/33?email_source=notifications&email_token=ALVS7DMFDFBS3RTPTQB5H3TQ32WOBA5CNFSM4IKEYP7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIAFZTQ#issuecomment-570449102, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVS7DI7WI3SHE3NP7UWGPDQ32WOBANCNFSM4IKEYP7A .
Added a check to the group which ignores sprites that are not on-screen. Thanks again!
You could drastically improve the draw method if you only drew the sprites that are on screen. Even manually removing the sprites that are off screen from the pyscroll group then adding them back in if they are on screen each clock cycle results in a 20FPS improvement in my game. But if such a function were built in it would run way better and it really wouln't be that hard to add.