[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pygame] sForzando speed update
Sorry about the lack of promised speed fix; I've been really busy all week.
Here's the results of all my testing.
I checked out the code for CCScene; apparently it has a
multiple-inheritance-ambiguity bug that causes it to use the draw function
from Node instead of CCNode - great! I thought. There's the source of all
our speed difficulties. Unfortunately, when I disambiguated the function, it
actually resulted in a whole bunch of weird graphical mishaps because things
were no longer being erased (a greivous omission in CCNode.draw, to be sure).
In addition, there was no speedup - in fact, there was a rather severe
slowdown. I fixed the no-erase problem, but that slowed things down even
more (at this point things were about 25% slower than the original version).
I decided to go test on a slower machine. The machine I tested on was a
Pentium II-300 running Red Hat Linux 6. To get some sort of honest figures,
I added FPS measurement code to a PyGame example to see what kind of speed
they ran at on this machine. stars.py ran at about 20 FPS. Then I ran
dialog.py (0.1 beta before my recent changes). Also 20 FPS. Hmmmm. Then I
ran the changed version. 16 FPS - just about the expected 25% slowdown.
I really have no idea what's up at this point. It seems like redrawing the
whole screen every frame is actually FASTER than redrawing small bits of it
that change. I don't have a clue why. There is one final optimization I
want to make, which might result in some speedups. Instead of flipping every
frame, I am going to make sForzando use pygame.display.update to only update
what is necessary. This will probably speed things up a little, but don't
expact huge performance increases. Like I said, dialog.py runs slow on a
slow machine, but so does stars.py.
Also coming soon from the sForzando front: sforzaliens.py, a fun little
example to show how to add sForzando to existing games - in this case, we add
a sForzando dialog on top of Pete's Aliens game, and show how it can be moved
around and acts just like it does in a completely sForzando-based game.
Thanks to everyone who provided advice and support during the debugging
process.
Nat
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org