Victor STINNER wrote:
It really goes slower when I use 16 bpp (8 instead of 21 fps). I choosed
*32* bpp in SDL_SetVideoMode. But 0 is maybe better !?

  
Yes, sure, 0 is the better as the surface will be created with the current display bpp (i.e. the bpp to which the X server is running)

  
Ok, that is really faster when you don't move but when you move the 
camera, the FPS fall down as before... not?
    

Yes. But I think that the "cache patch" wouldn't impact on performances.
So on critical moments, the game just would works as yet (display
everything).

But ... on 70% of time (at least) ... nothing happens. So we will have
something like 200 fps (we can dream) on 70% of time, and maybe 100 fps
on critical moments :-)
  
Ok, how handle we the particules (nuts, clouds,etc...) should we disable them when we use the cache mechanism or not (with map like Arbres, nuts seems to cover 70% of the screen)

  
Ok, if you are intersted, I can write a map method to redraw the map( 
sky / ground ) of a rectangle area and not all the screen then with a 
such method you can apply your patch ?
    

I think that with SDL it would be *very* easy because Blit function
accept (need) rectangles :-)
Yes that is sufficient for sky/background and that would be optimal to render the ground is to try render only the tiles item that intersect the rectangles to refresh (what I can do easily as I have already made it for tile item digging method)

 But we also need a cache for TTF rendering
(eg. keep 200 objects with a algorithm to sort them as "last used", good
algorithms exist).
  
What will we cache :  glyphs or pieces of text ?
That sounds good... Perhaps the fist thing to do - I think - is that we should find a better way to display text as it is near unreadable when it is displayed on top of a light or white surface than we should optimize it.
  
Oh oh... with our software graphic surface alpha blending functions, 
that would be always faster to draw A and B as drawing the big A+B (ok, 
that is not true when A and B measure each 1pixel and are adjacent but 
for our surfaces that will be always true). Why ? the alpha blitting 
functions have a small overhead and are  very dependents of the number 
of blended pixels .
    

Ok, so we can start with dumb cache, and then maybe improve it.
  

Ok, I write the method to redraw only a rectangle area of the map.


Jean-Christophe
-- 
Jean-Christophe Duberga - http://jeanchristophe.duber.free.fr
Excellente école pour apprendre la langue allemande à Berlin

Répondre à