Player jitters when running client/dedicated server in 1.4
by CdnGater · in Torque Game Engine · 11/30/2005 (10:18 am) · 17 replies
I have a problem that the player and Kork the NPC, jitters when running in client/dedicated server using TG 1.4, that is not evident in TGE 1.3.
After some investigation, I have found something odd with the timing.
In TGE 1.3 platform\winWindow.cc there is
Now in the same function in TGE 1.4 its defined as
ok, see the sgTimeManagerProcessInterval?? thats new to 1.4. So I track that guy down and find the following in platform.cc
The thing to note here is what the default is set to ZERO so if you dont know about this pref setting and leave it, it defaults to zero, which is not the same update rate as in the TGE 1.3 which is 2.
Lastly, I thought I would also check out where sgBackgroundProcessSleepTime is used. Again I found out the value that is passed at the same places in in TGE 1.3 is 100, where as shown above for 1.4, the default is 32.
So from what I have found, the defaults should be changed to match TGE 1.3 values, or you can change it in the pref file if you are aware that you needed to change it
I will do more testing when I get on my home system as thats where I see the jitters the most, but I have noticed an improvement on my current test.
The reason I think my home system shows the jitters more, is because it's a 3ghz where as the one I am on atm is 2ghz so the updating is even faster at home causing the jitters.
Edit: Misstyped a code block closing
After some investigation, I have found something odd with the timing.
In TGE 1.3 platform\winWindow.cc there is
void TimeManager::process()
{
TimeEvent event;
event.elapsedTime = gTimer.getElapsedMS();
if(event.elapsedTime > 2)
{
gTimer.advance();
Game->postEvent(event);
}
}Now in the same function in TGE 1.4 its defined as
void TimeManager::process()
{
TimeEvent event;
event.elapsedTime = gTimer.getElapsedMS();
if(event.elapsedTime > sgTimeManagerProcessInterval)
{
gTimer.advance();
Game->postEvent(event);
}
}ok, see the sgTimeManagerProcessInterval?? thats new to 1.4. So I track that guy down and find the following in platform.cc
S32 sgBackgroundProcessSleepTime = 25;
S32 sgTimeManagerProcessInterval = 0;
void Platform::initConsole()
{
Con::addVariable("Pref::backgroundSleepTime", TypeS32, &sgBackgroundProcessSleepTime);
Con::addVariable("Pref::timeManagerProcessInterval", TypeS32, &sgTimeManagerProcessInterval);
}
S32 Platform::getBackgroundSleepTime()
{
return sgBackgroundProcessSleepTime;
}The thing to note here is what the default is set to ZERO so if you dont know about this pref setting and leave it, it defaults to zero, which is not the same update rate as in the TGE 1.3 which is 2.
Lastly, I thought I would also check out where sgBackgroundProcessSleepTime is used. Again I found out the value that is passed at the same places in in TGE 1.3 is 100, where as shown above for 1.4, the default is 32.
So from what I have found, the defaults should be changed to match TGE 1.3 values, or you can change it in the pref file if you are aware that you needed to change it
S32 sgBackgroundProcessSleepTime = 100; S32 sgTimeManagerProcessInterval = 2;
I will do more testing when I get on my home system as thats where I see the jitters the most, but I have noticed an improvement on my current test.
The reason I think my home system shows the jitters more, is because it's a 3ghz where as the one I am on atm is 2ghz so the updating is even faster at home causing the jitters.
Edit: Misstyped a code block closing
#2
11/30/2005 (4:57 pm)
There is a similar bug for our game, flyer, we have updated to 1.4. Basically, when the player DIES, he/she jitters... and sometimes the game crashes.
#3
11/30/2005 (5:25 pm)
I tried it for Flyer, but it didnt work. I think there might be something conflicting with merging my changes there.
#4
See here: Camera Jitters in Orbit mode
and here Orbit camera jitter problem & suggested fix
11/30/2005 (6:11 pm)
Actually, its not my merged code because I just found that the same thing happens in the stock 1.4 starter.fps. When you die, the camera changes to orbit mode and the player jitters.See here: Camera Jitters in Orbit mode
and here Orbit camera jitter problem & suggested fix
#5
03/06/2006 (2:13 pm)
I made the changes (S32 sgBackgroundProcessSleepTime = 100; S32 sgTimeManagerProcessInterval = 2;), but found it was still Jittering - this is with dedicated server and client on the same machine, maybe that is the problem?
#6
03/06/2006 (2:51 pm)
@Mr Meikel I think this whole time your problem is in running client and dedicated server on the same machine. I get the same issue when I try that as well. As for the sg Variables, I'm not 100% but I think those are for ease of integration for the TLK, nearly everything I have seen TLK related starts with sg.
#7
03/07/2006 (2:20 pm)
I set my S32 sgTimeManagerProcessInterval = 5 to remove all jitters, I was getting them even while it was set to 4. Does anyone else have the same problem? Can I expect problems on other machine speeds if it is at 5?
#8
03/08/2006 (12:08 am)
Hmm maybe i need to increase to 5 as well. I did some testing with the dedicated server on one machine (3ghz) and the client on another - still got the jitters. I'll have a play with this tonight, thanks for the help guys :)
#9
But in short, try disabling the performance counter and see what happens. I'd be really interested to know if this helps anyone else. I've run into problems with the high-resolution timer on other issues. Unfortunately, I don't have the bandwith to determine if my problem is local or global.
03/08/2006 (1:38 pm)
I looked at this thread when I was having problems with the dedicated server and ended up posting my conclusions in this thread: Client / Dedicated Server TGE 1.4. Hopefully I did the link right.But in short, try disabling the performance counter and see what happens. I'd be really interested to know if this helps anyone else. I've run into problems with the high-resolution timer on other issues. Unfortunately, I don't have the bandwith to determine if my problem is local or global.
#10
Disabling the performance counter worked like a dream on my test machines (athlon & p4). Dedicated server runs smoother then ever, however I would like to know the implications of disabling it (if any).
Thanks for posting your information.
03/08/2006 (2:20 pm)
James,Disabling the performance counter worked like a dream on my test machines (athlon & p4). Dedicated server runs smoother then ever, however I would like to know the implications of disabling it (if any).
Thanks for posting your information.
#11
03/08/2006 (3:47 pm)
I'll post the implications as I see them in the above mentioned thread...
#12
03/09/2006 (12:28 pm)
I also found that disabling the performance counter stopped any jittering I was having - even with client and dedicated server on the same machine (no HT, no dual core). Wow!
#13
FWIW, I used to see a similar issue in dRacer development, which is when I tracked the problem down to throwing out the remainder in WinTimer.
04/10/2007 (4:29 pm)
Anyone tracking this thread still? I believe this is related to a bug in the WinTimer wherein a remainder was being discarded. In our repo the fix was checked in 8/15/06, so should be in TGE 1.5 and later at the least. Do people still see this issue with post 1.5 TGE?FWIW, I used to see a similar issue in dRacer development, which is when I tracked the problem down to throwing out the remainder in WinTimer.
#14
04/10/2007 (4:44 pm)
I haven't seen this in a while. I decided to write it off as a VC6 issue after a number of similar issues were caused by it. I now use TGE 1.5 with Visual Studio 2005 and no longer seem to have a problem.
#15
04/10/2007 (4:48 pm)
I think TGEA qualifies as post 1.5 and I can not see it there.
#16
04/10/2007 (4:52 pm)
Well, I think the WinTimer fix in question was copied to TGEA by Brian before Matt copied it into TGE. :( But good to hear that the issue seems to be resolved, whether it was WinTimer related or not.
#17
04/10/2007 (4:56 pm)
Rest assured that if it comes back you'll hear from me. ;)
Torque Owner CdnGater
Duggan Software Studio
The Jitteries are gone.