-
-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve player sync when exiting vehicle #2084
Improve player sync when exiting vehicle #2084
Conversation
@@ -514,21 +514,17 @@ void CClientPed::SetPosition(const CVector& vecPosition, bool bResetInterpolatio | |||
// Don't set the actual position if we're in a vehicle | |||
if (!GetRealOccupiedVehicle()) | |||
{ | |||
// Set it only if we're not in a vehicle or not working on getting in/out | |||
if (!m_pOccupiedVehicle || GetVehicleInOutState() != VEHICLE_INOUT_GETTING_OUT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check was here, because when vehicle position is updated from puresync it also updates passengers, so it would have warped him to the roof when exiting. Now we receive player puresync when exiting, we need to allow it.
for (int i = 0; i <= NUMELMS(m_pPassengers); i++) | ||
if (CClientPed* pOccupant = GetOccupant(i)) | ||
pOccupant->SetPosition(vecPosition); | ||
if (pOccupant->GetVehicleInOutState() != VEHICLE_INOUT_GETTING_OUT || pOccupant->GetRealOccupiedVehicle()) | ||
pOccupant->SetPosition(vecPosition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When vehicle position is updated, we dont want to update position for peds who are exiting, because we removed the check in CClientPed::SetPosition
(see above comment).
|
||
// Remove our vehicle again | ||
if (pVehicle) | ||
m_List.remove(pVehicle); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I put this here here (vs. sending it from CNetAPI::DoPulse
), is that it must send the packets at the correct rate as remote clients expect them to come in at 400 ms or whatever the sync rate is and apply interpolation based on that.
Maybe there's a better way to achieve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires more of a beta test, so didn't do much testing myself, looks good, thanks.
Fixes #409
Before pr: https://streamable.com/1hqzd8
Currently players are unsynced while exiting a vehicle (ie. rolling out), when they finish exiting the position is corrected by player puresync. It provides an unfair advantage to the player jumping out. Latency and vehicle speed makes it worse.
After pr: https://streamable.com/rrwul7
Players are now synced while exiting.
The fix makes the exiting player send player puresync when he is exiting and actually outside the car. This involves a few changes on the server to allow this.
The driver wont be sending vehicle puresync now, so instead he starts sending unoccupied vehicle sync.
The changes aren't backwards compatible, so should be planned for a major release.