Skip to content

Optimize TraceBleed to skip unnecessary TraceLine calls#1106

Merged
s1lentq merged 2 commits intorehlds:masterfrom
dystopm:tracebleed-optimization
Sep 26, 2025
Merged

Optimize TraceBleed to skip unnecessary TraceLine calls#1106
s1lentq merged 2 commits intorehlds:masterfrom
dystopm:tracebleed-optimization

Conversation

@dystopm
Copy link
Contributor

@dystopm dystopm commented Aug 14, 2025

Purpose

Optimize TraceBleed, which is called when a player is shot, by reducing unnecessary TraceLine calls for blood decal placement. In high-fire-rate modded servers (e.g., zombie mods), this can otherwise consume unnecessary resources.

Approach

Move the 1/3 probability check to the start of the loop in TraceBleed and continue early when it fails, avoiding the cost of computing jitter and calling TraceLine in those cases.

@hajimura
Copy link
Contributor

Nice catch! 👍

@s1lentq s1lentq merged commit 5b59159 into rehlds:master Sep 26, 2025
5 checks passed
@dystopm dystopm deleted the tracebleed-optimization branch September 28, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants