#2768 and #2767 (fixed bugs) and some optimization#2770
Open
DanyilYedelkin wants to merge 3 commits intoInterkarma:masterfrom
Open
#2768 and #2767 (fixed bugs) and some optimization#2770DanyilYedelkin wants to merge 3 commits intoInterkarma:masterfrom
DanyilYedelkin wants to merge 3 commits intoInterkarma:masterfrom
Conversation
fixed bugs with "Touch spell hit detection targets the player when aiming downwards" and "WeaponManager attack raycast layer mask collides with objects on the "Ignore Raycasts" layer"
### Summary This PR improves runtime performance of DaggerfallMissile by reducing GC allocations and minimizing Unity API overhead. ### Changes - Replaced `Physics.OverlapSphere()` + new `List<>` with `Physics.OverlapSphereNonAlloc()` and a reusable buffer to prevent per-frame heap allocations during AoE checks. - Cached references to `GameManager`, `WeaponManager`, and frequently used components (`Collider`, `EnemySenses`, `EnemyAttack`, `CharacterController`) to reduce expensive `GetComponent<T>()` and singleton lookups. ### Impact - Eliminates GC spikes and microstutters during large-scale spell effects (fireballs, explosions, etc.). - Reduces CPU cost per missile instance, improving scalability in combat-heavy scenes. ### Verification - Tested AoE spells and ranged projectiles with multiple active missiles. - No change in gameplay behavior; only internal performance improvements.
| using DaggerfallWorkshop.Utility; | ||
| using DaggerfallWorkshop.Game.MagicAndEffects; | ||
| using DaggerfallWorkshop.Game.Entity; | ||
| using System.Runtime.InteropServices; |
Collaborator
There was a problem hiding this comment.
Curious, what is this used for?
Author
There was a problem hiding this comment.
Oops... Sorry, I forgot to remove that. I needed it for some other tests... It’s gone now
Removed unused 'System.Runtime.InteropServices' namespace.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: #2768 — Touch spell
Fix: #2767 — WeaponManager hit detection issues
Perf: Optimized DaggerfallMissile runtime (GC + CPU improvements)
Bug Fixes
Optimization
Physics.OverlapSphere()+new List<>withPhysics.OverlapSphereNonAlloc()and a reusable buffer to eliminate heap allocations during AoE checks.GameManager,WeaponManager, and frequently used components (Collider,EnemySenses,EnemyAttack,CharacterController) to reduce expensiveGetComponent<T>()and singleton lookups.Impact
Verification