Make the number of state updated the server sends configurable.

This commit is contained in:
hiker 2017-11-24 18:33:26 +11:00
parent 37ee602f28
commit b08e2f56e1
4 changed files with 9 additions and 20 deletions

View File

@ -158,16 +158,10 @@
away if there is an explosion. -->
<explosion impulse-objects="500.0" />
<!-- Networking - the current networking code is outdated and will not
work anymore - so for now don't enable this.
For the new networking code:
combine-threshold: Maximum time a network event can be different
from an existing time step info to be combined into one. This
reduces the number of time steps necessary (for slightly larger
inaccuracies).
<!-- Networking
state-frequency: how many states the server will send per second.
-->
<networking enable="false"
combine-threshold="0.05" />
<networking state-frequency="10" />
<!-- The field od views for 1-4 player split screen. fov-3 is
actually not used (since 3 player split screen uses the

View File

@ -138,8 +138,8 @@ void STKConfig::load(const std::string &filename)
CHECK_NEG(m_replay_delta_pos2, "replay delta-position" );
CHECK_NEG(m_replay_dt, "replay delta-t" );
CHECK_NEG(m_smooth_angle_limit, "physics smooth-angle-limit" );
CHECK_NEG(m_network_combine_threshold, "network combine-threshold" );
CHECK_NEG(m_default_track_friction, "physics default-track-friction");
CHECK_NEG(m_network_state_frequeny, "network state-frequency");
CHECK_NEG(m_default_moveable_friction, "physics default-moveable-friction");
// Square distance to make distance checks cheaper (no sqrt)
@ -174,9 +174,8 @@ void STKConfig::init_defaults()
m_replay_delta_angle = -100;
m_replay_delta_pos2 = -100;
m_replay_dt = -100;
m_network_combine_threshold = -100;
m_network_state_frequeny = -100;
m_title_music = NULL;
m_enable_networking = true;
m_smooth_normals = false;
m_same_powerup_mode = POWERUP_MODE_ONLY_IF_SAME;
m_ai_acceleration = 1.0f;
@ -351,8 +350,7 @@ void STKConfig::getAllData(const XMLNode * root)
if (const XMLNode *networking_node = root->getNode("networking"))
{
networking_node->get("enable", &m_enable_networking);
networking_node->get("combine-threshold", &m_network_combine_threshold);
networking_node->get("state-frequency", &m_network_state_frequeny);
}
if(const XMLNode *replay_node = root->getNode("replay"))

View File

@ -82,10 +82,8 @@ public:
bool m_smooth_normals; /**< If normals for raycasts for wheels
should be interpolated. */
/** Network events that are less than this value apart will be executed
* at the same time (instead of adding a new time step, which causes
* one more time step to be simulated). */
float m_network_combine_threshold;
/** How many state updates per second the server will send. */
int m_network_state_frequeny;
/** 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
@ -110,7 +108,6 @@ public:
m_max_track_version; /**<version supported by this binary. */
int m_max_display_news; /**<How often a news message is displayed
before it is ignored. */
bool m_enable_networking;
/** Disable steering if skidding is stopped. This can help in making
* skidding more controllable (since otherwise when trying to steer while

View File

@ -77,7 +77,7 @@ void RewindManager::reset()
m_is_rewinding = false;
m_not_rewound_time = 0;
m_overall_state_size = 0;
m_state_frequency = 0.1f; // save 10 states a second
m_state_frequency = 1.0f / stk_config->m_network_state_frequeny;
m_last_saved_state = -9999.9f; // forces initial state save
if(!m_enable_rewind_manager) return;