Added option to reduce steering of remote karts automatically each frame.
This can help in case of high latency connections and quick steering changes: because of the high latency the steering is applied too long locally, reducing in the other kart driving left/right way too much. It's disabled for now (i.e. steering is multiplied by 1.0), but can be enabled in stk_config.
This commit is contained in:
parent
deb6d76504
commit
7cca534273
@ -180,8 +180,11 @@
|
||||
|
||||
<!-- Networking
|
||||
state-frequency: how many states the server will send per second.
|
||||
steering-reduction: Reduce a remote kart's steering by this factor
|
||||
each frame. This helps reduces oversteering by high latency
|
||||
clients when they only do minor steering adjustments.
|
||||
-->
|
||||
<networking state-frequency="10"/>
|
||||
<networking state-frequency="10" steering-reduction="1.0"/>
|
||||
|
||||
<!-- The field od views for 1-4 player split screen. fov-3 is
|
||||
actually not used (since 3 player split screen uses the
|
||||
|
@ -152,6 +152,7 @@ void STKConfig::load(const std::string &filename)
|
||||
CHECK_NEG(m_default_track_friction, "physics default-track-friction");
|
||||
CHECK_NEG(m_physics_fps, "physics fps" );
|
||||
CHECK_NEG(m_network_state_frequeny, "network state-frequency" );
|
||||
CHECK_NEG(m_network_steering_reduction,"network steering-reduction" );
|
||||
CHECK_NEG(m_default_moveable_friction, "physics default-moveable-friction");
|
||||
|
||||
// Square distance to make distance checks cheaper (no sqrt)
|
||||
@ -195,6 +196,7 @@ void STKConfig::init_defaults()
|
||||
m_donate_url = "";
|
||||
m_password_reset_url = "";
|
||||
m_network_state_frequeny = -100;
|
||||
m_network_steering_reduction = 1.0f;
|
||||
m_title_music = NULL;
|
||||
m_smooth_normals = false;
|
||||
m_same_powerup_mode = POWERUP_MODE_ONLY_IF_SAME;
|
||||
@ -391,6 +393,7 @@ void STKConfig::getAllData(const XMLNode * root)
|
||||
if (const XMLNode *networking_node = root->getNode("networking"))
|
||||
{
|
||||
networking_node->get("state-frequency", &m_network_state_frequeny);
|
||||
networking_node->get("steering-reduction", &m_network_steering_reduction);
|
||||
}
|
||||
|
||||
if(const XMLNode *replay_node = root->getNode("replay"))
|
||||
|
@ -89,6 +89,11 @@ public:
|
||||
/** How many state updates per second the server will send. */
|
||||
int m_network_state_frequeny;
|
||||
|
||||
/** In case of a network race, remote karts will get their steering somewhat
|
||||
* reduced each frame. This reduces stutter when a kart only does small
|
||||
* steering adjustments. */
|
||||
float m_network_steering_reduction;
|
||||
|
||||
/** If the angle between a normal on a vertex and the normal of the
|
||||
* triangle are more than this value, the physics will use the normal
|
||||
* of the triangle in smoothing normal. */
|
||||
|
@ -35,7 +35,8 @@ Controller::Controller(AbstractKart *kart)
|
||||
setControllerName("Controller");
|
||||
} // Controller
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
core::stringw Controller::getName() const
|
||||
{
|
||||
return translations->fribidize(m_kart->getName());
|
||||
}
|
||||
} // getName
|
||||
|
@ -42,6 +42,20 @@ public:
|
||||
return false;
|
||||
} // isLocal
|
||||
// ------------------------------------------------------------------------
|
||||
/** Update for network controller. For player with a high ping it is
|
||||
* useful to reduce shaking by reducing the steering somewhat in each
|
||||
* frame: If the player does a quick correction only, because of the high
|
||||
* latency the predicted path will curve way too much. By automatically
|
||||
* reducing it, this error is reduced. And even if the player steers more
|
||||
* the error is hopefully acceptable. */
|
||||
virtual void update(int ticks)
|
||||
{
|
||||
PlayerController::update(ticks);
|
||||
m_controls->setSteer( m_controls->getSteer()
|
||||
* stk_config->m_network_steering_reduction);
|
||||
} // update
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
}; // NetworkPlayerController
|
||||
|
||||
#endif // NETWORK_PLAYER_CONTROLLER_HPP
|
||||
|
Loading…
x
Reference in New Issue
Block a user