-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix map cache invalidation #31295
Fix map cache invalidation #31295
Conversation
Didn't do any profiling, but can confirm that crafting is subjectively a good 5+ times faster with this PR applied. |
@anothersimulacrum reported that picking up a light emitting object such as a flashlight fails to trigger a vision update. |
I ran into a few more issues - one while playing with this, and two more while testing to get an easily reproducible case of the first one. Here are the issues: Here's the one I encountered in gameplay: |
4784b18
to
da2f28b
Compare
I revisited the cache invalidation logic for the lighting cache, and it needs significant additional infrastructure to work properly. |
da2f28b
to
25f79b6
Compare
25f79b6
to
951503f
Compare
Summary
SUMMARY: Performance "Avoid recalculating vision and lightmap unnecessarily."
Purpose of Change
Fixes #31252
The recent change in #30018 made the overhead of calculating the vision and light caches during crafting and other long actions prohibitive.
Describe the solution
Uses the existing transparency cache code to decide when it's safe to skip regenerating the vision and lightmap caches.
Critically, removes several cache invalidations that were happening every turn which seem to be unnecessary.
Describe alternatives you've considered
"Make it faster". I'm working on it, but this is much faster for the scenario where the cache isn't being invalidated often.
Video
https://photos.app.goo.gl/tE7WijfYzgJaD4Fm9