Game Development Community

Strange TGE animation stutter issue

by Rubes · in Torque Game Engine · 02/02/2009 (9:45 am) · 0 replies

I'm experiencing a strange issue with stuttering, and I'm hoping someone here could offer some insight.

I work on three different platforms with my modified TGE 1.5.2 engine: a dekstop G5 Mac running OS X, a Mac Intel laptop running OS X, and the same laptop running WinXP (under Bootcamp). All three run my game pretty well, with the laptop being a bit faster than the older desktop.

One thing I've noticed on the laptop, however, is that when I trigger a character (NPC) animation, there is a half-second engine pause that occurs between the trigger and the playing of the animation. So much so that it skips over the first few frames of the animation. It's like everything in the game stops for about a half second, then starts back up again. This looks bad.

The weird thing is that this only occurs on the laptop when I'm running OS X, not when I'm running WinXP. So the game seems to run differently with the same hardware configuration but under different operating systems. However, I also don't see this stuttering when I run the game on my (older) desktop, which also runs OS X.

A quick profile of the game right around the pause shows that "ServerNetProcess" is taking up most of the pause. Under normal conditions (in the absence of the stutter), ServerNetProcess takes up only a tiny fraction of the % time. But when the stutter occurs, it seems to get caught in this ServerNetProcess.

The other interesting thing about this is that the pause occurs only the first time each DSQ sequence is played. If I make the NPC repeat the same animation sequence, there is no pause on subsequent triggers.

A quick look at the engine code shows that the ServerNetProcess profile consists only of the following:

PROFILE_START(ServerNetProcess);
   // only send packets if a tick happened
   if(tickPass)
      GNet->processServer();
PROFILE_END();

...with of course everything that happens within processServer(). So the question is, why does the game get caught up so much in this process? And why would that only occur in one of the three system setups? And why only the first time an animation sequence is called?

Thanks!