Help in reducing FPS ?

Started by
7 comments, last by Krohm 12 years, 11 months ago
I am running my game engine with rendering and the game logic together on a single computer.
My CPU usage is going at approx 95-100% while running the game, but the FPS is 65 with VSync on.

Is there a way to reduce the CPU being used by the visual rendering, by reducing the FPS rate to say 40, providing more CPU time to the Game logic.

Any help would be great..
Advertisement
What kind of hardware are you running on?
Sounds like there could be some kind of bottleneck in the code.

Rendering is done by the GPU, since your logic and rendering is on one thread you cant really
do much to slow just the rendering down.

Profile your code and make sure you dont have any potential code that causes slow downs.
Sure, just have a timer return the time elapsed since previous frame. If it is below a certain threshold, call Sleep(1 ms). It should be enough.
However, 95% CPU is still a lot. Perhaps the driver is busy-waiting for the Vsync. I'd first try getting the rid of it. Vsync is bad when developing, it introduces considerable deviation for measurements.

Previously "Krohm"

If it is below a certain threshold, call Sleep(1 ms). It should be enough.

This would decrease the amount of computing power available for game logic, not increase it.

Anyhow, a 95% CPU usage doesn't really mean you're using a whole lot of computing power, as the aforementioned sleep(1) would show.
Are you actually short on computing power for game logic? or is this an attempt at preemptive optimization?

Unless you're doing the logic in a separate thread, the calculations should always finish before presenting a new frame, and such as such not result in any problems -- certainly not if you're still managing 65 FPS.

[quote name='Krohm' timestamp='1305878988' post='4813379']If it is below a certain threshold, call Sleep(1 ms). It should be enough.

This would decrease the amount of computing power available for game logic, not increase it.[/quote]No it would not. If the driver is busy looping on vsync then this effectively skips a sync. I bet that profiling will show the application spends most of the time in the drive.
Moreover, if the driver is allowed to cache up to N frames and the CPU is so fast to actually always fill the buffer (very likely) the runtime will stall to allow GPU to catch up.
In this case, sleep(1) would free CPU% as well with little to no noticeable difference.

In both cases, CPU% would be freed for computation - since FPS is locked at (say) 60, this would reflect in less CPU% being used.

Previously "Krohm"

First explain why you want to do this?

The reason your CPU is using that much to run your game is because it has that much to run your game... open several other apps while playing your game if you want to slow your computer down... otherwise don't fret. The only time you should actually want to slow down a game, is when it is being run on a battery dependent device. Such as a phone.

Also if you're using windows task manager to get these values, look it up on msdn. The values aren't always accurate and might be reporting something different then you might think.
[ dev journal ]
[ current projects' videos ]
[ Zolo Project ]
I'm not mean, I just like to get to the point.
Thanks for all the replies.

Firstly more explanation is required on my part

My Situation:
Hardware:
1. Core 2 duo 2.93 Ghz
2. 4 GB DDR 3 Ram
3. ATI XFX 5770 Graphics card running in eyefinity mode : Resolution: 3 x 1600 x 900 ( across 3 monitors )

My Game Engine
1. Running a car racing game
2. The game logic and Physics etc are running in a separate thread

My Current Problem
1. Earlier the game logic was running on a separate PC and Visual rendering on a seperate one, and no issues where there, the FPS was 60 and CPU usage on visual was around 45%
2. Now due to some considerations, merged the game logic and visual rendering together
3. Now when running the entire thing together, the car drives a bit jerky , appearing as if the visual is getting stuck occasionally in between, the FPS is still around 60.

I am not the experienced with profiling the code, so haven't bee able to exactly pinpoint the problem.

First explain why you want to do this?

The reason your CPU is using that much to run your game is because it has that much to run your game... open several other apps while playing your game if you want to slow your computer down... otherwise don't fret. The only time you should actually want to slow down a game, is when it is being run on a battery dependent device. Such as a phone.

Also if you're using windows task manager to get these values, look it up on msdn. The values aren't always accurate and might be reporting something different then you might think.





Thanks for all the replies.

Firstly more explanation is required on my part

My Situation:
Hardware:
1. Core 2 duo 2.93 Ghz
2. 4 GB DDR 3 Ram
3. ATI XFX 5770 Graphics card running in eyefinity mode : Resolution: 3 x 1600 x 900 ( across 3 monitors )

My Game Engine
1. Running a car racing game
2. The game logic and Physics etc are running in a separate thread

My Current Problem
1. Earlier the game logic was running on a separate PC and Visual rendering on a seperate one, and no issues where there, the FPS was 60 and CPU usage on visual was around 45%
2. Now due to some considerations, merged the game logic and visual rendering together
3. Now when running the entire thing together, the car drives a bit jerky , appearing as if the visual is getting stuck occasionally in between, the FPS is still around 60.

I am not the experienced with profiling the code, so haven't bee able to exactly pinpoint the problem.

My Current Problem
1. Earlier the game logic was running on a separate PC and Visual rendering on a seperate one, and no issues where there, the FPS was 60 and CPU usage on visual was around 45%
[/quote]

Like a server? or do you mean you processed logic on one core and rendering data on another? If the later, then you're doing your threading wrong. You shouldn't be splitting your subsystems into separate threads, but instead splitting your tasks up into separate threads.


2. Now due to some considerations, merged the game logic and visual rendering together
[/quote]

What's the problem there?


3. Now when running the entire thing together, the car drives a bit jerky , appearing as if the visual is getting stuck occasionally in between, the FPS is still around 60.
[/quote]

If you're still getting ~60fps, you're probably looking the wrong place. I doubt the jittering is performance based, but rather code based.
[ dev journal ]
[ current projects' videos ]
[ Zolo Project ]
I'm not mean, I just like to get to the point.

Firstly more explanation is required on my part
Yes, absolutely. I have a very clear idea of what might be going on but if you don't mind I'd like you to elaborate on the following.
  1. How did you sync'd the threads? How many buffers? How many locks? Are you creating the data from scratch each time? Using atomics? Critical Sections? Events?
  2. Describe your workload. How many batches? How many vertices per batch? Are the shaders "complex" or "simple"?
This is just to have a bigger picture of what's going on.

Previously "Krohm"

This topic is closed to new replies.

Advertisement