Real-Time Multiplayer Game Rules for TCP and Node.js

I read a Valve article on a multi-tenant network that was adapted from a 2001 article by Jan Berner entitled Methods of compensating for latency in design and optimizing client / server protocols . I am making a real-time multiplayer game using a node.js server connected to clients through socket.io, and I have a few questions regarding the principles described below:

Entity Interpolation

[Interpolation] prevents jittery movement. they usually lead to buffering server updates, and then play them back at intervals that are smoothly interpolated between them. It can also protect against crashes caused by packet loss.

Client Side Prediction

Prediction is a concept of a client that predicts the consequences of a local player’s actions, without waiting for confirmation by the server. The predicted state of the object is checked on the server commands, because they are until a match or an incorrect match is found.

Delay Compensation

Compensation delay is a server concept that uses player latency to rewind time during processing [user input] to see when a command was sent. Combined with prediction, lag compensation can help combat network latency to the point of almost eliminating it from the attacker's point of view.

  • Do the principles apply to TCP as well as to UDP, and will there be any differences in implementation? I see that entity interpolation should not protect against packet loss, but that's about it.

  • Can I communicate between the server and the web browser and vice versa using UDP and node.js?

  • Since the article is over ten years old, are these principles still in use or have other technologies appeared?

Any help would be greatly appreciated.

+8
udp networking tcp game-engine
source share
1 answer
  • Are the principles applicable to TCP as well as to UDP, and will there be any differences in implementation? I see that entity interpolation should not protect against packet loss, but that's about it.

Although you do not have to deal with packet loss, you will have to deal with longer transit times. TCP is slower than UDP, and you will have to mitigate this in real time. I would think that these principles are still applied at a fundamental level.

  • Can I communicate between server and web browser and vice versa using UDP and Node.js?

Generally speaking, not yet. At least not without some browser extension or plugin - WebSockets uses TCP. However, it is expected that WebRTC (and, more specifically, the PeerConnection API). When data channels are implemented, it may be possible to communicate with UDP.

  • Since the document is older than a decade, are these principles still in use or have other technologies emerged?

I would be very surprised to hear that they are no longer used - the article you quoted is practically required for reading for programmers. The same can be said of new methods, although I have not paid close attention to events in this area for several years.

+2
source share

All Articles