Windows Vs. My Game

Started by
26 comments, last by Andre Luiz Silva 24 years ago
While I''m running my 2D game, sometimes Windows start doing some background jobs, writing to/reading from the hard disk, and while Windows is on it my frame rate drops or even worse - my game stops for some milliseconds and then returns back to normal. Is there a way to stop or minimize it? I think so, because when I play commercial games (Unreal, for example) I''ve never noticed something like that. Thanks, André Luiz Silva "There is no knowledge that is not power"
"- To begin with, said the Cat, a dog's not mad. You grant that? - I suppose so, said Alice. - Well, then, - the Cat went on - you see, a dog growls when it's angry, and wags its tail when it's pleased. Now I growl when I'm pleased, and wag my tail when I'm angry. Therefore I'm mad."
Advertisement
I don''t know how to do it in code, but to stop Windows from randomly screwing around with the cache, set your cache minimum and maximum both to 2.5 times the amount of RAM you have. It''s in the System dialog somewhere. That should stop it from resizing.


Lack

Christianity, Creation, metric, Dvorak, and BeOS for all!
Lack
Christianity, Creation, metric, Dvorak, and BeOS for all!
Perhaps you are accidently allocation and/or deallocation a lot of memory and windows needs to resize the swapfile often...
you can set the virtual memory to a given size like LackOfKnack said. press [Windows-key]-[Pause] and click on the most right tab.
Could also be a network problem -- my PC drops to half frame rate in fullscreen mode when someone''s using my printer.


- null_pointer
Sabre Multimedia
You could call SetPriorityClass (at least I think thats the call). I personally dont advocate using it though, as Windows programs should share resources (even at the detriment of performance).

If you do chose to use it, a word of advice: don''t use the realtime priority class unless you think it''s neccasary to halt up OS tasks!

--TheGoop
I''m a big supporter of using SetPriorityClass and SetPriorityThread. In my game, I''m doing absolutely no memory allocation or disk access during a level, yet Window''s would butt in every so often and I''d lose 1 to 10+ frames. I can''t see any other way of keeping Window''s in line, and lets face it, the user shouldn''t really be running background stuff when playing games. Just make sure you set the priority low when they alt-tab out of the game, or use some other way to do nothing until the game is restored.

Rock
First of all - thank you all...

LackOfKnack/Ridcully: if I choose to change my virtual memory settings, I would have to recommend it to everyone who wants to play my game. And I am using about 2 MB of memory to store artwork, what give about 14 MB''s of video avaiable video memory.

nullpointer: I understand what you said, but that''s not the case

TheGoop/Rock2000: I will try to use it. And I agree with Rock2000 about playing and running background stuff.

If you have any other suggestions, please let me know...

Thank you all


André Luiz Silva
"There is no knowledge that is not power"
"- To begin with, said the Cat, a dog's not mad. You grant that? - I suppose so, said Alice. - Well, then, - the Cat went on - you see, a dog growls when it's angry, and wags its tail when it's pleased. Now I growl when I'm pleased, and wag my tail when I'm angry. Therefore I'm mad."
Never change your priority to Real-Time, or anything from the default. This is only for drivers, not applications.

Read msn''s rant in the mail bag or whatever section it is for more information on that.

-Dan Smith
dans@3dgamedev.com
D. Smith
What''s a good class-priority setting, if not using real-time?
I''m doing:

HANDLE hProcess, hThread;

hProcess = GetCurrentProcess();
hThread = GetCurrentThread();

SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS);
SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST);


And it magically removes all my on-screen jitters.
I''m not looking for a flame war or anything, so I''ll keep this brief.

Dont set your priority. Your doing something wrong if you have to set the priority like that. You will run into problems doing it later on, you may not on your system - but you will eventually.

Bottom line is, dont do it. Pretend you never heard of the API call for that.

-Dan Smith
dans@3dgamedev.com
D. Smith

This topic is closed to new replies.

Advertisement