Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Help in reducing FPS ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 duskndreamz   Members   -  Reputation: 141

Like
-1Likes
Like

Posted 20 May 2011 - 01:32 AM

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

Sponsor:

#2 wildboar   Members   -  Reputation: 281

Like
0Likes
Like

Posted 20 May 2011 - 02:07 AM

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.

#3 Krohm   Crossbones+   -  Reputation: 3171

Like
0Likes
Like

Posted 20 May 2011 - 02:09 AM

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.

#4 marius1930   Members   -  Reputation: 119

Like
0Likes
Like

Posted 20 May 2011 - 05:19 AM

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.

#5 Krohm   Crossbones+   -  Reputation: 3171

Like
0Likes
Like

Posted 20 May 2011 - 06:42 AM

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.

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.

#6 freeworld   Members   -  Reputation: 325

Like
0Likes
Like

Posted 20 May 2011 - 02:13 PM

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.

#7 duskndreamz   Members   -  Reputation: 141

Like
-1Likes
Like

Posted 21 May 2011 - 01:31 AM

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.

#8 freeworld   Members   -  Reputation: 325

Like
0Likes
Like

Posted 21 May 2011 - 09:31 PM

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%


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


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.


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.

#9 Krohm   Crossbones+   -  Reputation: 3171

Like
0Likes
Like

Posted 23 May 2011 - 01:09 AM

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.
  • 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"?
This is just to have a bigger picture of what's going on.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS