Re-add lag compensation time from client to tick value in mirror

ryzomclassic-develop
kaetemi 3 years ago
parent 4407fc2970
commit 92bfb0aafb
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -103,7 +103,7 @@ void cbClientPosition( CMessage& msgin, const string &serviceName, NLNET::TServi
CMirrorPropValue1DS<sint32>( TheDataset, entityIndex, DSPropertyPOSY )= y;
CMirrorPropValue1DS<sint32>( TheDataset, entityIndex, DSPropertyPOSZ )= (z&~7) + (local ? 1 : 0) + (interior ? 2 : 0) + (water ? 4 : 0);
CMirrorPropValue1DS<float>( TheDataset, entityIndex, DSPropertyORIENTATION )= heading;
CMirrorPropValue1DS<NLMISC::TGameCycle>( TheDataset, entityIndex, DSPropertyTICK_POS )= clientTick;
CMirrorPropValue1DS<NLMISC::TGameCycle>( TheDataset, entityIndex, DSPropertyTICK_POS )= clientTick + GPMS_LCT_TICKS;
CMirrorPropValue1DS<TYPE_CELL> cell ( TheDataset, entityIndex, DSPropertyCELL );
uint32 cx = (uint16) ( + x/CWorldPositionManager::getCellSize() );

@ -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

@ -56,7 +56,7 @@
class CWorldPositionManager;
class ConstIteratorType;
#define GPMS_LCT_TICKS (10)

Loading…
Cancel
Save