I think these "lag" issues and the stuttering we see, are related.
I changed the code to what you see below. Don't critique my coding skillz, I already know they're sh!t. I have it this way because I was toggling on and off different values to test the response on each axis. If this is of any help in discovering the true cause, great, if not, it still seems like a suitable workaround.
Note: I changed the slew back to the original MS formula before Imago & madpeople modified it. I hard coded the ships turn rate to be 60 degrees per second which would be used to calculate how much to slow your turning IF you were zoomed in from your cockpit (which you NEVER EVER do anyway)... so hard coding that value won't affect anyone and eliminates that fetch routine which is causing trouble for everyone. Lastly, I have each axis updating at this point (whether it is being slewed or not) = lag eliminated. I'm not certain if this fixes the turret lag but I put a JS update here for when you are in a turret. That will need to be tested while online. If anyone wants to clean this code up properly, please do so, I know it's a mess.
If anyone wants to see what I've been crying about all of these years, here is the current version of alleg (as posted on Kage's github) with this "lag fix" added. Even you mouse users will see the difference. I suggest you turn your mouse sensitivity back to 100% within the game (ESC G Q).
Code: Select all
if (m_cm == cmCockpit)
{
if (trekClient.GetShip()->GetTurretID() != NA)
{
float fov = (s_fMinFOV + 0.5f * (s_fMaxFOV - s_fMinFOV)) +
(0.5f * (s_fMaxFOV - s_fMinFOV)) * js.controls.jsValues[c_axisThrottle];
m_cameraControl.SetFOV(fov);
{
if (1 > 0)
js.controls.jsValues[c_axisPitch] *= 1.0f;
}
{
if (1 > 0)
js.controls.jsValues[c_axisYaw] *= 1.0f;
}
{
if (1 > 0)
js.controls.jsValues[c_axisRoll] *= 1.0f;
}
{
if (1 > 0)
js.controls.jsValues[c_axisThrottle] *= 1.0f;
}
}
else
{
float fov = m_cameraControl.GetFOV();
if (m_ptrekInput->IsTrekKeyDown(TK_ZoomIn, true))
{
fov -= dt;
if (fov < s_fMinFOV)
fov = s_fMinFOV;
m_cameraControl.SetFOV(fov);
}
else if (m_ptrekInput->IsTrekKeyDown(TK_ZoomOut, true))
{
fov += dt;
if (fov > s_fMaxFOV)
fov = s_fMaxFOV;
m_cameraControl.SetFOV(fov);
}
if (trekClient.GetShip()->GetBaseHullType() != NULL)
{
//What is the maximum desired rate of turn for this field of view?
//Use the same calculation as for turrets.
//Keep in sync with wintrek.cpp's FOV by throttle
static const float c_minRate = RadiansFromDegrees(7.5f);
static const float c_maxRate = RadiansFromDegrees(75.0f);
float maxSlewRate = c_minRate + (c_maxRate - c_minRate) * fov / s_fMaxFOV;
{
float pitch = RadiansFromDegrees(60);
if (pitch > maxSlewRate)
js.controls.jsValues[c_axisPitch] *= maxSlewRate / pitch;
else
js.controls.jsValues[c_axisPitch] *= 1.0f;
}
{
float yaw = RadiansFromDegrees(60);
if (yaw > maxSlewRate)
js.controls.jsValues[c_axisYaw] *= maxSlewRate / yaw;
else
js.controls.jsValues[c_axisYaw] *= 1.0f;
}
{
if (1 > 0)
js.controls.jsValues[c_axisRoll] *= 1.0f;
}
{
if (1 > 0)
js.controls.jsValues[c_axisThrottle] *= 1.0f;
}
}
}
}


