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

Fix shadowcasting for weather with sight_penalty != 1.0 #72669

Merged
merged 1 commit into from Mar 29, 2024

Conversation

SurFlurer
Copy link
Contributor

@SurFlurer SurFlurer commented Mar 28, 2024

Summary

none

Purpose of change

Fix the comment #65205 (comment)
Fix #72508
Partially address #65205 ( there are still inconsistent shadowing in different weather conditions, but no more see through the wall )

If the span split is due to two transparent map tiles having different transparency ( like between indoor tiles and outdoor tiles ), those squares will be checked by both B and C spans. I could't say I understand shadowcasting very well, but I believe this behavior led to performance hit and weird shadowing in the steel mill.

Describe the solution

Like skip_first_row, add a variable skip_first_column in struct span, which indicates the span should skip the squares whose leading_edge_minor is the same as the span's start_minor. The attribute is to be inherited by A, B and D spans ( those spans have the same start_minor as the span being split. ) As for C span, after being split, the attribute is rechecked and reapplied, to avoid inappropriately skipping squares.

Describe alternatives you've considered

Testing

There is no perceived performance hit in the steel mill, even if I turned off compiler optimization for shadowcasting code.

There's more correct shadowing in the steel mill: ( compared with #65205 (comment) )
image

For #65205, inconsistency still exists, but the wall correctly blocks the terrain behind it.
image

Generally, this is not perfect nor final solution to artifacts in shadowcasting, but I believe I'm making it more correct.

Additional context

@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) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Mar 28, 2024
@Maleclypse Maleclypse merged commit 2ccd61c into CleverRaven:master Mar 29, 2024
30 checks passed
@SurFlurer SurFlurer deleted the shadowcasting branch March 29, 2024 05:42
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` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Massive Slowdown at Steel Mill during Night Time
2 participants