Doors run on the mission clock instead of being replicated
A door's position was an integrated countdown owned by whichever machine the map-entity round-robin happened to deal it to. That left doors one one-way-latency behind on every other machine, re-acquired at each state change; drifting permanently on any frame hitch over a second, which the old code dropped outright rather than clamping; and frozen mid-cycle, collision volumes included, when their owning peer left, since ownership transfer is not implemented. Doors are clockwork with no inputs, and door/VTV physics is already local pointer access - VTV::ProcessCollision reads door->currentVelocity off the local object and the crush test is local VTV state - so a door does not need an owner at all. Door::SlideDoor is now a phase function of Application::GetMissionElapsed(), anchored so phase zero reproduces the original DefaultState entry: fully open, starting to close. Every host builds its own doorframe out of the map stream as a HermitInstance, the instance kind DynamicEntityCreation does not broadcast, so nothing is sent, nothing is received, and a peer leaving takes no doors with it. Verified against a copy of the old integrator at 25fps with the real 10s travel / 3s dead timings: identical 26s cycle, a constant one-frame offset, and no drift across a 3s stall that leaves the old code permanently 3 seconds out of phase. Also fixes a latent bug found on the way: UpdateManager iterates the dynamic master socket, which holds Independant and Hermit instances as well as masters, and handed all of them to EntityUpdateReplicants, which asserts MasterInstance. Doorframes no longer consume a slot in the map-entity ownership cursor, which shifts who owns every map entity dealt after them, so this cannot share a session with an older build. The lobby publishes a simulation revision and refuses to launch a mixed room. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -273,6 +273,35 @@ Scalar
|
||||
return mgr->GetFrameRate();
|
||||
}
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// GetMissionElapsed
|
||||
//#############################################################################
|
||||
//
|
||||
Scalar
|
||||
Application::GetMissionElapsed()
|
||||
{
|
||||
Check(this);
|
||||
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
// gameStarted is only ever stamped by RunMissionMessageHandler, so before
|
||||
// the race it is uninitialized - and entities that are pre-runnable do get
|
||||
// performed before then. Answer zero until the clock actually exists.
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
if (
|
||||
GetApplicationState() != RunningMission
|
||||
&& GetApplicationState() != EndingMission
|
||||
)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Scalar elapsed = Now() - gameStarted;
|
||||
return (elapsed > 0.0f) ? elapsed : 0.0f;
|
||||
}
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// Initialize
|
||||
|
||||
Reference in New Issue
Block a user