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

Recommended Answers

All 2 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.