Example of use of client-server bevy 0.12.0 chat app with quinnet crate, using the QUIC internet protocol.
Capabilities:
- The server sends message in broadcast to each client.
- When a client writes a message, it communicates with the server which forwards the message to all other clients.
- When a client connects, the server informs all other client that a new user has joined.
- When a client disconnects, the server waits until a timeout, then informs all other clients of the disconnection.
- TODO: When a client reconnects before a timeout, it resumes the previous session.
- When the server disconnects, all client disconnects too after a timeout with a lost connection error.
Useful as a baseline to make client-server multiplayer games.
- It is a client-server template. A peer to peer one is also possible.
- Write a system that starts the connection, with 0.0.0.0 to accept requests from everyone and a certificate (self-signed it is ok when starting)
- Define which message should be sent by the server:
- for example the server sends ClientDisconnected, ClientConnected, BroadcastChat and InitClient messages
- Write a system that handles the events received from the client
- Write a system that handles the events generated by the server
- Decide whether to create a server UI app, or it is sufficient a background process, like in this case.
- Write a system that starts the connection, with 0.0.0.0 to accept requests from everyone and with a certificate verification (skip it initially)
- Define which message should be sent by the client:
- For example clients send Join, Chat and Disconnect messages
- Write a system that starts the connection
- Eventually write a system that initializes the game
- Write a system that handles the event from the server
- Write a system that sends client message to the server
- Write a system that will run on app exit, and sends a ClientDisconnected message to the server