Wednesday, November 6, 2024
spot_img

networking – How To Deal With Time for Entity Interpolation for Multiplayer Video games


I’m at present making an attempt to make a easy multiplayer recreation however had just a little little bit of hassle implementing client-side entity interpolation for entity motion. For some context, I’m aiming to make a server-authoritative entity interpolation system utilizing the strategy outlined within the well-known Supply article from Valve: https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking (The entity interpolation part)

What I’m at present doing is I buffer the packets that I obtain from the server and use the bounding states of the time calculated by current_client_time - cl_interp and use the fractional worth between the 2 bounding packet occasions because the lerp worth. Nevertheless, that is the place I face an issue. How do I document the time/timestamp of the packets?

At the moment, I’m storing and utilizing the consumer timestamp of the sport time I obtained the packets to match. Nevertheless, this led to the issue of the motion trying clean, but, barely “wobbly”. This was as a result of though the server sends packet data at a steady charge, the occasions that the consumer receives them aren’t completely steady. Which means there are occasions when the interval between two packets is brief or typically longer, resulting in a slower or sooner interpolation between two states. This was the case even for sending the knowledge by means of the native host.

I discovered a publish with an analogous query on reddit: https://www.reddit.com/r/gamedev/feedback/85ndvx/implementation_specifics_for_entity_interpolation/
and the reply suggests utilizing the servers’ timestamp as a substitute. Nevertheless, based mostly on my understanding (please right me if I’m improper), this is able to imply that I must embody the server timestamp within the packet. After I seemed up the packet buildings for different multiplayer indie video games (Terraria, previous Minecraft), I observed that they don’t embody the timestamp, but they’ve comparatively clean actions with no noticeable wobble.

My most important query is how do they do it if they don’t embody the server timestamp included within the packets? Or is there one thing that I’m misunderstanding or is there an alternate strategy? If my strategy/understanding is improper, right here is a few extra context of what I would like: I do not want client-side prediction as a lot as a result of I’m making an attempt to make use of a top-down click-to-move system like League of Legends or Starcraft. I simply primarily want clean motion and the latency is much less of a problem. I hope somebody can level me in the correct route.

I do not know if it will assist, however right here is the construction of my recreation. I at present have a separate mounted logic replace loop and unfixed loop (largely for rendering) for the consumer and a single mounted replace loop for the server. The server runs at a charge of 60 ticks per second and periodically sends the positions of transferring entities at a steady 20 occasions per second. The consumer polls and processes community occasions at an unfixed charge (although I can simply transfer this to a hard and fast one. I am unsure the place to place this however neither actually helped with the wobbly habits). The consumer’s mounted replace can also be at a charge of 60 ticks per second and an unfixed charge of about 165 occasions per second (vsync).

Thanks!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles