Results 1 to 5 of 5

Thread: i need some advices that i can't find easly:(

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    i need some advices that i can't find easly:(

    about frames count:
    1 - i capture the actual time with GetTickCount() api function to TempStart.
    2 - inside of game loop i count the frames;
    3 - i capture the next time with GetTickCount() api function to TempEnd.
    4 - i do TempEnd - TempStart and if is more and igual than 1000, i put the frames count to another variable and i reset the frame count.
    is these pesudo-code correct?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: i need some advices that i can't find easly:(

    Didn't I show you how before? Cause what I showed you before was exactly what you just said, so yes, thats correct.

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: i need some advices that i can't find easly:(

    Quote Originally Posted by Jacob Roman View Post
    Didn't I show you how before? Cause what I showed you before was exactly what you just said, so yes, thats correct.
    don't be mad... i must build my own code
    i continue without understand 2 things:
    1 - how avoid use very CPU?;
    2 - how control the number of frames for not be very faster on other machine?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #4
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: i need some advices that i can't find easly:(

    I wasn't mad, I was just saying you are correct.

    When it comes to making games, using the Do Loop or While loop will unfortunately lead to very high CPU usage. You can see this in majority of your major games for your PC. If you run them, you will see a lot of CPU usage being used. This is expected as the games are taking advantage of every aspect of your computer such as the video card, all the 3D graphics, the physics, the sound, and all the calculations that need done, etc etc. However the only way you can really really control your CPU usage is through C++ using various multithreading techniques. However its not really worth the hassle because A) Major games use a lot of CPU anyways, and B) A program using a lot of CPU isn't gonna affect your computer too much. Just as long as thats the only major game running. Otherwise you'll notice maybe a little lag. Noone really runs two major games at the same time anyways.

    Now to answer your next question, theres 2 ways you can go about this. One is to use DirectX. DirectX handles the framerate for you automatically and goes with the monitors refresh rate. The other way I showed you using VB6 but can be converted to C++, and thats to lock the framerate at 60 frames per second. The function I created you can lock the framerate at any rate you want. But since most monitors run at 60 Hz. you should stick with 60 FPS.

  5. #5

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: i need some advices that i can't find easly:(

    Quote Originally Posted by Jacob Roman View Post
    I wasn't mad, I was just saying you are correct.

    When it comes to making games, using the Do Loop or While loop will unfortunately lead to very high CPU usage. You can see this in majority of your major games for your PC. If you run them, you will see a lot of CPU usage being used. This is expected as the games are taking advantage of every aspect of your computer such as the video card, all the 3D graphics, the physics, the sound, and all the calculations that need done, etc etc. However the only way you can really really control your CPU usage is through C++ using various multithreading techniques. However its not really worth the hassle because A) Major games use a lot of CPU anyways, and B) A program using a lot of CPU isn't gonna affect your computer too much. Just as long as thats the only major game running. Otherwise you'll notice maybe a little lag. Noone really runs two major games at the same time anyways.

    Now to answer your next question, theres 2 ways you can go about this. One is to use DirectX. DirectX handles the framerate for you automatically and goes with the monitors refresh rate. The other way I showed you using VB6 but can be converted to C++, and thats to lock the framerate at 60 frames per second. The function I created you can lock the framerate at any rate you want. But since most monitors run at 60 Hz. you should stick with 60 FPS.
    can i test if any key was pressed by using GetAsyncKeyState()?
    i build a nice function for these, but i get unpested results
    VB6 2D Sprite control

    To live is difficult, but we do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width