Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Fix player position kickbacks (0.28-0.45)

Newbie Spellweaver
Joined
Dec 28, 2021
Messages
18
Reaction score
1
Am looking to figure out why my character rubberbands to their previous position after traveling great distances, is there an anti-TP routine in the source code that I should be modifying? Would love to know what file that is contained in, or how to otherwise resolve this issue of player kickbacks. Thanks
 
Experienced Elementalist
Joined
Mar 10, 2015
Messages
264
Reaction score
33
This is due to poor synchronization.
 
Newbie Spellweaver
Joined
Dec 28, 2021
Messages
18
Reaction score
1
This is due to poor synchronization.

My client registers desync at steady 0 unless I'm in the middle of Elektro with 6+ zombies after me. Server and client are both running on the same local machine. This same behavior happens when I call setPos from the client as well, I can setPos 950m away with no issue, but any distance greater than 1000m I rubberband back. I can also confirm this by monitoring my start coordinate, traveling with an aerial or land vehicle in one specific direction, and once my coord exceeds 1000m I rubberband back. This behavior does not happen in the 0.28 client/server and I do recall there was anti-teleport added from 0.40-0.44 as well as several other restrictions for what scripts can be executed on the client. There is an anti-teleport routine being triggered afaik. I don't believe this is due to poor synchronization, and if it is, how would you go about solving it? Currently running diffs between 0.28 and 0.44 netcode and I'm sure I'll find it eventually
 
Experienced Elementalist
Joined
Mar 10, 2015
Messages
264
Reaction score
33
Now i'm not running Dayz anymore. No time, to many work.
 
Newbie Spellweaver
Joined
Dec 28, 2021
Messages
18
Reaction score
1
Keep in mind: together we can fix very big amount of bugs. Do DayZ SA better for all, only create!
 
Newbie Spellweaver
Joined
Dec 28, 2021
Messages
18
Reaction score
1
Since I am of the mindset of SHARING my findings and DISCOVERING fixes that can benefit the whole community, here is the anti-teleport that causes my position to rollback when traveling over 1000m/over a certain period of time. I can only hope that the next time I am facing a struggle in the community, we are able to work together to create a solution, rather than it being entirely one sided.

Within networkServer.cpp:364 (this is within my own modified DayZ Legacy codebase and may be on a different line):

NetworkObjectInfo::UpdateInfo NetworkObjectInfo::CheckBestPosition(const NetworkServer *server) const
{
Vector3 bestPos = VZero;
NetworkMessageClass bestJ = NMCUpdateN;
if (object.NotNull())
{
// find the last update of the object
Time time = TIME_MIN;
for (int j=NMCUpdateFirst; j<NMCUpdateN; j++)
{
const NetworkCurrentInfo &info = currentUpdate[j];
const NetworkMessage *msg = info.message;
if (msg)
{
if (msg->time > time)
{
time = msg->time;
bestJ = NetworkMessageClass(j);
}
}
}
//if (bestJ!=NMCUpdateN)
//{
// const auto &best = currentUpdate[bestJ];

// // retrieve position of the object
// NetworkMessageContext ctx(best.message, unconst_cast(server), best.from, MSG_RECEIVE);

// PREPARE_TRANSFER(NetworkObject)
//if (TRANSF_BASE(objectPosition, bestPos) != TMOK)
//{
// bestPos = VZero;
// bestJ = NMCUpdateN;
//}
//}
}
//DoAssert(bestJ==NMCUpdateN || bestPos!=VZero);
NetworkObjectInfo::UpdateInfo ret;
//if (bestJ!=NMCUpdateN)
//{
// ret._pos = bestPos;
// ret._updateDistance = object ? object->UpdateDistance() : FLT_MAX;
// DoAssert(object);
//}

return ret;
}

Commented the lines shown and I no longer receive character rollbacks. I've created a flag, _ENABLE_ANTI_TELEPORT which turns these checks on and off. If anyone else is examining the DayZ source code and wants to ensure their vehicles are stable, this is your solution. From what I am seeing in the engine, there are additional checks that also make sure the player rolls back when specific conditions aren't met and these will be adjusted in DayZ Legacy moving forward.
 
Back
Top