diff --git a/MUNGA/ENTITY.cpp b/MUNGA/ENTITY.cpp index af7c005..6ce16ec 100644 --- a/MUNGA/ENTITY.cpp +++ b/MUNGA/ENTITY.cpp @@ -435,6 +435,61 @@ void //----------------------- // UpdateRecord *update = (UpdateRecord*)record; + + // + // RP412CAMLOG: how hard does an arriving update MOVE this + // entity, and how often? + // + // Between updates a replicant is dead-reckoned from + // updateOrigin over (lastPerformance - lastUpdate). When the + // next one lands the basis is replaced, so the drawn position + // jumps by however far the prediction had drifted. Render + // interpolation cannot hide that: it smooths within a step, + // and this is a discontinuity in the stepped values + // themselves. If the interval is a few per second and the + // correction is tens of centimetres, that is a tick a few + // times a second - which is the symptom being chased. + // + // Reported per entity, on a five second clock, so a busy race + // does not bury the log. + // + if (RPCameraLog() && GetInstance() == ReplicantInstance) + { + static Scalar next_say = 0.0f; + static int corrections = 0; + static Scalar worst = 0.0f; + static Scalar total = 0.0f; + + Vector3D drift; + drift.Subtract( + update->localOrigin.linearPosition, + localOrigin.linearPosition + ); + Scalar distance = drift.Length(); + ++corrections; + total += distance; + if (distance > worst) + { + worst = distance; + } + + if ((Scalar) Now() >= next_say) + { + if (next_say > 0.0f && corrections > 0) + { + DEBUG_STREAM << "CamLog: replicant corrections - " + << corrections << " in 5s (" + << (corrections / 5) << "/s), mean " + << (total / corrections) << "m, worst " + << worst << "m\n" << std::flush; + } + next_say = ((Scalar) Now()) + 5.0f; + corrections = 0; + worst = 0.0f; + total = 0.0f; + } + } + updateOrigin = update->localOrigin; //