954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Only using as much processor as needed

Hi there
I have made and run several different graphics programs and applications. The applications I have made so far always use the full processor and graphics card available. The game for instance may run at 5000fps or some really high number.

I am assuming this is not how games and graphics applications run in the real world.

how do specify what speed or resources to allocate to a specific task?

I have done things such as time based movement and looked at framelocking, but this still tends to use about 100% resources when its not truly required.

Thanks for the help and ideas

eskimo456
Junior Poster in Training
54 posts since Dec 2010
Reputation Points: 10
Solved Threads: 2
 

I guess the reason that framelocking would still consume 100% of the available processor cycles is the engine might only draw a frame after a defined time has passed, but still update as fast as possible in the background.

You could apply a similar methodology to the call to your update function. Say you wanted to update your scene at 120fps; inside your main game loop, check if 1/120.f seconds have passed since last update. If not, instruct your process to sleep for a short amount of time (1ms should be fine), then continue the loop. Implementation of this will vary depending on the system you are using.

PsychoLogic
Newbie Poster
15 posts since Aug 2010
Reputation Points: 11
Solved Threads: 4
 

Awesome that makes perfect sense thanks a lot I'll try implementing and see how much processor and GPU is used. Can't see the point of using 100% GPU for a 2D game.

Thanks

eskimo456
Junior Poster in Training
54 posts since Dec 2010
Reputation Points: 10
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: