WartaPoirier-corp / tarot

Un petit jeu pour découvrir Rust et Amethyst
4 stars 0 forks source link

Network protocol definition #4

Open elegaanz opened 4 years ago

elegaanz commented 4 years ago

We need to define a network protocol and implement it.

cc @edgarogh

edgarogh commented 4 years ago

I have absolutely no idea of the different "messages" needed, or where is the limit between what the clients and the server handle.

Regarding the packet framing stuff, a Packet enum with serde+bincode might be a good and fast idea if we're going with raw TCP and don't care with debug-ability and self-descriptiveness. It will make retro/forward compatibility harder though, so JSON or RON could work too.

elegaanz commented 4 years ago

Quick summary of what we would need:

So, in summary:

Also, maybe each event should be acknowledged, to make sure all client are in sync? maYbe wE cOuLD uSe a BLoCkhAiN AnD A ConSeNSuS AlgOritHM lIKE RAfT???!! More seriously, if we have a single TCP connection for each event we send, this acknowledgement would be in TCP directly, but this seems to be a poor design to close and re-open a connection every few seconds (and it means NAT traversal or something I guess, because we are sending a request from the server to the client, so definitely: NO). Also, I don't know if TCP can be bidirectional? Like once the client sent something, can it send something else even if the server started responding in the meantime?

Ideally, there should be some kind of encryption. TLS might the be the simplest solution for that.

edgarogh commented 4 years ago

c.f. network branch (very much totally WIP)