Results 1 to 6 of 6

Thread: Weird framerate problem

  1. #1

    Weird framerate problem

    I'm programming a Pacman game (how original ? hehe) mainly to learn how directdraw works.

    Everything is perfect except for one small problem.

    The framerate drops for about 2 seconds on the 3rd second of play and then goes back to normal for the rest of the game. If I start a new game the slowdown does not happen.

    Ex:
    1.Game starts
    2. Frame rate is 33 for the first 2-3 seconds
    3. Drops to 22 for about 2 seconds
    4. Goes up to 33 and never change after that.
    5. If the game is over I restart a new game..and no slowdown
    6. If I close the exe and run it again I'll get the slowdown for the first game

    It's really weird.

    Any idea ?

  2. #2

    Weird framerate problem

    hmmm I have set dowaitvblank and the framerate is pretty much stable now.

    Anyone can explain it to me ? I find it very strange I get a slowdown when dowaitvblank is true only at a particular time and when a game restarts (i.e the game displays the same number of sprites) the slowdown does not happen.

  3. #3

    Weird framerate problem

    oops nevermind I still have the problem.
    It's driving me crazy.

    I reduced the timer interval and disabled the collisions detection and I still have the problem.

    100 fps for the first seconds...then a big drop for an unknown reason and back to 100 for the rest of the game.

  4. #4

    Weird framerate problem

    What's your game doing the first time you start it?

    It's possibly just a glitch in the DX timer of DelphiX -- though that isn't likely. Have you tested whether this occurs on other machines (if not, post a download link here for us to check it).

    Create an empty DelphiX project that does nothing but (e.g.) display the frame rate. See if the fall-off and recovery happens in that. If it doesn't then it's something specific to your code.
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  5. #5

    Weird framerate problem

    Additional info

    If I add a sleep() long enough (something like 9000) after the sprites craetion and the main draw routine I don't get the slowdown.

    Example:

    procedure TForm1.DXTimerTimer(Sender: TObject; LagCount: Integer);
    begin
    if (not DXDraw.CanDraw) then exit;
    DXInput.Update;
    if titlescreen then scenetitle else
    if not(pause) then maindraw;
    DXDraw.Flip;
    end;

    and in the scenetitle procedure when the space key is pressed:
    CreateSprites; //Procedure that creates the sprites
    Sleep(9000);
    pause:=false;
    titlecreen:=false;

    I really don't get it. It must be a stupid thing.

  6. #6

    Weird framerate problem

    Another weird thing. If I run it from Delphi I have no slowdown.
    If I run it from the Explorer I have the slowdown.

    hmmm It seems it's not my code.

    I tried a sample that comes with DelphiX (the shooter) and modified the title screen to display the framerate. If I run it from Delphi it's stable and if I run it from the explorer there is also a slowdown.

    P.S.
    No other application is running
    I have XP

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
  •