I am thinking about creating a networking game.
The game should be a 2D platform shooter, created with Libgdx and Box2D.
For the networking I planed following structure:
- Server and client are 2 programms
- Server handles ALL the ingame logic
- Client sends key/mouse inputs
- Server reacts on those and updates the whole level
- Server sends those updates (if possible 45 times per second so no client side interpolation needed)
- Client gets updates and updates its local level/world by using the received updates
- Client draws the things in its
view frustum
First question: What do you think about this structure?
Next question: 45 times per second could be a lot of data upload from the serverside, if there are a few players which shoot a lot of bullets (player and bullet positions need to be send).
To limit the upload needed i thought about using view frustum culling
and send only the data/updates the client will actually see.
Now i have seen the KryoNet
method sendToAllTCP
and wondered, if this method is somehow more efficient and could somehow upload the data only once, instead of once per client.
I am not that experienced with networking and i don't really think that it is possible to have 1 upload for more then one client. But to be sure i ask.
So is it more efficient to send every update of the level with sendToAllTCP
or is it more efficient to send once for every client and then only things they can see?