Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 45

Thread: DELPHIX Problems. Need help with multiple problems

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

    DELPHIX Problems. Need help with multiple problems

    Quote Originally Posted by seiferalmasy
    That avatar of yours is freaking me out by the way
    I know, it's creepy isn't it?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  2. #22

    DELPHIX Problems. Need help with multiple problems

    without a doubt

  3. #23

    DELPHIX Problems. Need help with multiple problems

    Quote Originally Posted by Traveler
    The movement of sprites has nothing to do with refreshrates. Only with time.
    Code:
    at game start up, get time
    while your game is running 
    begin
      calculate elapsed time for current frame 
      save newly retrieved frametime
    
      Player1.x:= Player1.x * elapsed time
    end;
    I have looked back on this to see if it is any better than the methods I have tried. How would I go about measuring the time of the frame etc? and getting time? How would I go about implementing the above?

    I have a small prob now...game seems to jump even with vsync on...if I measure the frame rate of dxtimer during play I see it is going from between 79-85 (85 being my monitor refresh rate). Why isnt the frame rate steady? I use high priority mode and it seems to work alot better but then my controls go awkward and soemtimes don't respond. I have checked processes but nothinbg appears to be wrong.

    maybe I have done something in the code or used an option in dxdraw that slows the game down? Someone mentioned lagcount being able to help in skipping situations?

  4. #24

    DELPHIX Problems. Need help with multiple problems

    IIRC lagcount is the equivalent of frametime.
    ie player.x := player.x +1 * lagcount should work for you when using dxtimer.

    Alternatively, when using your own gameloop (for example in the application.onIdle event.) the method I wrote above works.

    Here's some sample code too (note: I haven't actually compiled it so it may contain a syntax error, but I'm sure it'll get the point across)
    Code:
    procedure mainloop();
    begin
      finished := False;
    
      gameStart := GetTickCount();            // Get Time when demo started
    
      while not finished do
      begin
         LastTime := ElapsedTime;
         ElapsedTime := GetTickCount() - gameStart ; //Calculate Elapsed Time
         ElapsedTime := (LastTime + ElapsedTime) div 2;
          
         {.. your other stuff in here...}
         player.x := player.x + player.xspeed *  ElapsedTime 
         {.. your other stuff in here...}
      end;
    end;
    That avatar of yours is freaking me out by the way
    Wait until you see the next one

  5. #25

    DELPHIX Problems. Need help with multiple problems

    and onto one of the final points:

    Is anyone ever going to fix the buggy force feedback in dxinput?

    I have 2 problems with that component. USB joypads don't seem to work at all with force feedback. If Usedirectinput is set to true also, a constant -x value is put into the input states from somewhere and the character just veers off to the left. I have to use analog to get around the problem....

    Anyone know where I can contact soemoen who may be working on bug fixes to delphix in the hope they may consider sorting these issues?

  6. #26

    DELPHIX Problems. Need help with multiple problems

    Problem making music play in my game. Plays ok but when the song needs to change the game crashes:

    Code:
    procedure setupmusic(thefile:string;looping:boolean);
    var
      WaveFormat: TwaveFormatEx;
    begin
        if (MainFm.Music1.enabled=true)then
      begin
         mainFm.Audio.AutoUpdate := True;
        mainfm.Audio.BufferLength := 1000;
        mainfm.Audio.FileName :=TheFile;
        mainfm.Audio.Looped := looping;
    
    
        MakePCMWaveFormatEx(WaveFormat, 22050,        mainfm.Audio.Format.wBitsPerSample, 2);
        mainfm.DXSound1.Primary.SetFormat(waveFormat);
    
        end;
    end;
    I pass the file to be played in then say audio.play; It is some problem caused by not freeing the music? or not clearing the buffer?

    Anyone know what I am doing wrong here, driving me nuts.

  7. #27

    DELPHIX Problems. Need help with multiple problems

    Just a guess, but it would seem to me that you can't actually set the buffer length to some random value.

  8. #28

    DELPHIX Problems. Need help with multiple problems

    Even with no buffer the problem persists.

    Seems to be something to do with the wave not loading in time. For example, if I enter the filename with 1 button, then use .play with another all works fine.

    If I enter the filename and then after it add .play in the same button click I get all kinds of error messages i need the music to play from 1 music to the next. Any clue how I can achieve this? I don't want to go back to delphi mediaplayer

  9. #29

    DELPHIX Problems. Need help with multiple problems

    Yeah I was right. Its because I am trying to play the file before the wav has loaded. Question is, how can I program it so that I can be sure the file has loaded and is ready to be played? I can't put sleep(2000) or something similar it just isnt good programming.

  10. #30

    DELPHIX Problems. Need help with multiple problems

    This is a bit of a unknown area to me, but I'd imagine the load function gives back a boolean result. Perhaps you can do something with that?

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