Merge exp/seamless-transfer-2: seamless instance moves keep the player in place

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 16:49:22 -06:00
12 changed files with 220 additions and 39 deletions

View File

@@ -227,12 +227,20 @@ void CharacterComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInit
outBitStream.Write(m_RacesFinished);
outBitStream.Write(m_FirstPlaceRaceFinishes);
outBitStream.Write0();
outBitStream.Write(m_IsLanding);
if (m_IsLanding) {
outBitStream.Write<uint16_t>(m_LastRocketConfig.size());
for (uint16_t character : m_LastRocketConfig) {
outBitStream.Write(character);
// The world transition state, two bits: 0 none, 1 arriving by rocket, 2 leaving. The client's
// LWOCharacterComponent::PostCharacterLoaded (0x00c71660) fades the screen in from white and pushes its
// gameplay state again when it reads 0. A client that kept its scene gets 3, which nothing acts on.
if (m_KeepClientScene) {
outBitStream.Write1();
outBitStream.Write1();
} else {
outBitStream.Write0();
outBitStream.Write(m_IsLanding);
if (m_IsLanding) {
outBitStream.Write<uint16_t>(m_LastRocketConfig.size());
for (uint16_t character : m_LastRocketConfig) {
outBitStream.Write(character);
}
}
}
}

View File

@@ -71,6 +71,13 @@ public:
void SetLastCustomBuild(const std::u16string& tokenizedLOTList) { m_LastRocketConfig = tokenizedLOTList; }
bool GetIsLanding() const { return m_IsLanding; }
/**
* Constructions written while this is set tell the client there is no world transition to show (state 3 instead
* of 0 or the rocket landing). For the one construction a client gets of its own player after a seamless instance
* move (docs/SeamlessTransfer.md).
*/
void SetKeepClientScene(const bool value) { m_KeepClientScene = value; }
/**
* Find a player's rocket
* @param player the entity that triggered the event
@@ -435,6 +442,11 @@ private:
*/
bool m_IsLanding;
/**
* Whether constructions say there is no world transition to show (SetKeepClientScene)
*/
bool m_KeepClientScene = false;
/**
* The configuration of the last used rocket, essentially a string of LOTs separated by commas
*/

View File

@@ -143,8 +143,11 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream& outBitStream, bo
if (!bIsInitialUpdate) m_DirtyBubble = false;
}
outBitStream.Write(m_DirtyPosition || bIsInitialUpdate);
if (m_DirtyPosition || bIsInitialUpdate) {
// A client that kept its player across a seamless instance move knows where it stands better than the save does:
// its construction leaves the frame out, and LWOBasePhysComponent::Deserialize (0x00bf5a10) then sets nothing
const bool writePosition = bIsInitialUpdate ? !m_KeepClientPosition : m_DirtyPosition;
outBitStream.Write(writePosition);
if (writePosition) {
outBitStream.Write(m_Position.x);
outBitStream.Write(m_Position.y);
outBitStream.Write(m_Position.z);

View File

@@ -216,6 +216,13 @@ public:
*/
bool GetIsTeleporting() const { return m_IsTeleporting; }
/**
* Constructions written while this is set carry no position, rotation or velocity. For the one construction a
* client gets of its own player after a seamless instance move (docs/SeamlessTransfer.md): the client applies a
* construction's frame to its player at once, which would pull it back to where it was saved.
*/
void SetKeepClientPosition(const bool value) { m_KeepClientPosition = value; }
/**
* Returns the Physics entity for the component
* @return Physics entity for the component
@@ -400,6 +407,11 @@ private:
*/
void UpdateSpeedBoost();
/**
* Whether constructions leave the position out (SetKeepClientPosition)
*/
bool m_KeepClientPosition = false;
/**
* The list of speed boosts for this entity
*/