forked from Mirrorlandia_minetest/minetest
Avoid movement jitter (#13093)
This allows the client and server to agree on the position of objects and attached players even when there is lag.
This commit is contained in:
parent
55fafb7d25
commit
a98200bb4c
@ -393,8 +393,8 @@ void Client::connect(Address address, bool is_local_server)
|
||||
void Client::step(float dtime)
|
||||
{
|
||||
// Limit a bit
|
||||
if (dtime > 2.0)
|
||||
dtime = 2.0;
|
||||
if (dtime > DTIME_LIMIT)
|
||||
dtime = DTIME_LIMIT;
|
||||
|
||||
m_animation_time += dtime;
|
||||
if(m_animation_time > 60.0)
|
||||
|
@ -241,13 +241,13 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
||||
/*
|
||||
Calculate new velocity
|
||||
*/
|
||||
if (dtime > 0.5f) {
|
||||
if (dtime > DTIME_LIMIT) {
|
||||
if (!time_notification_done) {
|
||||
time_notification_done = true;
|
||||
infostream << "collisionMoveSimple: maximum step interval exceeded,"
|
||||
warningstream << "collisionMoveSimple: maximum step interval exceeded,"
|
||||
" lost movement details!"<<std::endl;
|
||||
}
|
||||
dtime = 0.5f;
|
||||
dtime = DTIME_LIMIT;
|
||||
} else {
|
||||
time_notification_done = false;
|
||||
}
|
||||
|
@ -56,6 +56,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
// Override for the previous one when distance of block is very low
|
||||
#define BLOCK_SEND_DISABLE_LIMITS_MAX_D 1
|
||||
|
||||
/*
|
||||
Client/Server
|
||||
*/
|
||||
|
||||
// Limit maximum dtime in client/server step(...) and for collision detection
|
||||
#define DTIME_LIMIT 2.5f
|
||||
|
||||
/*
|
||||
Map-related things
|
||||
*/
|
||||
|
@ -577,8 +577,8 @@ void Server::stop()
|
||||
void Server::step(float dtime)
|
||||
{
|
||||
// Limit a bit
|
||||
if (dtime > 2.0)
|
||||
dtime = 2.0;
|
||||
if (dtime > DTIME_LIMIT)
|
||||
dtime = DTIME_LIMIT;
|
||||
{
|
||||
MutexAutoLock lock(m_step_dtime_mutex);
|
||||
m_step_dtime += dtime;
|
||||
|
Loading…
Reference in New Issue
Block a user