Results 1 to 10 of 121

Thread: G.T.A.2 Map Editor

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #31
    Hmm, i am familiar with caching textures but how is rendering to cache done?
    I dont need code but just some tips how i could do it.

    I looked again, it renders area of 23x23 tiles and CPU is 0. I cant render over 15x15 when cpu gets already used. Strange. And i render only LIDs, for debugging purposes i disabled every other face.


    I love how original editor uses resources, only when needed. It seems also it updates its cache when user modifies map, i mean when you change slope type from combobox then slope gets changed visually only when you click on map.

    And it uses only around 28MB of memory, where my editor takes over 100MB because i use the whole 3D array of [8,256,256]. They also optimized that somehow. Only rendering specific blocks or just cache. Maybe they dont even use so big array at once but just parts of it and modify array at runtime (just the modified chunks).

    Too bad they dont want to release the old stone age but useful code (just ignoring requests).

    Lots of things. I have lot to improve. 100MB is too much i think.
    I was thinking about display list but it also must be managed somehow, because its editor, blocks gets changed and if i dont update display list after modification, then the changes wont be displayed. But changes must be immediate and i have read that updating display list often kills the performance.



    EDIT:
    Ok i used gDEBugger now and it shows clearly that i have too many OpenGL calls:
    8910 calls per frame in my example. FPS is ~30, because i set it to this.
    The bar in gDEBugger is almost red, the top caption says there 10K.
    So i guess 10000 frames is max and anything over that is "crazy".
    If i have ~9000 calls and its in red area then its too much

    Is ~9000 too much or not? I guess it is. I dont know, because i dont know how much normal application would use.


    If i remove all draw commands CPU usage goes to 0.
    I have to look at my code how to reduce the calls.

    EDIT2:

    I pinpointed where my primary resource eater is.
    This is it. Thats the way i draw blocks (position them):
    Code:
        for ii:=y1 to y2 do
        for jj:=x1 to x2 do
        begin
          glPushMatrix();
          glTranslatef( 1.0 * jj, 0.0, 1.0 * ii );
          for zz:= 0 to 7 do
          begin
             Inc(scene_rendered_blocks);
             glPushMatrix;         
    
              // Render all here!
               DrawBlock(gmp.makecoord(ii,jj,zz), gmp.maparray[gmp.makecoord(ii,jj,zz)]);
    
              glPopMatrix();
            glTranslatef( 0.0, 1.0, 0.0 );
          end;
          glPopMatrix();
        end;
    x1-x2, y1-y2 are the 15x15 range.

    Started to comment out different things and this is the place i get highest cpu usage and i looked in gDEBugger that they are called alot.
    glTranslatef and glPushPopMatrix are the primary things that eat my cpu.
    Im not surprised anymore if i increase 15x15 area the cpu goes up.

    I know in C++ we have CML and GLM to get rid of these commands and use library functions but is there similar things for Delphi?

    There must be way to draw cubes / things in correct coords without glTranslatef and glPushPopMatrix.

    In the meantime i will try same thing in C++ with CML or something.
    To see how it looks and how it eats cpu using third party lib.
    Last edited by hwnd; 25-08-2013 at 09:36 AM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •