Network Protocol

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
User avatar
Haimi
Posts: 85
Joined: 2011-11-23, 09:28

Network Protocol

Post by Haimi » 2011-12-05, 14:00

Hi @all,

I have 2 questions about the networking implementation and usage:
1. Is there a documentation for the Networking protocol and System according to sent data, asynchronous commands etc.
2. Is it possible to use the implemented networking features with my own protocol? We defines our own protocol or exactly our purposes, so we would really like to use it here :lol:

Greetings,
Haimi
Project Status: Code architecture definition
6 Programmers, 1 Photographer, 1 Architect, 1 Game designer
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Network Protocol

Post by Carsten » 2011-12-05, 22:10

Hi Haimi,
1. Is there a documentation for the Networking protocol and System according to sent data, asynchronous commands etc.
The current network protocol is, at this time, not very well documented.
Probably the best (most accurate and most up-to-date) documentation is the source code that implements it.
Depending on what exactly you want to know, I can however browse my archives and see what I can come up with.
2. Is it possible to use the implemented networking features with my own protocol? We defines our own protocol or exactly our purposes, so we would really like to use it here :lol:
I'm not entirely sure if I understand this question: Do you want to replace the existing Cafu network protocol with your own?
That might work, but I doubt that it's easy, because the current implementation has many features (delta compression, client prediction, reliable and unreliable message queues) that are hard to replace (while keeping the playing experience).
What exactly do you want to do?

Generally, the current network protocol was written years ago, and from todays point of view it is somewhat awkward and complicated. Oh, but it works very well. ;-)
My "secret" plan though is to rewrite it one day, employing SCTP as a base, improving the code design (e.g. to make the game code much cleaner), and many other things...
Best regards,
Carsten
User avatar
Haimi
Posts: 85
Joined: 2011-11-23, 09:28

Re: Network Protocol

Post by Haimi » 2011-12-14, 11:40

Hi Carsten, thanks for your information.
Well, yes, I am thinking about changing the existing network protocol. I am sure that your implementation might be a lot more secure, but our main goal is to keep it very small and easy to parse for the clients, so we made an RPC-like JSON Protocol.
If it is really that complicated, is it possible to use your protocol as transport and just send the JSON-Data in the data body?
Project Status: Code architecture definition
6 Programmers, 1 Photographer, 1 Architect, 1 Game designer
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Network Protocol

Post by Carsten » 2011-12-17, 17:51

Hi Haimi,

in the implemented protocol, the contents of the network messages that the Cafu clients and server exchange are binary coded. At that level, it's a relatively simple protocol, as typically the first byte in the message indicates the type of the message, and the following bytes describe the contents.
Of course, it would be possible to replace this part of the messages, e.g. expressing the same meaning with JSON string messages.
Note however that this would make the protocol more verbose, and neither smaller nor simpler. You'd just express the same with a different sequence of bytes.

The higher level of the protocol is concerned with exactly when and how the messages are sent from one station to the other, so that reliable packets that possibly got lost in transit are re-sent, etc. This is defined in class GameProtocol1T that you can find at http://trac.cafu.de/browser/cafu/trunk/Libs/Network
Rewriting this layer of the protocol or tunneling it through another connection is probably doable as well, at the risk of introducing latency or inadvertently changing other characteristics of the network communication.

Hope this helps. You're best reference is really the source code, as indicated in my previous message. :up:
Best regards,
Carsten
User avatar
Haimi
Posts: 85
Joined: 2011-11-23, 09:28

Re: Network Protocol

Post by Haimi » 2011-12-20, 09:04

Thanks for the detailed description. I think we will try to use the internal protocol instead :D
Project Status: Code architecture definition
6 Programmers, 1 Photographer, 1 Architect, 1 Game designer
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest