I've been reading the Valve article on multi-player networking which has been adapted from Yahn Bernier's 2001 paper called Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization. I'm making a realtime multi-player game using a node.js server connected to clients through socket.io and I have a few questions regarding the principles detailed below:
Entity Interpolation
[Interpolation] prevents the jittery motion this would ordinarily lead to by buffering server updates then playing them back with the gaps smoothly interpolated between. It can also protect against glitches caused by packet loss.
Client-Side Prediction
Prediction is the notion of the client predicting the effects of the local player's actions without waiting for the server to confirm them. An entity's predicted state is tested against server commands as they arrive until either a match or a mis-match is detected.
Lag Compensation
Lag compensation is the notion of the server using a player's latency to rewind time when processing [user input], in order to see what the player saw when the command was sent. In combination with prediction, lag compensation can help to combat network latency to the point of almost eliminating it from the perspective of an attacker.
Do the principles apply to TCP as they do to UDP and would there be any differences in implementation? I can see that the entity interpolation would not need to protect against packet loss but thats about it.
Can I even communicate between a server and web-browser and vice-versa using UDP and Node.js?
Since the paper is over a decade old are these principles still in use or has other technology appeared?
Any help would be much appreciated.
UDP is less reliable than TCP, but is much simpler. UDP is used for situations where some data loss is acceptable, like live video/audio, or where speed is a critical factor like online gaming. While UDP is similar to TCP in that it's used to send and receive data online, there are a couple of key differences.
The two most common protocols are TCP (transmission control protocol) and UDP (user datagram protocol).
In a real-time match, the players are connected to each other simultaneously in a single game session where they exchange data messages. This form of match is suitable for implementing any type of game that requires live participation.
User datagram protocol (UDP) is defined as a communication protocol that is used for time-critical data transmissions such as DNS lookups, online gaming, and video streaming.
Although you won't have to deal with packet loss, you will have to deal with longer transit times. TCP is slower than UDP and you'll have to mitigate that in realtime multiplayer. I would think that these principles still apply at a fundamental level.
Generally speaking, not yet. At least not without some form of browser extension or plugin - WebSockets use TCP. That said, WebRTC (and more specifically, the PeerConnection API) is coming. When data channels are implemented, UDP communications should, in theory, be possible.
I'd be very surprised to hear that they're no longer in use - the article you've cited is practically required reading for game programmers. Ditto for new techniques not appearing, though I haven't been paying close attention to developments in this area for several years now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With