Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve player sync when exiting vehicle #2084

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

Merged

Conversation

@Zangomangu
Copy link
Contributor

@Zangomangu Zangomangu commented Feb 13, 2021

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.

ApeLsiN4eG, Tru-KaaN, Ibrahim-sec, bum8hj, Einheit-101, AlexTMjugador, LVRENT, Proxy-99, and Fernando-A-Rocha reacted with thumbs up emoji Tru-KaaN, ApeLsiN4eG, Unde-R, and LVRENT reacted with laugh emoji ApeLsiN4eG, Tru-KaaN, Unde-R, AlexTMjugador, and LVRENT reacted with hooray emoji sacr1ficez, ApeLsiN4eG, jlillis, Tru-KaaN, Unde-R, AlexTMjugador, LVRENT, and Proxy-99 reacted with heart emoji PlatinMTA, sacr1ficez, Tru-KaaN, ApeLsiN4eG, theSarrum, Unde-R, bum8hj, AlexTMjugador, LVRENT, T-MaxWiese-T, and 2 more reacted with rocket emoji
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)
Copy link
Contributor Author

@Zangomangu Zangomangu Feb 13, 2021

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.

if (CClientPed* pOccupant = GetOccupant(i))
pOccupant->SetPosition(vecPosition);
if (pOccupant->GetVehicleInOutState() != VEHICLE_INOUT_GETTING_OUT || pOccupant->GetRealOccupiedVehicle())
pOccupant->SetPosition(vecPosition);
Copy link
Contributor Author

@Zangomangu Zangomangu Feb 13, 2021

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).

if (pVehicle)
m_List.remove(pVehicle);
}

Copy link
Contributor Author

@Zangomangu Zangomangu Feb 13, 2021

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.

@botder botder added this to the Next Stage milestone Feb 13, 2021
@botder botder added the enhancement New feature or request label Feb 13, 2021
@patrikjuvonen patrikjuvonen added the backwards-incompatible Should be merged after the release of 1.7.1 label Aug 30, 2021
Copy link
Contributor

@patrikjuvonen patrikjuvonen left a 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.

@patrikjuvonen patrikjuvonen merged commit e5026e7 into multitheftauto:master Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@patrikjuvonen patrikjuvonen patrikjuvonen approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

backwards-incompatible Should be merged after the release of 1.7.1 enhancement New feature or request

Projects

None yet

Milestone

1.6.0

Development

Successfully merging this pull request may close these issues.

Desync whilst exiting vehicles at high speed

AltStyle によって変換されたページ (->オリジナル) /