Fix shotgun pattern origin in g_weapon.c#78
Conversation
Make server-side start point the same as client's prediction https://github.com/ec-/baseq3a/blob/e24c8418b54948b3c6e05ac6987aab29033fd179/code/cgame/cg_weapons.c#L2222
There was a problem hiding this comment.
Great catch! Indeed the pattern is off. Sometimes it's possible to get the "blood" effect but no damage (especially easy to reproduce if you set fixed seed, tent->s.eventParm = 255):
However, see my comment.
I suspect that this piece of code is also affected? Although it's only about Team Arena.
Line 666 in 5a4ab3a
| tent = G_TempEntity( muzzle, EV_SHOTGUN ); | ||
| VectorScale( forward, 4096.0, tent->s.origin2 ); | ||
|
|
||
| SnapVector( tent->s.origin2 ); | ||
| tent->s.eventParm = rand() & 255; // seed for spread pattern | ||
| tent->s.otherEntityNum = ent->s.number; | ||
|
|
||
| ShotgunPattern( muzzle_origin, tent->s.origin2, tent->s.eventParm, ent ); | ||
| ShotgunPattern( tent->s.pos.trBase, tent->s.origin2, tent->s.eventParm, ent ); |
There was a problem hiding this comment.
I think it's better to make the client-side stuff match the server side, rather than the other way around. The latter actually changes gameplay, the former does not. So, keep ShotgunPattern as is and instead change the origin of G_TempEntity to muzzle_origin.
| ShotgunPattern( tent->s.pos.trBase, tent->s.origin2, tent->s.eventParm, ent ); | |
| tent = G_TempEntity( muzzle_origin, EV_SHOTGUN ); | |
| VectorScale( forward, 4096.0, tent->s.origin2 ); | |
| SnapVector( tent->s.origin2 ); | |
| tent->s.eventParm = rand() & 255; // seed for spread pattern | |
| tent->s.otherEntityNum = ent->s.number; | |
| ShotgunPattern( muzzle_origin, tent->s.origin2, tent->s.eventParm, ent ); |
See the following comment. Looks like muzzle_origin is a better match for hitscan traces. Also it's used for all other weapons.
Lines 10 to 11 in 5a4ab3a
There was a problem hiding this comment.
Ah, but my suggestion, however, would still result in a bit of inaccuracy, due to snapping:
Lines 478 to 490 in 5a4ab3a
But I think it's acceptable.
There was a problem hiding this comment.
I think it's better to make the client-side stuff match the server side, rather than the other way around. The latter actually changes gameplay, the former does not. So, keep
ShotgunPatternas is and instead change the origin ofG_TempEntitytomuzzle_origin.See the following comment. Looks like
muzzle_originis a better match for hitscan traces. Also it's used for all other weapons.Lines 10 to 11 in 5a4ab3a
I believe it's better to make the server match the client in this case. For over 20 years, everyone has been using the client-side implementation (even OSP 1.03, which was confirmed via decompilation). Forcing everyone to update their clients is not the right approach here.
Every mod I have checked contains this exact same fix (or bug). They all share one thing in common: the client calculates it from s.pos.trBase rather than muzzle. Therefore, I believe the correct approach is to fix the server-side code
There was a problem hiding this comment.
Forcing everyone to update their clients is not the right approach here.
I'm not suggesting to touch client code. I am saying that we need to change the origin of the EV_SHOTGUN temp entity to match the origin passed to ShotgunPattern, and not the other way around (changing the origin passed to ShotgunPattern to match the origin of the temp entity).
Every mod I have checked contains this exact same fix (or bug)
That's how things are in the original Quake III source code. See my comment below, https://github.com/ec-/baseq3a/pull/78#issuecomment-4854832943
There was a problem hiding this comment.
Forcing everyone to update their clients is not the right approach here.
I'm not suggesting to touch client code. I am saying that we need to change the origin of the
EV_SHOTGUNtemp entity to match the origin passed toShotgunPattern, and not the other way around (changing the origin passed toShotgunPatternto match the origin of the temp entity).Every mod I have checked contains this exact same fix (or bug)
That's how things are in the original Quake III source code. See my comment below, https://github.com/ec-/baseq3a/pull/78#issuecomment-4854832943
Sorry my bad
|
Doing more digging: |
Make server-side start point the same as client's prediction
baseq3a/code/cgame/cg_weapons.c
Line 2222 in e24c841