Game stutters 4 times every 30 seconds
by Conor O Kane · in Torque Game Builder · 07/13/2007 (9:46 am) · 5 replies
I've just started a new project in TGB 1.5 to try out the new ticked physics. I've made a simple helicopter game where the player uses the analog joystick to fly a helicopter in 2D. There's just 1 background image and 1 helicopter image and nothing else, however the game stutters (pauses for about 200ms) 4 times in a row, every 30 seconds or so. It happens if I run the .exe for the game, or run from the editor.
It's as though there's some garbage collection or something going on in the background every 30 seconds that is killing the game.
Here's my onUpdate function for the player's helicopter:
am I doing anything stupid in this code? Am I using setimpulseforcepolar correctly or is there some way to use constant force to get the same degree of control?
Any help would be appreciated.
It's as though there's some garbage collection or something going on in the background every 30 seconds that is killing the game.
Here's my onUpdate function for the player's helicopter:
function playerHeli::onUpdate(%this)
{
%this.currentRotation = %this.getRotation();
%this.finalThrust = %this.currentThrust-(mAbs(mSin(mDegToRad(%this.currentRotation)))*%this.rotorTiltEffect); // add a little extra thrust when tilted, to keep altitude when accelerating
%this.setImpulseForcePolar(%this.currentRotation+180, %this.finalThrust, true);
%this.setLinearVelocityX(%this.getLinearVelocityX() * %this.windResistance); // slow down due to wind resistance
%this.cameraTarget.setPositionX(%this.getPositionX()+%this.cameraOffset); // scenewindow2D is mounted to this to follow the player
}am I doing anything stupid in this code? Am I using setimpulseforcepolar correctly or is there some way to use constant force to get the same degree of control?
Any help would be appreciated.
#2
07/13/2007 (10:53 am)
No, I've tried closing down my virus checker, and all other applications. Still stuttering 4 or 5 times every 30 seconds or so.
#3
07/13/2007 (11:06 am)
Are you seeing/hearing disc access, or is it all visual? I know these sound like weird questions, but it's a weird situation :)
#4
The game runs at 380 frames per second (according to fraps) and the fps counter drops down during the stuttering, although only to 300, but the pause is VERY noticeable. I'm also noticing that as the game starts there is a couple of seconds before the icon appears on the task bar, and during that time the player can fall outside of its world limits - as though callbacks are not working correctly during the first few seconds of execution.
07/13/2007 (9:14 pm)
Not hearing any disc access. I don't expect there'd by any disc access anyway, it's such a simple game, literally 2 images and 1 page of code. I'll try putting some sounds into the game to see if they stutter too.The game runs at 380 frames per second (according to fraps) and the fps counter drops down during the stuttering, although only to 300, but the pause is VERY noticeable. I'm also noticing that as the game starts there is a couple of seconds before the icon appears on the task bar, and during that time the player can fall outside of its world limits - as though callbacks are not working correctly during the first few seconds of execution.
#5
07/14/2007 (11:46 pm)
Problem solved - it was another program (firefox) which had crashed but was still running in the background and didn't show up in task manager.
Torque 3D Owner Stephen Zepp
Are you running a virus checker that scans files in the background?