mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
fix(replica): send each object's real age as time_since_created_on_server
Live sent the milliseconds since the object was created on the server in every construction header (nonzero in 142,258 of 145,677 captured constructions; the same object constructed again later carries a larger value by the time elapsed; the local player's own construction on load is 0). DLU always wrote 0. The client stores it in the object's config (LWOGameObject::time_since_created_on_server). Entities now remember when they were created (steady clock) and write their age. Test: ReplicaConstructionTest.TimeSinceCreatedOnServerIsTheObjectsAge. Check in game: zone in and walk around several worlds; objects, NPCs, enemies and other players appear and animate as before (no objects popping, stuck or misplaced animations on platforms/spinners). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -997,7 +997,9 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream& outBitStream, eReplicaPacke
|
||||
outBitStream.Write<uint8_t>(name.size());
|
||||
outBitStream.Write(name);
|
||||
|
||||
outBitStream.Write<uint32_t>(0); //Time since created on server
|
||||
// Live sent the object's age on this server in milliseconds: 0 for an object constructed as it is created
|
||||
// (a player's own construction on load), the time since load for zone objects.
|
||||
outBitStream.Write<uint32_t>(GetTimeSinceCreatedMs());
|
||||
|
||||
const auto& syncLDF = GetVar<std::vector<std::u16string>>(u"syncLDF");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user