Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39

Thread: Slow when drawing the Map into another surface

  1. #1

    Slow when drawing the Map into another surface

    Hello!

    I am having a problem with my game. When you press TAB, I draw into the DxDraw a new surface showing the map (just some squares in ISO format, showing the colision points). This new surface I draw using DrawAdd to add it to the main surface with alpha-blending of 100. But this slows down everything. I get something like 1 frame per second. Is there any workarround for this, or sugestions?

    This new surface is the same width and height of the main DxDraw

    Thank you!

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Slow when drawing the Map into another surface

    Hi nildo, welcome to PGD!

    What version of UnDelphiX (or DelphiX) are you using?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3

    Re: Slow when drawing the Map into another surface

    Quote Originally Posted by nildo
    I draw into the DxDraw a new surface showing the map (just some squares in ISO format, showing the colision points). This new surface I draw using DrawAdd to add it to the main surface with alpha-blending of 100. But this slows down everything. I get something like 1 frame per second. Is there any workarround for this, or sugestions?
    DrawAdd draws an image with additive blending, which I thing you interpreted as being something else. To draw on the new surface normally, just use the regular Draw method. (Unless of course you want additive blending on the new surface?)

    As a general note: The reason DrawAdd is so slow is because it has to do the blending manually (ie. software-based), since DelphiX uses (DirectDraw) software-rendering. Try to avoid blending routines in general with DelphiX unless you're using them with smaller images.

    EDIT: Oh hey! Welcome to PGD, too.
    Game-Dev Journal: http://skirmish.dreamhosters.com/devlog/

  4. #4

    Re: Slow when drawing the Map into another surface

    Quote Originally Posted by HopeDagger
    DrawAdd draws an image with additive blending, which I thing you interpreted as being something else. To draw on the new surface normally, just use the regular Draw method. (Unless of course you want additive blending on the new surface?)

    As a general note: The reason DrawAdd is so slow is because it has to do the blending manually (ie. software-based), since DelphiX uses (DirectDraw) software-rendering. Try to avoid blending routines in general with DelphiX unless you're using them with smaller images.

    EDIT: Oh hey! Welcome to PGD, too.
    Thanx for the Welcome!!

    What do you sugest for me to show de map of the area? I was pretending to draw it with alpha blending on the screen, with the colision blocks, NPCs and Players (isometric 2d mmorpg game).

  5. #5

    Slow when drawing the Map into another surface

    You may switch to Jicro's UnDephiX, that should have a sort of hardware acceleration
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  6. #6

    Slow when drawing the Map into another surface

    Quote Originally Posted by Legolas
    You may switch to Jicro's UnDephiX, that should have a sort of hardware acceleration
    Is his units workarrounded with the latest unDelphiX units?

  7. #7

    Slow when drawing the Map into another surface

    Quote Originally Posted by nildo
    Quote Originally Posted by Legolas
    You may switch to Jicro's UnDephiX, that should have a sort of hardware acceleration
    Is his units workarrounded with the latest unDelphiX units?
    I have changed to his units but it seems not to work propertly. My World editor stopped working like it needs to be.. (the Draw passing the Surface does not works correctly).

  8. #8
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Slow when drawing the Map into another surface

    Jicro has taken over UnDelphiX in all it's unofficial glory. It's the most current version and is considered to be the 'as official as we're gonna get' version of the old DelphiX.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  9. #9

    Slow when drawing the Map into another surface

    Quote Originally Posted by WILL
    Jicro has taken over UnDelphiX in all it's unofficial glory. It's the most current version and is considered to be the 'as official as we're gonna get' version of the old DelphiX.
    Strange... I could not get the DRAW to work correctly with his units... Perhaps you can help me?

    Code:
    procedure TDrawEngine.ApplyDraw(Sender: TObject; LagCount: Integer);
    var
       nAux: Integer;
    begin
       // Pinta o fundo
       Surface.Fill(clBlack);
    
       // Requisita pintura das layers
       for nAux := 0 to High( FLayers ) do
       begin
          // Se a layer estiver vis??vel
          if FLayers[ nAux ].Visible then
          begin
             // Requisita pintra
             FLayers[ nAux ].RequestDraw;
    
             // Desenha a layer
             Surface.Draw( 0, 0, Surface.ClientRect, FLayers[ nAux ].Surface, False );
          end;
       end;
    
       // Se tem que desenhar a grid, desenha
       if FShowGrid then
          DrawTheGrid;
    
       // Se tem que desenhar os numeros, desenha
       if FShowNumbers then
          DrawTheNumbers;
    
       // Desenha um ret?¢ngulo onde o mouse est?°, dependendo do tipo
       case UsingTool of
          utColision: DrawMouseSquare( clRed );
          utTerrain : DrawMouseSquare( clYellow );
       end;
    
       // Desenha os Frames Por Segundo
       DrawFPS;
    
       // Applica as altera?ß?µes
       Surface.Canvas.Release;
       Flip;
    end;
    this line: Surface.Draw is not working. Or it's working, but the layer surface does not get's to the main surface

  10. #10

    Re: Slow when drawing the Map into another surface

    Quote Originally Posted by nildo
    What do you sugest for me to show de map of the area? I was pretending to draw it with alpha blending on the screen, with the colision blocks, NPCs and Players (isometric 2d mmorpg game).
    Blending is going to be slow with DelphiX; no real way around that. Others here are suggesting UnDelphiX, which I have no experience with, but if it can do the hardware blending you need, then it sounds like a good direction to head in.

    (Omega is a fantastic hardware-accelerated Delphi game/graphics lib, too!)
    Game-Dev Journal: http://skirmish.dreamhosters.com/devlog/

Page 1 of 4 123 ... LastLast

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
  •