[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Weird lag
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Weird lag
- From: René Dudfield <renesd@xxxxxxxxx>
- Date: Sun, 1 Mar 2009 17:47:07 +1100
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sun, 01 Mar 2009 01:47:11 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=q2kvlst/6dLw8QjZ3QKf1QpVObHalqBOCKTrt42UsFM=; b=qia23by6+sMHFuvW76VtDin16RBBRJOlm/qlolSmneqB1Ujq6O7MiDoR9zAlLFJh6G eRgS6vnFOf6WAVcoSAQfk44XZlgC5ZEoipa+FUD1p58CfV1Js/EaMIAtk2kmxk+y3Y2R uXQBZrLaPMxx5RldqUVPJQxyny9oY2cbyfy10=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=n+WPKrnbMXFL11d5psy/Zrgk9PWpb8oHLnsyA1etIJyCT2wR/oWECAvICcJAjocjEH J5IRJURC3BvkPuz8OAoAwgetGA4k0dm8xNVnkkdx/OK4MCB4LeJkxFq3e0dd/Qvzxj++ B9COtK5RRpwMSF1imBX+hAusLQeoF2bhD/0Hg=
- In-reply-to: <49A9B8D9.5030405@xxxxxxxxx>
- References: <49A9B8D9.5030405@xxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
hi,
Maybe you could print out some stuff when it's slow?
eg. print out the number of objects being checked for collision detection.
I've got a feeling it might be extra objects for a little bit of time,
causing extra time for collion detection. This is based on seeing
that collision detection is rated fairly highly in the profile list.
cu,
On Sun, Mar 1, 2009 at 9:21 AM, Daniel Mateos <daniel@xxxxxxxxx> wrote:
> Hey again,
>
> In a 2d scroller game im making i seem to get FPS drops at random
> points, i am using the Clock class to keep it at a constant 60 fps and
> it never seems to go above 9%-15% cpu usage so im not sure what could be
> causing it.
>
> Seems to run well for 90% of the time with spikes that drop the fps to
> 10-40 at some points in the level, other times it runs fine at exactly
> the same points and its not doing anything extra doing these spikes, im
> bliting about 100-200 sprites per frame.
>
> Some quick profiler output, doesnt really tell me much tho:
>
> ncalls tottime percall cumtime percall filename:lineno(function)
> 1233 10.177 0.008 10.177 0.008 {built-in method tick}
> 1233 4.982 0.004 4.982 0.004 {pygame.display.flip}
> 153699 3.211 0.000 3.211 0.000 {method 'blit' of
> 'pygame.Surface' objects}
> 542520 0.424 0.000 0.424 0.000
> game_level.py:129(CheckOnScreen)
> 1233 0.419 0.000 3.889 0.003 game_level.py:56(RenderLevel)
> 487287 0.312 0.000 0.419 0.000
> game_level.py:105(CheckCollide)
> 1233 0.291 0.000 0.757 0.001
> game_level.py:122(CheckCollides)
> 3615 0.160 0.000 0.160 0.000 {method 'render' of
> 'pygame.font.Font' objects}
> 1 0.150 0.150 0.150 0.150 {pygame.base.init}
> 1 0.126 0.126 20.979 20.979 main.py:18(<module>)
> 487287 0.107 0.000 0.107 0.000 {method 'colliderect' of
> 'pygame.Rect' objects}
> 1 0.093 0.093 0.121 0.121 {pygame.display.set_mode}
> 493258/493031 0.048 0.000 0.048 0.000 {len}
> 4 0.048 0.012 0.048 0.012
> {pygame.imageext.load_extended}
> 1233 0.042 0.000 0.042 0.000 {pygame.event.poll}
> 1233 0.040 0.000 0.096 0.000 game_osd.py:79(DrawBar)
> 4 0.034 0.008 0.034 0.008 {method 'convert' of
> 'pygame.Surface' objects}
> 1233 0.033 0.000 0.805 0.001 game_level.py:44(update)
> 1 0.017 0.017 0.125 0.125 __init__.py:25(<module>)
> 1233 0.016 0.000 0.041 0.000 game_osd.py:106(WriteText)
>
> Any help or suggestions for better profileing/tracking down the lag
> would be good :)
>
> --
> Daniel Mateos
> http://daniel.mateos.cc
>
>