[Kde-games-devel] QGraphicsScene performance

mauricio at tabuleiro.com mauricio at tabuleiro.com
Fri Jun 29 09:22:38 CEST 2007


> Granted, I don't have any firsthand experience with this stuff, but that
> seems... surprising. Ten years ago we had games with multi-parallax
> backgrounds and dozens, if not hundreds, of sprites (ok, granted this
> was in 320x200 resolution)... and now ten wimpy sprites are bringing
> computers to their knees?
>
> I'm with Jeremy; what am I missing here?

As you mentioned in the start of your message, you are missing experience
with QGV, its strengths and weaknesses :)

This is something we (Ian and me) raised last year, since the initial QGV
porting effort started on KDE Games, with KGoldrunner. Performance on X is
better in 4.3 compared with 4.0, and I like to think our feedback could
have contributed to it :)

But depending on the update pattern you will still see performance issues
when large areas are updated, specially if you are using a scaled scene.
There were code posted (the initial KGoldrunner port) and discussion about
this on both kde-games-devel and qt4-preview, starting in September of
last year, under several threads. Search for KGoldrunner in the mailing
list archives around these dates. There was profiling done, and Andreas
was kind enough to devote some time during last year's aKademy in Dublin
to attempt to solve the issue in a debugging session at the hacking labs.

This is the reason why some games use KGameCanvas, and others use QGV.
Notice that these bottlenecks are only apparent when the conditions
mentioned above exist: large number of sprites updating a large area of
the scene (more than 20 update rects collected), running on X11, and this
is made worse when QGraphicsScene dimensions do not match the
QGraphicsView size (transformation is active.) Most games in our module
run happily in QGV and benefit from its convenient API, others have to run
KGameCanvas in order to achieve better performance and lower cpu usage.

Just try the examples included with Qt and you will see the same issue if
you add enough mice to the collided mice one, or the ported canvas.

Regards,
Mauricio Piacentini





More information about the kde-games-devel mailing list