Do I do client side prediction on interactable objects?

Started by
3 comments, last by overman1 8 months, 2 weeks ago

For example, if I pick up a gun or open a door, should I do client side prediction on it? Its not the same as movement so I'd guess not but there's gonna be a slight delay when you do these actions.

I personally think no, but I'm not sure about this. What do other bigger games do?

Advertisement

overman1 said:
For example, if I pick up a gun or open a door, should I do client side prediction on it?

This depends - how do you pick up gun or open a door.

  • If the object is interactable, then player interacting with it has to explicitly send a message to server that he interacts with a door or picks up a gun. There is no way other clients could even remotely predict that - therefore you can't do client side prediction for such actions.
  • If the object is interactable and player only implicitly interacts with it based on his position (i.e. weapon is automatically picked up when it is within range of 50 or less), then you can client-side predict the action. Now picking up a weapon might be a bit tricky when multiple players are around (hence it's often not done). Doors are problematic…

Client side prediction on doors could lead to unfair advantage of some players (seeing what's behind doors earlier than others). So, either no prediction (and therefore less smooth responsiveness in some cases), or adapt map design to it - design maps with static - open or semi-open doors so that neither of players gets unfair advantage over another.(or have doors with glass, etc.).

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

If you already have a general system for client prediction, I would use it for pickups, too.

The main case where you don't need client prediction, is in large, ponderous processes. Steering a big ship, or driving a huge crane, would be cases where prediction really isn't needed.

When it comes to pickups, playing the local effects first (particles, sound effects) and then applying the gameplay effects when you're actually confirmed, may be a good middle ground. If you hear the “pickup” sound, but end up not holding the weapon because someone else was right beside you and got there first, then you're simply “hearing their pickup" :-D

enum Bool { True, False, FileNotFound };

@undefined I see. My general idea was to give just send a command to the server and have it deal with it. After reading your post I think that’s it’s probably better to just not predict anything.

This topic is closed to new replies.

Advertisement