Download

Server occluding ragdoll pawns for clients?

When an enemy pawn is killed in multiplayer in my game, I ragdoll the skeletal mesh on the client.

However, it seems if the ragdoll falls too far away from the pawn that owns it, the skeletal mesh disappears as if it’s using the the server reality for occlusion.

This doesn’t happen in singleplayer or for listen hosts.

Does anyone know where to look to understand what is happening here? Why would the server have any say in occlusion for clients?

Thanks in advance.

in i think its die function or close to it.In pawn there is a check for what server your runnIng and on dedicated it doEs not play them. i TRIED A FEW THINGS AND GAVE UP NEVER COULD GET THEM TO PLAY ON DEDICATED < sorry for caps.

It does always play the ragdoll. The issue is afterwards the skeletal mesh can toggle between visible and hidden for the client as their vew moves around.

here’s how I see it:
your pawn mesh is (probably) set to be the collision component upon death, which IIRC is what drives the actor location.
now when the pawn dies you’re (probably) setting bTearOff=true which disables replication for that actor. as such, the pawn’s location from the ragdoll movement still matches in singleplayer or the server player (listen host) but it’s not being updated on clients. so when the ragdoll is far enough and the bounds of the pawn at the last replicated location are offscreen it will just determine that it doesn’t need to be rendered.
I might be wrong, but try drawing a debug sphere (the size of the bounds) when the pawn dies and when it moves outside of the sphere check for offscreen behavior with it. then you’ll know if my theory is correct :slight_smile:

as for a fix, right now I can’t think of something more elegant other than not setting bTearOff=true and continue to replicate the actor location (at least until the ragdoll disappears), because you’d continue to have a replicated actor for a corpse. might not be terrible since at that point probably no other vars will change anymore so it will be light on net traffic. as long as your ragdolls disappear at some point and free up the network slots you’ll probably be fine

Thanks for the response @Chosker.

I’m not actually setting bTearOff=true on the pawn, as I allow the player to loot the corpse after the death (which requires the server).

In fact if I do set bTearOff to true, the issue doesn’t happen at all. That is what is confusing to me, because why would the server somehow make the client set the pawn to hidden.

I used to think it was because the server would determine the pawn is no longer relevant. But that is not the case because otherwise it would reset it’s pose as it blinks in and out for the client. But the ragdoll stays in it’s resting place (i’m also using AlwaysRelevantDistanceSquared to keep pawns in close radius replicated).

That’s why i thought it has something to do with occlusion, but I don’t know why that would concern the server…?

hmmm interesting.
once it disappears, does it disappear for good or can you make it reappear if you look/move around the area?
if it disappears for good, can you debug it to see if it’s hidden or if the actor has been destroyed?

It pops in an out as the client moves around it.

I will add some logging, as you suggest, to check if the visibility is updating (as i expect it is).