[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Path finding demo, now with more fugu



On 4/22/07, andrew baker <failrate@xxxxxxxxx> wrote:
I've always been under the impression that this was a quirk of Pygame.

It's not a quirk of pygame to run at 100% cpu all the time. The only
things special about pygame in this area were that it provides waiting
functions that perfer to chew cpu rather than release it (with the
intent of getting a high-precision wait function).

pygame.time.delay does busy loop waiting, and so does
pygame.time.Clock.tick_busy_loop. I think pygame.time.Clock.tick used
to do busy loop waiting as well, in older pygame versions (not sure
when it may have changed).

If a game uses a function that uses busy loop waiting in order to
limit the frame rate then it will take 100% cpu even if it doesn't
need to. It can be bad to take 100% cpu if you don't need to, because
it can cause the game's frame rate to be choppy.

Also if any game (pygame or not) can't run at it's desired frame rate
for performance reasons, or doesn't do anything to limit execution to
a specific frame rate, it will most likely run at 100% cpu all the
time (it's very common for games to take up all the cpu)