Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

Reply
 
Thread Tools Display Modes
Old 08-22-2012, 12:06 PM   #1
R_Yell
 
Join Date: Jun 2007
Reputation: 16
Posts: 187
Possible huge hitbox related issue in HL2MP based mods

A bit of story:

I have been experiencing hitbox related issues in my mod since long ago. Actually, since it was ported to orange box and further updates, always under HL2MP variant. I call them 'ghost hits', you know, when a bullet hits client or server side hitboxes, never both at same time. So you either see blood but no damage is done or enemy is hurt and blood splatter is emitted with some delay ( server only hit).

Some recent testing showed that it isn't my mod but a clean HL2MP based solution shows same exact issues.

This is my testing methodology, I create a bot that just uses this code:

Code:
QAngle ang = pBot->EyeAngles();
ang[YAW] += 10;
pBot->SnapEyeAngles(ang);
cmd.sidemove = cmd.forwardmove = 0;
It just rotates yaw axis at constant speed. Why yaw rotation? Because I never noticed out of normal hitbox related issues when players just moved along a straight path, or strafing.

Just compare the hitboxes (red client, blue server), all using same 100 ms lerp

My mod

mostly clean HL2MP (only custom bot code + sv_showimpacts function)


MP template (only custom bot code)


Hitboxes are all around the place in my mod and HL2MP, while MP template just shows a slight gap that is supposed to be there. Less lerp decreases the gap, however not everybody can use low lerp. Hitboxes can't ever match perfectly but they seem clearly unsynchronized in HL2MP derived mods when player model rotates over its yaw angles

I certainly could use some help here because this is deep sh*t territory. We are talking about fast FPS and accuracy, not point and click adventures.

Last edited by R_Yell: 08-22-2012 at 12:36 PM.
R_Yell is offline  
Reply With Quote
Old 08-22-2012, 02:15 PM   #2
R_Yell
 
Join Date: Jun 2007
Reputation: 16
Posts: 187
If someone feels curious about this, try commenting CHL2MP_Player::SetupBones, all of it. Purpose: Override setup bones so that is uses the render angles from the HL2MP animation state to setup the hitboxes. MP template lacks this function, accuracy improved significantly in edge cases after it was removed, so I'm wondering what's supposed to do in HL2MP.

My hitboxes look fine now. Note that the only relevant information in the screenshot is how aligned the red and blue boxes are.

Last edited by R_Yell: 08-22-2012 at 11:28 PM.
R_Yell is offline   Reply With Quote
Old 08-22-2012, 08:19 PM   #3
killermonkey01
 
 
 
Join Date: Dec 2008
Reputation: 4
Posts: 42
Remember that when a shot is fired the server actually dials back the hitboxes in the Lag Compensation module to mimic what the client sees in order to compensate for the travel time of the key press from client to server. You can see this computation using sv_showlagcompensation.

The difference between the client/server hitboxes might just be an artifact of the display function for the hit boxes and not actually the problem.

I do agree that there are cases where phantom hits occur, but I think they are related to awkward animations more than any significant code problem.
killermonkey01 is offline   Reply With Quote
Old 08-22-2012, 11:21 PM   #4
R_Yell
 
Join Date: Jun 2007
Reputation: 16
Posts: 187
Thanks for the input, but you obviously missed something here. Inform yourself about sv_showimpacts in case you don't know about it, go check the screenshots again. The hitboxes are "dialed back" when a shot impacts a target, that is what that cvar shows basically. If not, the information provided here would be wrong and I'd be unwise for doing so.

So this is a real issue that happens in the stock code provided by Valve. I described how to reproduce it, and the fix does the job too (all empirically tested). I don't have the technical knowledge to explain why CHL2MP_Player::SetupBones is broken though, it was lucky guess.
R_Yell is offline   Reply With Quote
Old 08-26-2012, 09:37 AM   #5
Varsity
 
Join Date: Jun 2004
Reputation: 489
Posts: 17,360
HL2MP has been retro-fitted into several new engine branches now. It wouldn't surprise me if this was an error introduced in a code merge.

Can you reproduce the problem in the official HL2DM build?
Varsity is offline   Reply With Quote
Old 08-26-2012, 12:00 PM   #6
R_Yell
 
Join Date: Jun 2007
Reputation: 16
Posts: 187
Test yourself if it helps... TBH I couldn't care less if official HL2MP is bugged as well.

I cornered the issue just replacing the source used to get the player angles. Inside CHL2MP_Player::SetupBones, I replaced m_PlayerAnimState->GetRenderAngles() for GetAbsAngles()
(BuildMatricesWithBoneMerge and Studio_BuildMatrices).

Haven't found why m_PlayerAnimState->GetRenderAngles() is wrong here but that change basically does the trick as commenting the whole function did otherwise.
R_Yell is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -7. The time now is 08:38 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2012, All Rights Reserved.