Currently the server ends every tick by calling emit('world', game_state); eg, the global world state is broadcast to all clients. There are a few problem with this, but the most immediate ones are:
- every client will know everything about the world! (good luck having a "hide" ability with this model)
- the client needs to know how to translate between "world space" coordinates and "view space" and "screen space" coordinates
Instead of broadcasting global state, entities should have a view range (this can be a global constant to begin with, but could eventually be adjustable per entity). Each frame, instead of emitting a global message, each client would have everything within their view range sent to them
Currently the server ends every tick by calling
emit('world', game_state); eg, the global world state is broadcast to all clients. There are a few problem with this, but the most immediate ones are:Instead of broadcasting global state, entities should have a
view range(this can be a global constant to begin with, but could eventually be adjustable per entity). Each frame, instead of emitting a global message, each client would have everything within theirview rangesent to them