[Kde-games-devel] Re: guidelines for animation speeds?

Wolfgang Rohdewald wolfgang at rohdewald.de
Tue Dec 14 09:53:37 CET 2010


On Donnerstag 04 November 2010, Aaron J. Seigo wrote:
> > BTW is there a way to get more temporary positions?
> > With fast animation, only a few intermediate positions
> > are drawn. Or is my notebook simply too slow?
> 
> your netbook may be "too slow" (or, as is often the case, the
> graphics driver is not performing well) or the code is not as
> efficient as it could/should be. animations run with as high
> a FPS as they can (well, with an upper limit, of course :) so
> if it is missing frames it's usually becuase the animation is
> overly complex or is implemented sub-optimally.

I added debugging code. If you set Debug.animationSpeed=True
in common.py, it shows frames per second for slow animations
on stdout. The upper bound is 64 fps on my system,
and the code you tried shuffled with about 6 fps depending
on window size.
 
> the initial shuffling animations are really, really slow ..
> probably because so many things are being animated at once
> any inneficiencies really add up. hard to say what's up:
> whether it's just real limitations in QGraphicsScene being
> hit or something in your code that could be better.

I replaced QGraphicsSvgItem by GraphicsTileItem(QGraphicsItem)
and tried to cache as much as possible.

All this makes shuffling and initial dealing about twice
as fast - still too slow. I disabled those animations for
4.6, only those while playing will be active.

With --graphicssystem raster it is about 3 times
faster but I am not sure if I am allowed to always use
it by making Kajongg activate it. Would such a change
be acceptable for KDE 4.7?
 
I also changed it such that while shuffling no tiles are
scaled or rotated, but this does not make it faster at all.

> looking quickly at the code i see a lot of calls to set scale,
> both in the scene and for individual items. scaling tends to
> be really, really slow in QGraphicsScene.

I do need scaling. The player tiles should be bigger
than the wall tiles and discarded tiles. The bigger the better
for netbooks. With all tiles having the same size, the screen
would look very different. And if I change tile size in one step
while moving it, it looks strange. Same with rotation.

> there also doesn't
> seem to be any use of caching, either on the scene or in the
> items? QGraphicsSvgItem may also be another source of slow
> down; we don't use it in Plasma and KGameRenderer doesn't
> either as both provide a number of optimizations (such as
> sharing the svg file between different items).

QGraphicsSvgItem does caching by default. The svg file is
shared, QGraphicsSvgItem.setSharedRenderer()
 
-- 
Wolfgang


More information about the kde-games-devel mailing list