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 issues in first map of the "UAC Franchise 666" user campaign, #651 #652

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

DanielGibson
Copy link
Member

somehow the collision code managed to spread NaNs on Win32, which caused a horrible framerate, "GetPointOutsideObstacles: no valid point found" warnings in the console and assertions in debug builds. Didn't happen in Vanilla Doom3 though.

At the location I changed the code in, I saw the following values in the debugger:
normal: {x=0.00610326231 y=5.58793545e-09 z=1.19209290e-07 } trmEdge->start: {x=-1358.00000 y=913.948975 z=25.2637405 } start: {x=-1358.00000 y=916.000000 z=34.0000000 }
end: {x=-1358.00000 y=810.000000 z=34.0000000 }
dist (normal*trmEdge->start): -8.28822231
d1: 9.53674316e-07
d2: 9.53674316e-07
f1 (d1/(d1-d2)): inf

"normal" isn't normalized and also very small (in all directions), "start" and "end" have quite different y values, but still doing scalar multiplications of each with "normal" gave the same result.. No idea what this all means exactly, but checking if d1 - d2 is (almost) 0 to prevent INF solved the problems. In the end it will be some tiny differences in floating point calculations between different platforms and compilers..
In my test d1-d2 was exactly 0, but I compare with FLT_EPSILON to be on the safer side.

…wm#651

somehow the collision code managed to spread NaNs on Win32, which caused
a horrible framerate, "GetPointOutsideObstacles: no valid point found"
warnings in the console and assertions in debug builds.
Didn't happen in Vanilla Doom3 though.

At the location I changed the code in, I saw the following values in the
debugger:
normal: {x=0.00610326231 y=5.58793545e-09 z=1.19209290e-07 }
trmEdge->start: {x=-1358.00000 y=913.948975 z=25.2637405 }
start: {x=-1358.00000 y=916.000000 z=34.0000000 }
end:   {x=-1358.00000 y=810.000000 z=34.0000000 }
dist (normal*trmEdge->start): -8.28822231
d1: 9.53674316e-07
d2: 9.53674316e-07
f1 (d1/(d1-d2)): inf

"normal" isn't normalized and also very small (in all directions),
"start" and "end" have quite different y values, but still doing scalar
multiplications of each with "normal" gave the same result..
No idea what this all means exactly, but checking if d1 - d2 is (almost)
0 to prevent INF solved the problems. In the end it will be some tiny
differences in floating point calculations between different platforms
and compilers..
In my test d1-d2 was exactly 0, but I compare with FLT_EPSILON to be
on the safer side.
@DanielGibson
Copy link
Member Author

This should fix the issues from #651.
You can find testbuild for Windows at https://github.com/dhewm/dhewm3/actions/runs/13127361349?pr=652 under "Artifacts" (dhewm3-win32-031b206)

@walikor please test

@walikor
Copy link

walikor commented Feb 4, 2025

This should fix the issues from #651. You can find testbuild for Windows at https://github.com/dhewm/dhewm3/actions/runs/13127361349?pr=652 under "Artifacts" (dhewm3-win32-031b206)

@walikor please test

hi, I tested with both the 32 bit and 64 version and they work correctly, without drops in fps or errors in the console.
Thanks again.

@DanielGibson DanielGibson merged commit cc5f1d9 into dhewm:master Feb 4, 2025
4 checks passed
@DanielGibson
Copy link
Member Author

Great, thanks for testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants