MetaHookSv icon indicating copy to clipboard operation
MetaHookSv copied to clipboard

[BP] Corpses that spawn out of PVS are not marked as sleeping(green ragdoll) and reset back to ragdolls when in view

Open di57inct opened this issue 1 year ago • 15 comments

The video kind of explains it all but if you need more info just ask please https://www.youtube.com/watch?v=rasT_kNiJxM

di57inct avatar Jan 16 '24 13:01 di57inct

Impossible to fix because client just don't know the state of players outside PVS. (The Out-of-PVS player's state packets are filtered before transmitting from server)

hzqst avatar Jan 16 '24 14:01 hzqst

The real problem would be that they turn into ragdolls and clip through ground and walls without being touched. Can you do something about that?

di57inct avatar Jan 16 '24 14:01 di57inct

The real problem would be that they turn into ragdolls and clip through ground and walls without being touched. Can you do something about that?

Probably because the gravity acceleration was accumulated on the rigidbody when it was in freeze state.

hzqst avatar Jan 16 '24 14:01 hzqst

Probably because the gravity acceleration was accumulated on the rigidbody when it was in freeze state.

I've also noticed a ragdoll moving horizontally because of this. Killed a player in his spawn point and then his ragdoll moved in the other team's spawn because of the accumulated velocity. Hope you can do something about it.

di57inct avatar Jan 16 '24 14:01 di57inct

Probably because the gravity acceleration was accumulated on the rigidbody when it was in freeze state.

I've also noticed a ragdoll moving horizontally because of this. Killed a player in his spawn point and then his ragdoll moved in the other team's spawn because of the accumulated velocity. Hope you can do something about it.

I've removed gravity acceleration for all freezed rigidbodies in https://github.com/hzqst/MetaHookSv/releases/tag/v20240116b, can you have a try?

hzqst avatar Jan 16 '24 15:01 hzqst

The situation is better but they still activate without being touched which makes the problem still happen. Would the best solution be to have them not update at all if they're on the last frame of the death animation, even if touched? Because animations can clip the model through solid objects this will always happen. https://www.youtube.com/watch?v=VcEksngF2mo

di57inct avatar Jan 16 '24 16:01 di57inct

The situation is better but they still activate without being touched which makes the problem still happen. Would the best solution be to have them not update at all if they're on the last frame of the death animation, even if touched? Because animations can clip the model through solid objects this will always happen. https://www.youtube.com/watch?v=VcEksngF2mo

Then the issue #365 would be there able again once the death anim is on it's last frame.

hzqst avatar Jan 17 '24 01:01 hzqst

Can you make a check if death animation is on last frame and a part of the ragdoll is clipped through something solid, then to remove the ragdoll from the model?

di57inct avatar Jan 17 '24 08:01 di57inct

Can you make a check if death animation is on last frame and a part of the ragdoll is clipped through something solid, then to remove the ragdoll from the model?

Why not like always transmit player state packets for dead player even it's out of PVS just like what Valve does in Counter-Strike 2 ? Performing tricky check from client side is really not a good idea.

hzqst avatar Jan 17 '24 08:01 hzqst

If you can do that from client side, sure. Ragdoll calculations are not that expensive anyway so you can do them even if outside player's view.

di57inct avatar Jan 17 '24 11:01 di57inct

If you can do that from client side, sure. Ragdoll calculations are not that expensive anyway so you can do them even if outside player's view.

No it's not possible to do this from client side.

The only possible way to achieve this is to prevent the server dll from checking PVS visibility for dead players, just like what I did in the test branch of reversed engineered server dll:

image

https://github.com/hzqst/CS16ND/commit/6c740c681791f4733a54c480249c413ba47b78db

https://github.com/hzqst/CS16ND/tree/bphysics

Or you can hook pfnCheckVisibility directly by using metamod and always return 1 with SET_META_RESULT(MRES_SUPERCEDE); for dead players in your hook handler.

image image

hzqst avatar Jan 17 '24 11:01 hzqst

I doubt every server owner would want to do that for little to no advantage at all. Solution for this must me client sided. I was thinking about a simple solution by tracing from bone to bone and if something solid is hit then remove the ragdoll from the model. Can't think of something better than that for now.

di57inct avatar Jan 17 '24 12:01 di57inct

I doubt every server owner would want to do that for little to no advantage at all. Solution for this must me client sided. I was thinking about a simple solution by tracing from bone to bone and if something solid is hit then remove the ragdoll from the model. Can't think of something better than that for now.

Why are you always looking for unpractical client side solution that should have been done from server side?

hzqst avatar Jan 17 '24 12:01 hzqst

Because there is no other advantage in doing this except fixing the ragdolls. No benefit for the vanilla client and it could also create other unwanted problems on server side.

di57inct avatar Jan 17 '24 12:01 di57inct

I've tested your solution and it works as you said if the fix is implemented server-side. https://youtu.be/M6q4B8rAtmk As I said before though, you can't expect all server owners to implement this fix in order to support a modified client. If the problem is from client-side, it should be fixed on client side. Can you at least make ClCorpse models that are on last animation frame not update unless touched, since you said not updating them at all would revert back to the previous problems? Thank you. Edit: another simple idea would be to just remove the ragdoll from the ClCorpse model if the origin is out of client PVS. AmxModX script I made to test your theory:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
	register_plugin("[D7] Visibility players dead", "0.0.1", "D i 5 7 i n c T")
	
	register_forward(FM_CheckVisibility, "fwFmCheckVisibilityPre")
}

public fwFmCheckVisibilityPre(const iIDEnt, const pSet)
{
	if (!(1 <= iIDEnt <= get_maxplayers()) || is_user_alive(iIDEnt))
		return FMRES_IGNORED;
	
	forward_return(FMV_CELL, 1)
	
	return FMRES_SUPERCEDE;
}

di57inct avatar Jan 19 '24 00:01 di57inct