I am making a game and at this moment I am using the groups to render the stuff, however for simplicity and easier improvements in the future, I will be rendering this sprites manually. So, what is more performant, using flip, one update or update after each blit?
Asked
Active
Viewed 638 times
0
-
1Simplicity? If you think groups is not simple, you're doing something wrong. They are literally meant to simplify your life of rendering and updating objects. You never update after each blit, you blit everything then update/flip. – Torxed Feb 05 '19 at 19:54
-
@Torxed I said simplicity, because it will be easier to improve the rendering code – Simple coder Feb 05 '19 at 21:50
-
Explain why, because you're saying the opposite experience of what I've had with groups/batches for over 5 years – Torxed Feb 06 '19 at 07:01
1 Answers
1
Calling update
after each blit will kill your performance. Just call update
or flip
once per frame at most.
If you're using an OPENGL
or HWSURFACE
, then you have to use flip
, which updates the entire screen.
If you're using a software display (which is the default), using the update
function offers the best performance; if you pass the function a list of rectangles so it only updates the portions of the screen that actually need to be updated (YMMV, depending on what you actually do and what hardware you use, but usually this is the way to go).
Pygame already makes it very easy to use by offering the DirtySprite
and LayeredDirty
classes.

sloth
- 99,095
- 21
- 171
- 219