Let's say, hypothetically...

This is a discussion on Let's say, hypothetically... within the Game Programming forums, part of the General Programming Boards category; There is your problem. DirectDraw 7 is not guaranteed to work with DirectX 9. There were some things that just ...

  1. #16
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    There is your problem. DirectDraw 7 is not guaranteed to work with DirectX 9. There were some things that just could not be backwards compatible and I'm sure DirectDraw is one of them.

    Attempting to use DX7 interfaces on DX9 is not a good idea. DX7 would mean the game is over 8 years old.

  2. #17
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    So is it a video card thing, then? What are my options for fixing
    it?

    //edit
    Wait. Just woke up. Still confused. It's not guaranteed to run on
    Directx 9 cards, or is it something to do with what I've included in
    my project?

    I have a Radeon 9800 Pro; and so does my friend who says the
    game works fine. My friend who says the game sucks has a Geforce
    6800 GT or something. Not sure what the lady from ES has that
    said it almost crashed her computer.
    Last edited by Cheeze-It; 09-09-2006 at 11:42 PM.
    Staying away from General.

  3. #18
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    Here's the hypothetical thread

    http://forums.entropysink.com/index.php?topic=2800.0

    notice all the complaints.
    Staying away from General.

  4. #19
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Are you using timeGetTime, GetTickCount() or something else to do timing?

    Summary of issues:
    • The main character can walk off the screen and cannot come back
    • The window can lose focus and will lose the title bar thus making it impossible to close. Trap for the set focus message or the message windows sends when a window is about to lose focus. If you are using DirectInput this will require you to unacquire() the mouse and then reacquire it.
    • The window update function is not updating correctly for all frames. First 3 or 4 iterations work fine and then it starts skipping around. Seems like a timer issue.
    • Input lags behind render due to the timing issue - input is accepted but render skips so both seem to lag.
    • Pressing CTRL ALT DEL to bring up task manager, sticks your game inside the task manager window b/c the window loses focus and thus loses title bars and turns into a mess.


    One sure way to solve this problem would be to move to full screen mode and use the refresh rate of the desktop.
    If you made the artwork then congrats because it is very good and I'd like to use your talents for a game we are working on.

    The update loop from my code is:

    Code:
    int CD3DApp::EnterMsgLoop(void)
    {
      MSG msg;
      ::ZeroMemory(&msg, sizeof(MSG));
    
      static float lastTime = (float)timeGetTime(); 
    
      while(msg.message != WM_QUIT)
      {
         if(::PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
        {
           ::TranslateMessage(&msg);
           ::DispatchMessage(&msg);
        }
        else
        {	
          float currTime  = (float)timeGetTime();
          float timeDelta = (currTime - lastTime)*0.001f;
          ScreenRender(timeDelta);
          lastTime = currTime;
        }
      }
      return msg.wParam;
    }
    This is for a terrain system so your setup would be a bit diff. ScreenRender() is actually the main rendering loop and I put the keyboard and input updates into that. You would probably want to put that inside the MsgLoop function and pass the fTimeDelta to it so it can respond according to the current FPS. You would respond to other Windows messages inside of your WndProc function for the game window and take appropriate action based on the message.
    Last edited by VirtualAce; 09-11-2006 at 12:56 AM.

  5. #20
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    Thanks for replying. Hmmm. Maybe since this issue has moved
    from hypothetical to actual it should be moved to the game board.

    Quote Originally Posted by Bubba
    Are you using timeGetTime, GetTickCount() or something else to do timing?
    I tried both of those, but neither of them seemed to work well.
    I can't remember my exact reasoning for going with my current
    method because it was so long ago, though.

    Here's my entire clock class:

    Code:
    class cl_Clock
    {
    	public:
    		cl_Clock();
    		~cl_Clock();
    
    		static cl_Clock& Global();
    		
    		double GetCurrentTime();
    		double GetPreviousTime();
    		double GetDeltaTime();
    
    		void Update();
    
    	private:
    		__int64 TicksPerSecond;
    		__int64 TicksSinceSystemStart;
    
    		double CurrentTime;
    		double PreviousTime;
    		double DeltaTime;
    
    		unsigned int Counter;
    };
    Constructor:

    Code:
    cl_Clock::cl_Clock():	TicksSinceSystemStart(0), TicksPerSecond(0), CurrentTime(0.0f), PreviousTime(0.0f), DeltaTime(0.0f)
    {
    	if(!QueryPerformanceFrequency((LARGE_INTEGER*)&TicksPerSecond))
    	{
    		cl_Log::Global().Error("High Resolution Timer not supported");
    	}
    }

    Code:
    void cl_Clock::Update()
    {
    	PreviousTime = CurrentTime;
    
    	//get time ("ticks") since system start
    	QueryPerformanceCounter((LARGE_INTEGER*)&TicksSinceSystemStart); 
    
    	//convert to seconds
    	CurrentTime = ((double)TicksSinceSystemStart / (double)TicksPerSecond);
    	
    	DeltaTime = (CurrentTime - PreviousTime);
    }
    I call cl_Clock::Update() at the beginning of the main game loop and base
    all the movement and such off of DeltaTime.

    Summary of issues:

    * The main character can walk off the screen and cannot come back
    * The window can lose focus and will lose the title bar thus making it impossible to close. Trap for the set focus message or the message windows sends when a window is about to lose focus. If you are using DirectInput this will require you to unacquire() the mouse and then reacquire it.
    * The window update function is not updating correctly for all frames. First 3 or 4 iterations work fine and then it starts skipping around. Seems like a timer issue.
    * Input lags behind render due to the timing issue - input is accepted but render skips so both seem to lag.
    * Pressing CTRL ALT DEL to bring up task manager, sticks your game inside the task manager window b/c the window loses focus and thus loses title bars and turns into a mess.
    On my Radeon 9800Pro, my framerate is about 1600 and everything runs
    fine. In fact, if I don't draw the background each frame, the fps can get to
    over 3000 (and stays relatively consistant) and still no problems timing wise,
    no input problems either. Still runs silky smooth.


    The only problem that does happen is that, see.. I draw the entire background
    each frame and draw the other stuff over that. Everytime I draw the background,
    the previous frame is effectively erased. When I don't draw the background,
    I get just a bunch of images drawn over each other. But that's expected.


    I don't experience any of those issues. And the other people who I've
    asked to test it with ATI cards don't, either. But my friend with his Geforce
    6800GT, Gametaku with his Geforce 7800something both experience them.
    Jawib tried it on both an ATI card and an nVidia Quadsomething. He had
    the problems on the nVidia card but said it worked on his ATI.

    If you hit "E", the framerate will lock to about 60fps. But I just did that with
    Sleep() to make sure physics things would happen independent of the framerate.
    I wanted the blood to fall at the same speed whatever the framerate was.

    As far as input goes, I'm only using WM_KEYUP / WM_KEYDOWN messages
    to set a state in a cl_Keyboard class. I'm not using DInput or anything. And
    I don't experience any problems.

    Code:
    void cl_Window::PreWinProc()
    {
    	while(PeekMessage(&Message, Handle, 0, 0, PM_REMOVE))
    	{
    		if(Message.message == WM_KEYDOWN)
    		{
    			cl_Keyboard::Global().SetKeyDown(Message.wParam);
    
                            /*
                                Omitted
                            */
    
    		}
    		
    		if(Message.message == WM_KEYUP)
    		{
    			cl_Keyboard::Global().SetKeyUp(Message.wParam);
    		}
    
    		TranslateMessage(&Message);
    		DispatchMessage(&Message);
    	}
    }
    If you made the artwork then congrats because it is very good and I'd like to use your talents for a game we are working on
    Oh, yes. I did do the artwork. I'd love to be a part of things, but my
    digital graphics experience is limited to MSPaint. I bought a book on
    Maya a few months ago. Haven't had a chance to read it. And the newest
    version of Corel Painter *is* on my Amazon wish list along with a Wacom
    pen tablet.
    Last edited by Cheeze-It; 09-11-2006 at 01:54 AM.
    Staying away from General.

  6. #21
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    Quote Originally Posted by Ken Fitlike
    Done.
    Dude, that's so weird. Because I was browsing it while you
    moved it. Next thing I know, I'm on the Games board. It seriously
    felt like I went through a wormhole or something.

    btw Ken, did you experience any of these problems when you
    tried it? What card do you have?
    Staying away from General.

  7. #22
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    No, it worked fine for me - I have an ati card. If I have time, I'll check it later with Mrs Herself's machine; it has an ancient nvidia card but I think it has the dx9 runtimes installed.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  8. #23
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Just tried it. Man that is some serious input laaaaaag.
    I've got an nvidia card (6600GT) DX9.0c runtimes, 3GHz P4, 1GB RAM.
    I got gibbed by some floating thing
    EDIT: Plus it dirtied my desktop when I quit, requiring a refresh.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  9. #24
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    That's it. I'm calling nVidia to see if I could get some of their
    engineers to help me with this issue.
    Staying away from General.

  10. #25
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    Quote Originally Posted by ahluka
    Plus it dirtied my desktop when I quit, requiring a refresh.
    Not really sure what you mean by "dirtied." Sometimes
    when you close the window, a frame is left on top of the
    desktop. If you just move another window over it or
    something it should disappear. I don't know how to repaint
    the desktop..

    But that's how it runs on my machine, which of course, isn't
    freakin' typical! >.<
    Staying away from General.

  11. #26
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    I was correct in my assumption and solution to the problem. Pressing 'E' which locks the frame rate to a specified rate works just fine on my NVidia card. This may be something as simple as ATI cards have vsync on by default and NVidia has them off. Or it may be that certain people have disabled vsync on their NVidia control panel and others have not. NVidia does have a problem when you get extremely high FPS. I'm not sure of the root cause and since I'm not a professional developer I doubt they would care what I have to say about it.

    Tell NVidia testers to press 'E' to lock the frame rates and the lag issue with the game will be corrected.

    EDIT:

    After further testing it appears that if you press number 6 for timing information the hesitation stops regardless of the frame rates. This is most likely because printing the values out or doing the sprintf() or whatever you are using is uncorrupting the data. I've had this happen to values before. You can usually tell if you are getting normal values after a MessageBox() is displayed but without it you are getting funky values. Somewhere in your code, the timing values are getting corrupted and/or perhaps overflowing the data type. It may also be an accuracy issue since the frame rates are so high and the time delta is so small perhaps your data type is losing precision. Since the game works perfect with the timings displayed I no longer feel this is a video card issue. If it were, nothing would change the outcome.
    Last edited by VirtualAce; 09-11-2006 at 05:26 AM.

  12. #27
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Quote Originally Posted by ethic
    Not really sure what you mean by "dirtied." Sometimes
    when you close the window, a frame is left on top of the
    desktop. If you just move another window over it or
    something it should disappear. I don't know how to repaint
    the desktop..

    But that's how it runs on my machine, which of course, isn't
    freakin' typical! >.<
    Aye, it leaves parts of the window behind. Right click->Refresh job.

    I'll try that 'E' business now.

    EDIT: Yeah pressing E works. Did you seriously draw all of that by hand in MSPaint?! Joo teh mspaint king!
    Last edited by cboard_member; 09-11-2006 at 05:26 AM.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  13. #28
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Hey ethic, I just looked at the .bmp file... do you animate the head, torso and legs of the character seperately?
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  14. #29
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    Quote Originally Posted by Bubba
    I was correct in my assumption and solution to the problem. Pressing 'E' which locks the frame rate to a specified rate works just fine on my NVidia card. This may be something as simple as ATI cards have vsync on by default and NVidia has them off. Or it may be that certain people have disabled vsync on their NVidia control panel and others have not. NVidia does have a problem when you get extremely high FPS. I'm not sure of the root cause and since I'm not a professional developer I doubt they would care what I have to say about it.

    Tell NVidia testers to press 'E' to lock the frame rates and the lag issue with the game will be corrected.

    EDIT:

    After further testing it appears that if you press number 6 for timing information the hesitation stops regardless of the frame rates. This is most likely because printing the values out or doing the sprintf() or whatever you are using is uncorrupting the data. I've had this happen to values before. You can usually tell if you are getting normal values after a MessageBox() is displayed but without it you are getting funky values. Somewhere in your code, the timing values are getting corrupted and/or perhaps overflowing the data type. It may also be an accuracy issue since the frame rates are so high and the time delta is so small perhaps your data type is losing precision. Since the game works perfect with the timings displayed I no longer feel this is a video card issue. If it were, nothing would change the outcome.
    kay, kay, kay. Getting close.

    Displaying the timing information cuts the framerate drastically.
    Without it displayed, I get about 3100 fps; when I do display it,
    it cuts down to about 1200.

    Still thinking. Still. Hmmmm. Hmmm. HMMMM.

    So this timing thing is deifnitely the issue? Not a vsync deal, right?
    Because I have no idea what that means and no idea how to fix it.
    Staying away from General.

  15. #30
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    Quote Originally Posted by ahluka
    Hey ethic, I just looked at the .bmp file... do you animate the head, torso and legs of the character seperately?
    Yeah. The only thing that's really "animated" is the torso. I change
    the to a different legs image every 10 pixels moved; and choose
    which head based on the degrees of... like... It's a trig thing. The
    only thing I remember from my math days.

    Here's a pic (it's not an actual screenshot. Just crap I cut and
    paste to give me a visual idea of how to do it. ):
    Attached Images Attached Images  
    Staying away from General.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21