L
L
LiptonOlolo2016-12-30 15:43:40
C++ / C#
LiptonOlolo, 2016-12-30 15:43:40

How does the game data transfer protocol work?

Good afternoon/evening/night.
Interested in the question: how do sockets work in games?
Take the CS:GO game as an example, because over9000 data packets are sent there every second, how are they packed by the client and read by the server?
Does the client pack each package through a new instance of the wrapping class? Does the server read each packet through a new instance of the class to read? Or is it all happening through 1 class?
Please advise.
Thank you.
With the coming you.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
E
Evgeny Shatunov, 2016-12-30
@MarkusD

https://habrahabr.ru/post/209144/
https://habrahabr.ru/post/209524/
https://habrahabr.ru/post/213559/
Originals:
web.archive.org/web/20190328001900/https: //gaffero...
Additional materials:
web.archive.org/web/20190328001900/https://gaffero...
On this occasion, in general, I advise you to read Glenn Fiedler's blog.
There are also handy libraries that answer your other questions by themselves:
https://developers.google.com/protocol-buffers/
https://capnproto.org/

X
xmoonlight, 2016-12-31
@xmoonlight

And you, with the coming!
Here is a good resource and an article in Russian: what and how it works and why.
https://developer.valvesoftware.com/wiki/Source_Mu...

R
Rou1997, 2016-12-31
@Rou1997

CS:GO game, because over9000 data packets are sent there every second
Even a space rocket is unlikely to send over 9,000 "packets" of telemetry every second. :)
Neither the CS:GO client nor the CS:GO server per socket transmits or receives so much, some thousands can be counted only if TCP / UDP segments are considered packets, but this is the OS level, and you are interested in not these packets, but buffers byte[], and if we say to count Berkeley's send() calls per second, there won't be hundreds or even tens.
Actually, you can see the entire TCP stream of the game using a sniffer, but you are not friends with debugging tools, as I remember, so you can add a couple more zeros to the number in your imagination. :)
Likewise.
Yes, in general, the whole game is written in one class, and a new class is created only when the IDE starts producing numbers with an exponent instead of line numbers!
Try to write just a reliable client-server without any payload and get by with 1 class here and there, my first one was just like that and it's terrible, although to whom I ...)))
If only with the upcoming working day, tomorrow I will work, unlike people like you.))))

M
McMike, 2017-06-06
@McMike

Interfaces can only have public methods, that's why it's an interface.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question