Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Low Frame Rate. How to deal with this problem?!?!?!?!?

  1. #11

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    The Lion - there is a limiter also included in the game it activates with the "F" button it limits the fps to 60.

    WiZz - i know the graphics sux but the guy thats doing them is quite lazy and i cant talk him into improving them and adding more.

    Traveler - the flickering you were saying what Video Card do you have?
    because i've noticed it too but only on a few VGA cards.
    on my GF4 MX440 it doesnt flicker and on a 1 mb Matrox VGA also doesnt flicker but on some does and i cant understand why.
    About the new text method you and TheLion mentioned i will try it out

    thanks for all the quick replies

    by the way the game have quite some features
    it includes (usually) a map editor which allows to create/edit maps and create your own campaigns, the graphics are easy to manipulate/edit/replace/add same for the sound/music (the music in this version is cutted off because its 6 mb)
    by the way the music is quite good .

    but there is still a lot of work on the game the code at the moment is sooooo messed up that when i begin to write i need atleast 2 minutes to understand where i am
    not to mention the AI and PathFinding which are at the lowest possible level

    again thanks for all the replies

  2. #12
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    Question thats been buggin me that I havn't tried to answer yet but maybe someone here can do so for me:

    On the issue of writting text, would it work to create a surface and use the GDI methods to draw the text to that surface and then internal to the program use the surface as an image to draw to screen?
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  3. #13

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    @ Cairns, yes it would work, but I'm affraid it would have the same disadvantages as writing the canvas text directly to the screen, since you will still be using the GDI functions for writing the text it will also slow you down.
    Do it by the book, but be the author!
    <br />
    <br />Visit the Lion Productions website at:
    <br />http://lionprod.f2o.org

  4. #14

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    @Hammer: I'm using a radeon 8500.
    The flickering is especially visible underneath the texts. Perhaps you could try to replace it with an image and remove the text.

    @cairnswm: Thats an interesting idea! Write the text to a surface once and then use that image over and over again.

    This is how it would work:
    [pascal]
    (..)
    var
    Form1: TForm1;
    textImg : TDirectDrawsurface;

    implementation

    {$R *.DFM}

    procedure TForm1.DXDraw1Initialize(Sender: TObject);
    var counter : byte;
    begin
    randomize;
    textImg := TDirectDrawSurface.Create(DXDraw1.DDraw);
    textImg.SetSize(250,150);
    TextImg.Fill(0);
    TextImg.Canvas.Font.Color:= clred;
    TextImg.Canvas.brush.Style := bsclear;
    for counter := 1 to 10 do
    TextImg.Canvas.TextOut(random(50)+10,(15*counter), 'A GameProgrammer''s Journey');
    TextImg.Canvas.Release;

    dxdraw1.surface.Canvas.Font.Color:= clblue;
    dxdraw1.surface.Canvas.brush.Style := bsclear;

    dxtimer1.Enabled:=true;
    end;

    procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
    begin
    dxdraw1.surface.Fill(0);
    dxdraw1.Surface.Draw(0,0, TextImg.ClientRect,TextImg,true);
    dxdraw1.Surface.canvas.textout(form1.width-50,10,'fps:'+inttostr(dxtimer1.framerate));
    dxdraw1.Surface.canvas.release;
    dxdraw1.flip;
    end;

    procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
    textImg.free;
    end;

    end.[/pascal]

    Of course this solution does not work when you constantly need to change the text, like the fps text in my sample.

    Btw, since this still is a topic on how to deal with fps. Notice that I init the font color and brush of the dxdraw canvas in the DXDraw1Initialize procedure. I've seen quite a few people doing this in the dxtimer procedure.

    @Lion. Not necessarily. As you can see, the text is written at startup. It doesn't really matter how long it takes. After the text is written onto the image, you can simply use the image to display the text.

    And in case you need to change the text, (not continuesly of course) you can write a procedure to erase the image and write a new text on to it.

  5. #15

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    @Traveler & Cairns, yes if the text is more or less static it would indeed work, I just figured he meant dynamic text that would change all the time, like a framerate value or score, however if you would only write the text to the bitmap when it changes you would slow down you app in 1 frame and keep fast speed the rest from the frames losing only a little bit in speed! I stand corrected! hehe
    Do it by the book, but be the author!
    <br />
    <br />Visit the Lion Productions website at:
    <br />http://lionprod.f2o.org

  6. #16
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    Even doing a score or FPS might be faster doing it this way. A players score doesn;t change every frame, but only every few seconds - if this method saves a few ms each time writing to the temp surface would still increase FPS.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  7. #17

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    Traveler - hm... yes indeed, now it seems that the idea for bitmap fonts is more and more needed. But i am still wondering why the screen is flickering maybe something is not supported by the ATI drivers or ... i just dont know.

    i will try out the idea about the second surface to see if there is any improvement.

  8. #18

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    Quote Originally Posted by cairnswm
    Even doing a score or FPS might be faster doing it this way. A players score doesn;t change every frame, but only every few seconds - if this method saves a few ms each time writing to the temp surface would still increase FPS.
    I agree, my post was more or less thinking out loud! My last line was: "I Stand corrected"! hehe
    Do it by the book, but be the author!
    <br />
    <br />Visit the Lion Productions website at:
    <br />http://lionprod.f2o.org

  9. #19
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    I agree, my post was more or less thinking out loud!
    My reply was sort of after reading your first sentance.... I was too quick on the reply
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  10. #20

    Low Frame Rate. How to deal with this problem?!?!?!?!?

    Small report:
    1) your FPS is limited by VSync, so on mine system it's equal 60fps.
    2) disabling VSync raises FPS to 100 - seems it's limited by timer/phisics when - NOT by 3D card. YEP: "DXTimer.Interval = 10" !!!
    3) Cirillic text is rendered OK in mine Russian locale system.
    4) Now text/graphics flickering awfully in "mission debrief" (first to display) screen in default mode. But when I disable VSync it's rendered correctly.
    5) "destructor Destroy ; reintroduce;" --> should be "destructor Destroy; override;"
    There are only 10 types of people in this world; those who understand binary and those who don't.

Page 2 of 3 FirstFirst 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
  •