m-byte918 / MultiOgarII

A continued version of the original MultiOgar, an open source Ogar server implementation written with Node.js.
Apache License 2.0
126 stars 131 forks source link

fixed spectate teleport bug #1518

Closed Tombez closed 4 years ago

Tombez commented 5 years ago

Division by zero causes camera coordinates to jump to infinity

Tombez commented 5 years ago

To clarify, to trigger the bug, one would only need to hold one's cursor in the center of the screen while free roam spectating. That would make the difference between their cursor position and their camera position zero, which causes the division by zero.

ghost commented 5 years ago

Have you done any performance tests on this? To me it seems as though this bug was a result of some optimizations.

Tombez commented 5 years ago

The bug is not the result of optimization, it is unrelated to the bitwise not operations. I'll do a perf test now.

Tombez commented 5 years ago

MOII before pr: moe-perf-test

MOII after pr: moe-pr-perf-test

Both tests were run with 499 bots, one spectator, for 5 minutes.

Tombez commented 5 years ago

I added back the bitwise NOT operations, as it was unrelated to the bug. If you merge this PR first, I can rebase my other PR and solve the merge conflicts.

ghost commented 4 years ago

Thanks Tombez. :)