I’m exploring the server-client relationship in game development, aiming to understand the necessary information for transmission from the server to the client in a multiplayer game where I’m using a graph data structure as my source of truth. (I don’t know how far I’m going to get, but it seems like a fun idea.)
For example, I’m in the process of constructing a server for a WebGL game, omitting SSR. This setup utilizes WebSockets (TCP) for real-time communication between the server and client. Let’s consider a scenario where a client joins an empty server: the client then sends lightweight data to the server, adding it as a node in the graph {id, {name, color, position}}. In response, the server transmits the graph’s object containing the current state of all players {id, name, color, position} to initialize the client’s game world. Additionally, it broadcasts the details of the new player {id, name, color, position} to all players (if any). However, would this approach be correct and scalable? It seems unsafe and expensive.