Consolidar GameplayAbilitySystem na main (baseline cliente tudo funcionando 2026-06-16) #6
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -222,13 +222,33 @@ void AZeusPlayerProxy::SetZeusIdentity(const int64 InEntityId, const EZeusEntity
|
|||||||
|
|
||||||
void AZeusPlayerProxy::ApplyEntitySnapshot(const FZeusEntitySnapshot& Snapshot)
|
void AZeusPlayerProxy::ApplyEntitySnapshot(const FZeusEntitySnapshot& Snapshot)
|
||||||
{
|
{
|
||||||
// Estabiliza o offset de relogio na primeira amostra. Subsequente nao
|
// 2026-06-06 H3 fix — disciplina o ServerClockOffsetMs via EMA com clamp.
|
||||||
// re-sincroniza para evitar saltos visuais; um esquema mais sofisticado
|
// Antes: offset congelado na 1a amostra. Em cross-server handoff a fonte
|
||||||
// (ema do offset) cabe quando tivermos ping/RTT estabilizado por sessao.
|
// do ServerTimeMs muda (publisher antigo -> novo) e o offset fica
|
||||||
|
// permanentemente skewed, alimentando tremor pos-handoff e drift cumulativo
|
||||||
|
// de clock cliente vs server. Agora cada amostra recalcula candidato e
|
||||||
|
// suaviza (alpha=0.02, ~50 amostras pra convergir) com clamp max 2ms/snapshot
|
||||||
|
// pra evitar salto visual durante transicao.
|
||||||
|
const int64 LocalNowMs = static_cast<int64>(FPlatformTime::Seconds() * 1000.0);
|
||||||
|
const int64 OffsetCandidate = LocalNowMs - Snapshot.ServerTimeMs;
|
||||||
if (SnapshotBuffer.Num() == 0)
|
if (SnapshotBuffer.Num() == 0)
|
||||||
{
|
{
|
||||||
const int64 LocalNowMs = static_cast<int64>(FPlatformTime::Seconds() * 1000.0);
|
// Primeira amostra: bootstrap direto (nao tem baseline pra suavizar).
|
||||||
ServerClockOffsetMs = LocalNowMs - Snapshot.ServerTimeMs;
|
ServerClockOffsetMs = OffsetCandidate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const double Alpha = 0.02;
|
||||||
|
const int64 RawTarget = static_cast<int64>(
|
||||||
|
static_cast<double>(ServerClockOffsetMs) * (1.0 - Alpha)
|
||||||
|
+ static_cast<double>(OffsetCandidate) * Alpha);
|
||||||
|
// Clamp max 2ms por amostra — em 30Hz isso converge a 60ms/s, mais que
|
||||||
|
// o suficiente pra absorver drift normal sem causar tremor visual.
|
||||||
|
const int64 Delta = RawTarget - ServerClockOffsetMs;
|
||||||
|
const int64 ClampedDelta = (Delta > 2) ? 2
|
||||||
|
: (Delta < -2) ? -2
|
||||||
|
: Delta;
|
||||||
|
ServerClockOffsetMs += ClampedDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
FZeusProxySnapshot S;
|
FZeusProxySnapshot S;
|
||||||
|
|||||||
Reference in New Issue
Block a user