skullernet / q2pro

Enhanced Quake 2 client and server
GNU General Public License v2.0
251 stars 89 forks source link

Crosshair is always missing the actual shot trajectory - aimfix needed #365

Open JoGr223 opened 1 month ago

JoGr223 commented 1 month ago

this would be great benefit for online multiplayer especially for non experienced players

Reproduction steps

  1. set railtrail to line cl_railtrail_type 1 - just to be able to notice the problem more clearly; issue happens regardless of settings and weapons; best visible with dot crosshair=1 with small scale and maybe longer trail duration eg cl_railtrail_time=8
  2. shoot at different distances

Expected behavior

rail shot should hit precisely in the center of crosshair

Actual behavior

rail shot hits below crosshair (assuming default cl_y=0; it could be adjusted, but its not a fix cause the problem will always happen at different distance regardless of cl_y) depending on the distance it will be off to a different degree

this is probably known issue present in original quake2, as both Yamagi q2 and Q2RTX has implemented fixes for this, i havent checked how it works there, but i have tested that it works in Quake Live - when you shoot with rail you always hit where your crosshair is; after shot you can even zoom in and see the crosshair still in the center of shot that was just fired and left mark on wall

this is the issue description from Q2RTX: https://github.com/NVIDIA/Q2RTX/issues/274

and here is the code that fixes the problem: https://github.com/NVIDIA/Q2RTX/commit/a50fe3547c17f95537eafd42db14aa83e9efdcc1

perhaps its a matter of copying this code and adapting (as i think the author did from yamagi), i have no experience with q2 source code but i noticed both Q2RTX and Q2PRO have this file p_weapon.c where the fix is implemented

the param introduced to fix:

Paril commented 1 month ago

This is a game DLL-specific fix, not an engine fix. Whichever game DLL you use on the server should implement this fix. It won't work online, the server has to be hosting the DLL with said fix.

JoGr223 commented 1 month ago

This is a game DLL-specific fix, not an engine fix. Whichever game DLL you use on the server should implement this fix. It won't work online, the server has to be hosting the DLL with said fix.

so you mean if i want to have it in online matches using OpenTDM servers then it should be implemented in https://github.com/packetflinger/opentdm ? and then there is no problem that q2pro doesn't have it when im playing with q2pro client?

Paril commented 1 month ago

Correct. The weapon firing code runs on the server, not the client; the server already gets your exact view angles (well, near-exact).

Calinou commented 2 weeks ago

The only engine-level "fix" that would be possible would be to offset the crosshair to match the misaligned position, but the offset will depend on the distance of the object being aimed at. This means the crosshair would move around slightly during gameplay (in a manner similar to Serious Sam).