source-sdk-2013 icon indicating copy to clipboard operation
source-sdk-2013 copied to clipboard

[HL2MP] Make blood server-side only

Open weaponcubemap opened this issue 10 months ago • 10 comments

An issue in HL2DM is that the blood impact effects are client-sided. This creates false data for players at time because the impact effects can be shown to the player shooting their gun but no damage will be registered by the server. An example of the issue can be found here: https://www.youtube.com/watch?v=-ivOugLRGZM

When players are in movement, this issue tends to happen a lot more frequently.

weaponcubemap avatar Feb 25 '25 23:02 weaponcubemap

What about SpawnBlood or UTIL_BloodDrips?

Margen67 avatar Feb 25 '25 23:02 Margen67

have you tested this? i think blood effects dont get networked to the attacker by default, so wouldn't this just make blood effects never visible for the attacker?

wgetJane avatar Feb 26 '25 02:02 wgetJane

have you tested this? i think blood effects dont get networked to the attacker by default, so wouldn't this just make blood effects never visible for the attacker?

DispatchEffect creates the temp ent for blood effects so this should be fine?

JustYourOrdinaryNormie avatar Feb 26 '25 03:02 JustYourOrdinaryNormie

have you tested this? i think blood effects dont get networked to the attacker by default, so wouldn't this just make blood effects never visible for the attacker?

In the competitive scene at least, most if not all would tell you this would not be an issue i.e. they would rather have no blood impact than false data. In fact, some play with low violence on just to get rid of the blood impact client-side. Some servers will use hit sounds to confirm hits. In the above video, hit sounds are actually on but they do not play because no hits are registered by the server.

This absolutely needs to be fixed in such a way that the blood impact effects are moved server-side.

speedvoltage avatar Feb 26 '25 09:02 speedvoltage

turning off blood impact effects for our own attacks sounds weird, there would be no feedback for attacks that hit, this pr doesnt feel like it was tested

effects that are predicted/replicated by the client like blood impacts, bullet sparks, bullet decals, etc are not networked to the attacker that causes those effects

instead of just deleting the client's own blood effects altogether, it should also be networked to them

this is what tf2 does, blood impact effects are serverside and spawn on the exact hitpos of the attack (blood decals on players are still clientside, funnily enough)

wgetJane avatar Feb 26 '25 10:02 wgetJane

just tested this pr and it does just straight up remove the blood impact particle effect, not ideal

wgetJane avatar Feb 26 '25 11:02 wgetJane

Any chance you have code to propose to better fulfill the overall objective?

like i said, tf2 already does it, the code is right here in the same repo

CBaseEntity::TraceBleed is what's used to do the blood effects (blood impact particle effects, blood decals sprayed on the walls, etc)

https://github.com/ValveSoftware/source-sdk-2013/blob/0759e2e8e179d5352d81d0d4aaded72c1704b7a9/src/game/shared/baseentity_shared.cpp#L2270

inside CBaseEntity::TraceAttack is where it gets called for bullet hits, both on the server and client:

https://github.com/ValveSoftware/source-sdk-2013/blob/0759e2e8e179d5352d81d0d4aaded72c1704b7a9/src/game/shared/baseentity_shared.cpp#L2145

to disable the clientside blood effects in hl2mp, then just comment out this line from the C_HL2MP_Player::TraceAttack method:

https://github.com/ValveSoftware/source-sdk-2013/blob/0759e2e8e179d5352d81d0d4aaded72c1704b7a9/src/game/client/hl2mp/c_hl2mp_player.cpp#L191

and here's how tf2 networks the serverside blood effects to the attacker (who normally will be filtered from receiving such effects because they're expected to replicate those effects clientside)

by using CDisablePredictionFiltering before calling TraceBleed in the CTFPlayer::TraceAttack method:

https://github.com/ValveSoftware/source-sdk-2013/blob/0759e2e8e179d5352d81d0d4aaded72c1704b7a9/src/game/server/tf/tf_player.cpp#L8424-L8428

wgetJane avatar Feb 26 '25 14:02 wgetJane

I don't work with TF2, only with HL2DM.

The issue is that I don't work with a mod, I and other folks like @weaponcubemap modify server behavior and can only do that. The question is now to know how you would still get rid of the client side blood impact effect without involving client modifications. I have had some progress here and there, but it comes with side effects I don't like. I'm open to suggestions.

speedvoltage avatar Feb 26 '25 14:02 speedvoltage

you can network the accurate serverside blood effects with a modded server

you cannot get rid of the predicted clientside blood effects without a modded client

wgetJane avatar Feb 26 '25 14:02 wgetJane