Closed alimoeeny closed 7 years ago
To give a good answer I guess I'd need more context, but I can tell you how I solved it in my multiplayer games (synchronous realtime multiplayer): For sending the state from the server to the clients we designed a small and efficient custom binary protocol based on UDP to keep package size as small as possible. Clients receive the packages, deserialize them and eventually create / modify entities and components.
Changes on the client are serialized to the custom binary format and sent to the server as command (input)
The server simulates the game, the clients display it. For a smooth UX, clients have prediction systems to feel more responsive, meaning, you see your own inputs before confirmed by the server.
If your game is not a synchronous realtime multiplayer, maybe @mzaks or @cloudjubei have more insights
Thanks @sschmid , Any chance you've open sourced any of your udp protocol and serializer/deserializer ? Any change it can become part of Entitas?
Yes, I've open sourced it.
NUdpKit: https://github.com/wooga/NUdpKit Erlang backend: https://github.com/odo/talk
It's pretty advanced stuff, I hope the readme helps. This is the basic design of a package
+---------+------------+-------+------------------+-------+--------------+---------+--------------+--------+
| 8 Bit | 64Bit | 32Bit | 32Bit | 32Bit | 32Bit | 8Bit | 8Bit | Rest |
+---------+------------|-------|------------------|-------|--------------|---------|--------------|--------+
|Signature| ResourceId | SeqNr | Equivalent SeqNr | Ack | Ack Bitfield | Command | Compression |Payload |
+---------+------------+-------+------------------+-------+--------------+---------+--------------+--------+
You are the best, thanks, I guess the wooga/NUdpKit is private :( But thanks again, odo/talk might be exactly what I was looking for, I am glad I have not had time to try to write one myself, [reposted to make sure you see it, I posted it at the same time you posted your last message and it got confusing]
Oh, true... I see what I can do about the private repo... Some more context for to decide if it sth you need: It was designed for: synchronous multiplayer authority on the server (simulation on the server) clients send inputs (commands) works on mobile with Edge / 3G, switching from Wifi to Network etc. reliable udp with package tracking for resend (ack bitfield tracks last 32 packackes) udp with tcp characteristic (ack for connect, deconnect) optional payload comression (game state)
It is too good to be true :D
I am doing a mobile VR asymmetric synchronous multiplayer (a therapist "plays" with a kid http://floreotech.com ),
I understand if you cannot make it public, but if you can I for one would appreciate it very very much.
@sschmid btw just looked at the package design. 8bit signature makes the design dangerous as it misaligned the whole buffer. It has to cut of by user or it can lead to crashes on some systems. I guess it is not important any more, but just saying if someone wants to take it as a reference.
@mzaks what would be your best approach for entity-sync asyncronously...i currently use a publish/subscribe system but its a lot of work to react on all changes of different components...i'm just looking for a more generic approach...
I am trying to understand how to use Entitas in a multiplayer / Unity-networking game.
I can imagine for the animation synchronization and movement of objects and such, one could and should use the Unity networking facilities, but what about the state/Data?
Is there a way to synchronize components (data) over the network? What about systems? Is there a way to have a Pool that is synchronized?
Does it even make sense to do so?