• Advertisement

Archived

This topic is now archived and is closed to further replies.

Is your game "slightly" jerky, jumpy, or shaky? Here's a fix!

This topic is 5135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
Try running something like SmartAlec Game Accelerator before your app. This can be made to stop all unimportant (to the system) tasks, defrag memory etc. Give you a clean canvas to test on each time.

Share this post


Link to post
Share on other sites
Advertisement
I''ll give it a try...

I''m almost positive the lag comes from rare occurances of starvation during the rendering of the meshes in the scene.

It has nothing to do with not using floats instead of ints...
I know that my timing is fine...

The lag comes between the point I make the call to draw my meshes and the time they are presented to the screen.

About once every 20 frames, roughly, it takes 40 ms to render them... yet with 1 upgrade to the priority this 40 ms delay NEVER happens.

This appears as starvation in the processing queue to me.

By the way, if somebody is running your game... When your game has the focus the priority should be higher than average, in my opinion. It is not a difficult thing to downgrade your priority when the user ALT-TABS out of your game. Might even be able to go to IDLE priority when they do that... thus really freeing up processing for the other apps.

Game Has Focus -> Above Average Priority
Game Loses Focus -> Idle Priority (Only uses processor when it is idle)
Game Gains Focus again -> Above Average Priority

Is this a bad idea? I don''t think so. (IMO)

I''m curious... is changing the priority kind of like using goto''s for some of you guys? That''s what I''m starting to get the feeling... Some people are 100% against goto''s no matter what you say to them, even though there are clearly situations in which they are the most efficient & readable means of doing a task.

Share this post


Link to post
Share on other sites
For the people concerned about my code... Here's the normal render times for my meshes... I'm making these numbers up, but you can get the gist... when I debugged the render times this is what showed up. Also pasted below are the high priority times.

milliseconds to render meshes
5
5
5
5
5
5
5
5
40
5
5
5
5
5
5
5
40
5
5


HIGH PRIRORITY TIMES
milliseconds to render meshes
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5


40's are gone... By some of the logic I've seen in this post.... the 40's SHOULD be reduced to maybe 20 or 30 if there was "a different problem in my code". Why are the 40's reduced to 5's? I believe it is because the program is not being stuck in the back of the processing queue.

Sorry if this isn't clear... I'm just trying to point out why I think it is starvation (getting stuck behind other processes in the process scheudling queue(s)).


[edited by - oxygen_728 on March 30, 2004 2:58:21 PM]

Share this post


Link to post
Share on other sites
No clue, perhaps one of the 44 processes running at any given time on my system? I have 10 programs that run everytime I startup... and I know many "end users" have the same type of setup. The rest are windows processes.

Perhaps you can see how, on a system like mine, it may be a good idea to consider putting the priority of your game over those of most of the 40 processes already running. It''s not a good thing when your program gets stuck behind 40 processes when it is trying to render!

By the way, HIGH_PRIORITY_CLASS preempts IDLE and NORMAL priority processes. The OS critical processes still have a higher priority.

If you want to overwrite those (you may be crazy), you can use the REALTIME_PRIORITY_CLASS.

I''m starting to like the idea of High Priority when it has the focus, and idle priority when it doesn''t... though you would need to code the game to handle zero framerate for possibly long periods of time.


Share this post


Link to post
Share on other sites
I don't think anyone is saying "never tamper with the priority". We are simply encouraging you to take a harder look at your own program rather than blaming everything on windows. Furthermore, you posted this here as if it was a quick fix to everyone's problems, which is hardly encouraging good coding practice. Perhaps you could explain your rendering method or post some code? Maybe someone could offer optimization tips, or maybe there is something you are doing in your code that is causing a slow-down. I don't doubt that you havn't looked into this issue, but maybe others can help. In my experience, people on these forums always have tips on how you can optimize your algorithms.

[edited by - Fuzztrek on March 30, 2004 3:23:48 PM]

Share this post


Link to post
Share on other sites
Once process I noticed which causes heartbeat-like framerate glitches is the Windows Task Manager. Maybe try closing that?

xyzzy

Share this post


Link to post
Share on other sites
AFAIR I had some troubles with background music while my engine was running with higher priority. Besides, changing process priority may cause system instability and other troubles. I suppose better optimizing drawing routines rather than playing with CPU cycles and processes.

Share this post


Link to post
Share on other sites
I don''t see what''s wrong with setting above average priority in a full-screen app.
You could make it a user option, if they want to compile their quake 5 engine in the background then let them pick the low priority version of your game...
Really, if you are playing a game you more or less forget about the Windows that is still lurking in the background.
High priority is probably not a good idea however because if something goes wrong you''ll probably have to hit the reset button

Share this post


Link to post
Share on other sites
I apologize for wording my original post as a "fix all" method...

If you''d view my numbers a few posts above, you''d see that rendering optimizations won''t make a difference. (I have 44 processes at any given time)

I thank you all for your input, and I think I''ll be leaning towards ABOVE_AVERAGE priority when the focus is on the game and IDLE or AVERAGE priority when it is not.

Thanks for your input

Share this post


Link to post
Share on other sites

  • Advertisement