Sign in to follow this  
duskndreamz

Help in reducing FPS ?

Recommended Posts

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..

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote name='Krohm' timestamp='1305878988' post='4813379']If it is below a certain threshold, call Sleep(1 ms). It should be enough.[/quote]
This would [b]decrease[/b] 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.

Share this post


Link to post
Share on other sites
[quote name='marius1930' timestamp='1305890351' post='4813420']
[quote name='Krohm' timestamp='1305878988' post='4813379']If it is below a certain threshold, call Sleep(1 ms). It should be enough.[/quote]
This would [b]decrease[/b] 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.

Share this post


Link to post
Share on other sites
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 [b]game[/b], 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.

Share this post


Link to post
Share on other sites
Hidden
Thanks for all the replies.

Firstly more explanation is required on my part

[b]My Situation:[/b]
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 )

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

[b]My Current Problem[/b]
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.

Share this post


Link to post
[quote name='freeworld' timestamp='1305922399' post='4813609']
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 [b]game[/b], 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.
[/quote]




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.

Share this post


Link to post
Share on other sites
[quote]
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.

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

What's the problem there?

[quote]
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.

Share this post


Link to post
Share on other sites
[quote name='duskndreamz' timestamp='1305963087' post='4813783']
Firstly more explanation is required on my part[/quote]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.
[list=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?[*]Describe your workload. How many batches? How many vertices per batch? Are the shaders "complex" or "simple"?[/list]This is just to have a bigger picture of what's going on.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this