diff --git a/ryzom/server/src/gpm_service/client_messages.cpp b/ryzom/server/src/gpm_service/client_messages.cpp index 8ddd9147c..8288af508 100644 --- a/ryzom/server/src/gpm_service/client_messages.cpp +++ b/ryzom/server/src/gpm_service/client_messages.cpp @@ -103,7 +103,7 @@ void cbClientPosition( CMessage& msgin, const string &serviceName, NLNET::TServi CMirrorPropValue1DS( TheDataset, entityIndex, DSPropertyPOSY )= y; CMirrorPropValue1DS( TheDataset, entityIndex, DSPropertyPOSZ )= (z&~7) + (local ? 1 : 0) + (interior ? 2 : 0) + (water ? 4 : 0); CMirrorPropValue1DS( TheDataset, entityIndex, DSPropertyORIENTATION )= heading; - CMirrorPropValue1DS( TheDataset, entityIndex, DSPropertyTICK_POS )= clientTick; + CMirrorPropValue1DS( TheDataset, entityIndex, DSPropertyTICK_POS )= clientTick + GPMS_LCT_TICKS; CMirrorPropValue1DS cell ( TheDataset, entityIndex, DSPropertyCELL ); uint32 cx = (uint16) ( + x/CWorldPositionManager::getCellSize() ); diff --git a/ryzom/server/src/gpm_service/world_position_manager.cpp b/ryzom/server/src/gpm_service/world_position_manager.cpp index 87a8f2e77..60cbca119 100644 --- a/ryzom/server/src/gpm_service/world_position_manager.cpp +++ b/ryzom/server/src/gpm_service/world_position_manager.cpp @@ -2155,7 +2155,8 @@ void CWorldPositionManager::movePlayer(CWorldEntity *entity, sint32 x, sint32 y, } // check position received is not older than last received - if (entity->Tick > tick && !forceTick) + NLMISC::TGameCycle lastTick = (entity->Tick() - GPMS_LCT_TICKS); + if (lastTick >= tick && !forceTick) { if (Verbose) nlwarning("CWorldPositionManager::movePlayer%s: received a position older (t=%d) than previous (t=%d)", entity->Id.toString().c_str(), tick, entity->Tick.getValue()); @@ -2180,7 +2181,11 @@ void CWorldPositionManager::movePlayer(CWorldEntity *entity, sint32 x, sint32 y, CVectorD targetPos = CVectorD(x*0.001, y*0.001, z*0.001); CVectorD finalPos; - NLMISC::TGameCycle ticksSinceLastUpdate = tick - entity->Tick(); + NLMISC::TGameCycle ticksSinceLastUpdate = tick - lastTick; + + // limit interval to 1s + if (ticksSinceLastUpdate > GPMS_LCT_TICKS) + ticksSinceLastUpdate = GPMS_LCT_TICKS; // Get master (player) entity (in case of a mount) CWorldEntity *master = entity; @@ -2285,14 +2290,14 @@ void CWorldPositionManager::movePlayer(CWorldEntity *entity, sint32 x, sint32 y, targetPos = finalPos; // Update entity coordinates directly in mirror - entity->updatePosition((sint32)(finalPos.x * 1000), (sint32)(finalPos.y * 1000), (sint32)(finalPos.z * 1000), theta, tick, interior, water); + entity->updatePosition((sint32)(finalPos.x * 1000), (sint32)(finalPos.y * 1000), (sint32)(finalPos.z * 1000), theta, tick + GPMS_LCT_TICKS, interior, water); } else { nlwarning("CWorldPositionManager::movePlayer(%s): entity has no NLPACS::MovePrimitive, motion cannot be checked!", entity->Id.toString().c_str(), tick, entity->Tick.getValue()); // Update entity coordinates directly in mirror - entity->updatePosition(x, y, z, theta, tick, interior, water); + entity->updatePosition(x, y, z, theta, tick + GPMS_LCT_TICKS, interior, water); } // and update entity links (and children) in cell map diff --git a/ryzom/server/src/gpm_service/world_position_manager.h b/ryzom/server/src/gpm_service/world_position_manager.h index 1a5c48706..c6384d5c1 100644 --- a/ryzom/server/src/gpm_service/world_position_manager.h +++ b/ryzom/server/src/gpm_service/world_position_manager.h @@ -56,7 +56,7 @@ class CWorldPositionManager; class ConstIteratorType; - +#define GPMS_LCT_TICKS (10)