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

PT demand - request color change performance improvements #1725

Merged
merged 5 commits into from
Mar 20, 2023

Conversation

krzychu124
Copy link
Member

Building color update improvement

  • deleted code for requesting color update
  • removed clamping, since it's performed in Color.Lerp() anyways

Reason behind the change is that in vanilla, game updates building colors in batches of max 192 buildings each simulation step. Our code could, at worst case request full buildings color update if within frame we request update of building with id e.g. 1 and then e.g. 43k. That will force the game to update colors of all buildings in range <1; 43000> which is relatively slow, and affects FPS (update colors is main thread operation - it's setting color pixels on texture)
When user enters specific Info view, the game is performing full update once and also when simulation is running it runs update batches so we don't really lose anything with this change, full loop takes 256 simulation steps, so 4 seconds if simulation is running at native 1x speed (64 steps/sec).

Build ZIP

@krzychu124 krzychu124 added code cleanup Refactor code, remove old code, improve maintainability performance Make it faster! PARKING Feature: Parking AI / restrictions / etc labels Feb 27, 2023
@krzychu124 krzychu124 added this to the 11.7.4.0 milestone Feb 27, 2023
@krzychu124 krzychu124 self-assigned this Feb 27, 2023
@krzychu124 krzychu124 requested a review from DaEgi01 March 9, 2023 20:35
@krzychu124 krzychu124 merged commit d22b8d0 into master Mar 20, 2023
@krzychu124 krzychu124 deleted the bugfix/building-color-update branch March 20, 2023 22:40
@krzychu124 krzychu124 mentioned this pull request Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup Refactor code, remove old code, improve maintainability PARKING Feature: Parking AI / restrictions / etc performance Make it faster!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants