Skip to content
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

Don't calculate safe speed for stationary vehicles for SFX #70676

Merged
merged 1 commit into from
Jan 6, 2024

Conversation

prharvey
Copy link
Contributor

@prharvey prharvey commented Jan 5, 2024

Summary

Performance "Optimize stationary vehicle performance when they contain a lot of items."

Purpose of change

Turning the engine on generates SFX, and that requires getting the safe speed of a vehicle, which requires getting the mass of all items on the vehicle. This isn't needed if the vehicle is stationary.

Fix #68982

Describe the solution

Delay computing the safe speed until it is needed.

Describe alternatives you've considered

This could be fixed for moving vehicles by caching the item mass, but that would require a lot of investigation into where that cache would need to be invalidated. It's probably fine for moving vehicles to slow the game down, since that is done interactively most of the time and won't be noticed.

Testing

Additional context

Before:
Screenshot 2024-01-05 104029

After:
Screenshot 2024-01-05 105308

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) Code: Performance Performance boosting code (CPU, memory, etc.) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Jan 5, 2024
@prharvey prharvey marked this pull request as ready for review January 5, 2024 18:00
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 5, 2024
@Maleclypse Maleclypse merged commit 67c3eb1 into CleverRaven:master Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Significant game slowdown when a vehicle engine is turned on
2 participants