-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Improve performance of trace rays #105
Comments
If implementing (1) which should be most performance friendly, define the trace ray results as global variables, to make them accessible from different functions without the need to call the function.
|
Investigation of engine functions: |
The approach (1) did give some insights, but was not the way to go because it wouldn't resolve the problem of performance. The real issue turned out to be the function |
The cause for the performance drops was an awkwardly hooked function (see #105) which caused the trace ray machinery to be run ten times per freame during aiming in ranged combat. This is now resolved (tenfold speed-up). Performance can be further boosted by a new entry in the ini file which introduces an adjustable recalculation frequency in milliseconds. By default the trace ray/focus collection is recalculated at each frame. When increasing the interval (to up to 500 ms) the focus collection becomes less precise, but might boost the performance slightly on weak machines (powerful machines will not benefit from this setting and should keep the value close to zero). Caution: Increasing this value beyond 45 ms will introduce a stutter in spells like blink that continually visualize the aim vob.
Trace rays for focus and distance/obstacle collection are fired continuously every frame. Benchmarking showed that the
freeAimRay
function takes (worst-case) 100+ ms on a weak machine. Doing this each frame is a crime on performance.The approach to return the previous results from the trace ray/focus collection every nth frame, instead of recalculating it every frame, failed, because Gothic's internal focus collection does not happen every frame either causing a discrepancy: Trace ray recalculation and internal focus update do no coincide, such that a new focus can never be captured by the trace ray (as it will be overwritten by the previous frames' results).
Task:
Either (1) find where Gothic's internal focus collection happens exactly, and hook at that address directly, or (2) force recalculation when the focus has changed.
The text was updated successfully, but these errors were encountered: