|
This thread is locked; no one can reply to it. |
1
2
|
My game runs faster in Windows |
James Stanley
Member #7,275
May 2006
|
I have timers (they don't seem to do anything), and I just compiled my game in Windows and it runs way too fast. Changing the speed of the timer doesn't seem to do anything in Linux and I haven't tried on Windows. Any ideas? EDIT: |
jamal
Member #3,326
March 2003
|
Quote: Changing the speed of the timer doesn't seem to do anything in Linux and I haven't tried on Windows. it should. Can you post your code ? |
Steve Terry
Member #1,989
March 2002
|
Some friggin code or something please? ___________________________________ |
James Stanley
Member #7,275
May 2006
|
I just did a little more testing, and it seems that changing the timer speed does affect it after a point. volatile int counter = 0; LOCK_VARIABLE(counter); LOCK_FUNCTION(timer); install_int_ex(timer, MSEC_TO_TIMER(1)); while(1) { if(counter >= 1) { //Main loop } //Drawing }
EDIT: |
jamal
Member #3,326
March 2003
|
volatile int counter = 0; LOCK_VARIABLE(counter); LOCK_FUNCTION(timer); install_int_ex(timer, MSEC_TO_TIMER(1)); while(1) { while(counter >= 1) { counter--; //Main loop } //Drawing }
|
James Stanley
Member #7,275
May 2006
|
Forgot to mention, there is already a counter = 0 in the main loop. Sorry. EDIT: EDIT2: |
Steve Terry
Member #1,989
March 2002
|
You should have it as a while loop. Never set it to 0 manually or you will effectively bipass the timer. ___________________________________ |
James Stanley
Member #7,275
May 2006
|
What? How would that bypass the timer? |
gnolam
Member #2,030
March 2002
|
Quote: Forgot to mention, there is already a counter = 0 in the main loop. Sorry. How about you post all relevant code then? -- |
Kris Asick
Member #1,424
July 2001
|
It almost looks as though your counter is based on 1 ms increments. That alone could be the source of your problems. Running your game at an internal framerate of 1000 FPS is going to cause speed variations you never considered. I'm also going to assume you are running a fixed time engine instead of a real time engine. In that case, the speed difference you are experiencing has to do with one of your computers/OSes being less able to keep up with a 1 ms timer than the other. Instead of MSEC_TO_TIMER(1) try BPS_TO_TIMER(30) to do a 30 ticks per second timer, and then alter all your code to move at that rate. That should take care of your speed issues. (Provided both computers/OSes you are running this game on can handle 30 ticks per second of your game.) --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
James Stanley
Member #7,275
May 2006
|
Gnolam, seeing as it worked on one computer, I assumed that was all the relevant code Kris, thanks. I'll try that. EDIT: |
BAF
Member #2,981
December 2002
|
I usually run 60 hz timer logic myself. |
gnolam
Member #2,030
March 2002
|
Quote: Gnolam, seeing as it worked on one computer, I assumed that was all the relevant code
Kris: 30 FPS is way too little. -- |
Kris Asick
Member #1,424
July 2001
|
Quote: Kris: 30 FPS is way too little. But low enough to know if that was the problem or not upon implementing it! --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
piccolo
Member #3,163
January 2003
|
hey every one. should i put a timer on the server of my mmrpg? i have one on the client because i want the clients to run at the same speed. edit: should i dived to the networking from the logic so the networking can run as fast as it can? wow |
Hard Rock
Member #1,547
September 2001
|
Yes you definitely want the server using up all available resources so it is at no less then 100% cpu usage at all times. End Sarcasm Server is much more important then the client, as if someone decides to hack your client and your server doesn't follow logic speed, then they can use that to a pretty massive advantage. The client should be restricted as well, but the server is what synchronizes play between clients, not the other way around (this is in a client/server setup, p2p behaves differently). Secondly, though I'm sure a server might be able to take it, it's probably not in your best interest to have a server running as fast as it can when the cpu usage can be best used for other things (like resting, as cooling can be an issue in a tightly packed server environment). The same goes for network traffic for obvious reasons.(I hope). But now that I've said that, next time you may want to start a separate thread and not hijack someone else's. _________________________________________________ |
James Stanley
Member #7,275
May 2006
|
Thanks. The 30 BPS thing worked. I guess it was because one computer was fast enough to keep up but the other not. |
BAF
Member #2,981
December 2002
|
30 BPS will be too slow for you. I'd go for at least 60. |
James Stanley
Member #7,275
May 2006
|
The maximum it will run at on my computer is 35 (on the windows computers it is about 250), so I just use 30 and double the speeds so that it runs as if it is 60 |
X-G
Member #856
December 2000
|
Yes, who cares about those people who might have better computers than you and might want to run the game without stutter? Shame on them for even suggesting it! -- |
kentl
Member #2,905
November 2002
|
Could anyone explain to me why you need more frames than 30 per second? Seeing as motion pictures are typically shot at 25 frames per second and it's good enough for them. |
X-G
Member #856
December 2000
|
Because of the presence of motion blur, which mitigates the stuttering effect. Computer games generally don't simulate motion blur, which means you need much higher framerates to avoid choppiness. -- |
kentl
Member #2,905
November 2002
|
Are there any research for how high framerate you need that you know of? |
imaxcs
Member #4,036
November 2003
|
I read somewhere that 50fps is about the amount the eyes/brain can cope with. More is (in terms of visible aspects) unnecessary...
|
kentl
Member #2,905
November 2002
|
I've heard that less than 75Hz isn't good for the brain and can cause head aches and epilepsy attacks. When I worked as a system administrator I always set the update frequency to the highest possible. At the same time older PAL televisions only has 50Hz. |
|
1
2
|