I'm trying to implement a basic client-server setup for my game. But what confused me was how I would approach sending updates.
Would I do:
- Server has a tickrate, let's say at 20ms. Each tick would sends an
UDP
package to EVERY connection with the current game state and it's entities.
OR
- Client request an update from the server and the server respond with the update. When the client receives it, it asks for another update and so on.
Pro-cons:
- Con: Sends a package every tickrate and in this case 20ms. What if a clients broadband connection has a triptime at 300ms? Wouldn't that overload that client and his broadband? Pro: Consistent and fast?
- Con: Requesting is done via
TCP
which is slower because the client has to wait before sending the next request. Pro: no overload?
- Con: Requesting is done via
So my question would be, what I'm I missing and how would I approach sending updates about the current game state?
Cheers!