![]() |
| | #1 |
| Registered User Join Date: Oct 2004
Posts: 4
| getting maximum CPU speed |
| 13th Phazer is offline | |
| | #2 |
| +++ OK NO CARRIER Join Date: Oct 2001
Posts: 10,639
| You mean waste CPU cycles? I really really doubt your program is efficiently using the entire processor. It's likely just wasting CPU cycles inefficiently. What's the point of hogging all of the processor time? I really doubt your program needs the full CPU to function. Quzah.
__________________ Hundreds of thousands of dipshits can't be wrong. Are you up for the suck? |
| quzah is offline | |
| | #3 |
| Registered User Join Date: Mar 2003
Posts: 3,898
| OS on school computer? Do you have Administrator priviges on school computer? What does program do? Why do you want all the processing power? Welcome. gg |
| Codeplug is offline | |
| | #4 |
| Registered User Join Date: Oct 2004
Posts: 4
| OS at school is XP, I have full administrative powers, I am writing an OpenGL program in a Win32 application. I want to use the full processor because the way I am currently setting the program up, it is too slow when it is only using 4% of the processor due to the fact I wrote it on the other computer, and I am trying to make a semi-realistic solar physics program and speeding up the rate at which i increment my variables not only changes the proportions, but also reduces the accuracy. Another note: I checked the school computers and it is not limiting the amount of CPU usage, it is limiting the amount of times my game loop actually occurs. I checked it by adding an increasingly large loop that does nothing while watching the CPU usage. The program does not slow down at all with a loop of 1 million itteration running because the computer only sets the amount of times the game loop occurs... I do not want this because if I wanted to cap anything it would be the calculations and not the frame rate (after all, what is a graphical simulation without nice graphics?) |
| 13th Phazer is offline | |
| | #5 |
| Registered User Join Date: Mar 2003
Posts: 3,898
| In Windows, there are process and thread priorities that dictate how much CPU time a thread recieves. However, it is highly unlikely that the other 96% of the CPU is being used by higher priority threads. Can you see where the other 96% of the CPU is being used, if any (System Idle Process)? Also, there's a huge difference between CPU ussage and frame rate. Are you measuring the frame rate? How does the frame rate differ on each PC? What are the stats on each PC? gg |
| Codeplug is offline | |
| | #6 |
| Super Moderator Join Date: Aug 2001
Posts: 7,813
| There are several ways. First you do not need to slow down the computer. You need to base your frame updates on elapsed time. This takes into account the time it took to render the frame as well as the speed of the current computer. You can use timeGetTime() which has its flaws in accuracy or QueryPerformanceCounter() in the API that is extremely accurate. Code: void Render(float timeDeltaFrame,float timeDeltaPhysics)
{
PhysicsEngine.Update(timeDeltaPhysics);
//Update everything else on timeDeltaFrame
}
|
| Bubba is offline | |
| | #7 |
| Registered User Join Date: May 2003
Posts: 135
| Or it could be that you have a crappy video card at school and the CPU is waiting on the GPU to process the geometry... |
| dalek is offline | |
| | #8 |
| Registered User Join Date: Mar 2003
Posts: 3,898
| The 100% CPU is using software rendering while the 4% CPU has the benefit of 3D hardware to do the work. (an interesting thought) gg |
| Codeplug is offline | |
| | #9 |
| Super Moderator Join Date: Aug 2001
Posts: 7,813
| Doesn't matter. They should run at the desired framerate regardless of speed, software, hardware, etc. That's your job to get it to run at the same speed regardless of platform. |
| Bubba is offline | |
| | #10 | |
| +++ OK NO CARRIER Join Date: Oct 2001
Posts: 10,639
| Quote:
Quzah.
__________________ Hundreds of thousands of dipshits can't be wrong. Are you up for the suck? | |
| quzah is offline | |
| | #11 | |
| Super Moderator Join Date: Aug 2001
Posts: 7,813
| Quote:
For instance if I create a game it might really smoke on one computer and really trudge on another. If it trudges too bad then I would say that computer does not meet my targeted system specs. However if it trudges on a top end system then its obviously my code or my algos. Essentially you shoot for the baseline system that you think everyone out there has access to. Or you could shoot for extremely high specs like DOOM 3 or some newer FPS's. Regardless though the actual gameplay should run at the same speed regardless of the frame rate. I guess that is what I was referring to. Older games that did not take clock cycles into account will be so fast on newer systems they will be unplayable. But if they did take into account clock cycles and they were shooting for 30 FPS as their cap, then that game should run on every system at a cap of 30 frames per second. The cap should not be exceeded or the game might run at well over 200 FPS, the physics/motion portions would be so fast as to be uncontrollable, and you couldn't play it. Some older games suffered from this. But games like Dynamix's simulations and Sierra simulations should (if they could run in XP) run at the same speed as a top end system running the same game. So I guess I'm talking more about a step up to a faster system than a step down. Your code should run the same speed as in one should not be fifty times faster on a computer that is fifty times faster. I'm looking into multiplayer code and syncing the systems when there are about ten billion computer configs out there is a tough issue - one which often causes lag for the fast systems since they must sync with slower systems, or slower systems must sync with fast systems on slow connections. But in this case and for this thread a simple time based approach will work. Here is a small example. Code: unsigned long FrameCounter;
float ElapsedTime;
float FPS;
void CalculateFPS(float timeDelta)
{
FrameCounter++;
ElapsedTime+=timeDelta;
if (ElapsedTime>=1.0f)
{
FPS=(float)FrameCnt/ElapsedTime;
ElapsedTime=0.0f;
FrameCounter=0;
}
}
Sorry so long but that needed some clarification. Last edited by Bubba; 10-20-2004 at 04:10 AM. | |
| Bubba is offline | |
| | #12 | ||
| +++ OK NO CARRIER Join Date: Oct 2001
Posts: 10,639
| Quote:
Quote:
![]() Quzah.
__________________ Hundreds of thousands of dipshits can't be wrong. Are you up for the suck? | ||
| quzah is offline | |
| | #13 | |
| and the hat of marbles Join Date: May 2002 Location: Lund, Sweden
Posts: 2,041
| Quote:
Code: void calculateFPS(float timeDelta)
{
FPS = 1/timeDelta;
}
__________________ Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling | |
| Sang-drax is offline | |
| | #14 |
| Super Moderator Join Date: Aug 2001
Posts: 7,813
| No, I don't have Quake 3. But I just got Joint Ops by Novalogic. I'm not really into Quake's and Unreal's though I have most of em. I'm more of a simmer and tactical FPS guy. But hey, I love all games. Hope I didn't come off too harsh but its not always easy to explain what you mean here. And drax I like that method much better. Will certainly change mine. Thanks. |
| Bubba is offline | |
| | #15 |
| Registered User Join Date: Oct 2004
Posts: 4
| Wow, thanks a lot, but now i need to find a way to keep the angle changes, movement, text, and everything else in proportion as I switch to time based... *sigh* |
| 13th Phazer is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| questions on multiple thread programming | lehe | C Programming | 11 | 03-27-2009 07:44 AM |
| Running a console program with maximum speed | arno-nyme | Linux Programming | 27 | 06-01-2008 12:41 AM |
| Upgrading my old CPU (for another old one!) | foxman | Tech Board | 16 | 01-11-2008 05:41 PM |
| maximum number | drdodirty2002 | C Programming | 7 | 05-08-2003 05:33 PM |
| How do I discover the CPU Speed? | Scripter | C Programming | 4 | 10-27-2002 01:38 PM |