0
\$\begingroup\$

I have a voxel game in which you can run on blocks (chunks), jump and set/delete blocks. I want to write an asynchronous TCP server for it and choose boost asio as the network library. I have two commands, async_write_some and async_read_some, through them I can transfer the data structure to the JSON format.

How to organize the exchange of messages (packets?) between the server and the client, so that several people can play on the server at the same time?

For example, if you start from the server: should the client send a message and then wait for a response or should it continuously send messages and will a queue of them be made on the server? The same question about the client->server. If the client needs some kind of information from the server, then in what form should this command be sent? In the form of the word "give information about the players on the server" or what?

p.s. Do I need to compress the data being sent?

\$\endgroup\$
  • \$\begingroup\$ Possible duplicate of What data to exchange in multiplayer real time games? \$\endgroup\$ – zimspy Jan 25 at 10:48
  • \$\begingroup\$ @zimspy, Thanks for the link, part of the issue is resolved, but it does not say how exactly the server and the client should exchange these messages. \$\endgroup\$ – De74ttempt Jan 25 at 11:15
  • \$\begingroup\$ After you get the basics working you will want to compress the data, bandwidth costs you money! This question is very broad, I suggest reading some game networking library documentation to get a feel for all the problems those libraries solve, then you'll better know what to ask specifically while you work on your own library. \$\endgroup\$ – Patrick Hughes Jan 25 at 19:14
  • \$\begingroup\$ @PatrickHughes, thanks for the answer. Don't consider me lazy, but if you are familiar with it, what do you think is a good online library for games? \$\endgroup\$ – De74ttempt Jan 25 at 23:57
  • \$\begingroup\$ This isn't authoritative, but it is a good place to start and one level up at the site are discussions on UDP vs TCP/IP and compression. gafferongames.com/post/… \$\endgroup\$ – Patrick Hughes Jan 26 at 0:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.