Tag Info

Hot answers tagged

26

A TCP segment has quite a lot of overhead. When you send a 10 byte message with one TCP packet you actually send: 16 bytes of IPv4 header (will increase to 40 byte when IPv6 becomes common) 16 bytes of TCP header 10 bytes of payload additional overhead for the data-link and physical layer protocols used resulting in 42 bytes of traffic for transporting ...


13

There is no reason to communicate over the network when the player selects units, because in most games just selecting a unit has no game-mechanical consequences. So this is an information which isn't relevant to the server or to the other players. But what would be important is when the player gives a command to one or more units. When issuing a ...


10

One large one (within reason) is better. As you said, packet loss is the main reason. Packets are generally sent in frames of a fixed size, so it is better to take up one frame with a big message than 10 frames with 10 small ones. However with standard TCP, this isn't really an issue, unless you disable it. (It is called Nagle's algorithm, and for games ...


6

All the previous answers are incorrect. In practice, it doesn't matter whether you issue one long send() call or several small send() calls. As Phillip states, a TCP segment has some overhead, but as an application programmer, you have no control over how segments are generated. In simple terms: One send() call does not necessarily translate to one TCP ...


3

Many small packages is fine. In fact, if you are worried about TCP overhead, just insert a bufferstream that collect up to 1500 chars (or whatever your TCP MTUs is, best to request it dynamically), and deal with the problem in one place. Doing so spares you the overhead of ~40 bytes for every extra package you would otherwise have created. That said, it's ...


2

Although being a neophyte to network programming myself, I would like to share my limited experience by adding a few points: TCP does imply an overhead - you must measure the relevant statistics UDP is the de facto solution for networked gaming scenarios, but all implementations that rely on it have an extra, CPU-side algorithm to account for packets being ...


2

Unity will invoke the RPC method on ALL methods with that name that appear in any of the game object's components. Yes, you could do that, I personally wouldn't recommend it. It will add unneeded dependencies in your project, and pretty much destroys the point OOP. Right now the RPC scope thing is really quite terrible. Imagine if you have an RPC method in ...


1

I'm not used to UDK, by the way I'll try to answer your question at just a theoretical level. I'm trying to implement network games in a project of mine, and found out how to let client ping check servers without actually joining games. Also, this is an intuition from Halo:CE network code. Let's suppose the central server browser has a list of servers, ...


1

It's not necessary in TCP as, as @congusbongus said, TCP can automatically detect disconnects. But doing it your self has the extra advantage of being able to know how much lag there is on the server, as well as being able to give advanced warning of the problem while TCP is still trying to reconnect. All in all, I'd say add pings, they're not difficult to ...


1

There is no need to ping if you are using TCP. TCP has built in mechanisms for detecting disconnects, congestion, or easily deriving latency. To elaborate: the Keep Alive feature sends small packets during idle times to detect disconnections. The TCP header contains sequence numbers and ACK numbers that exactly correspond to each other, so you can measure ...


1

Okay so I played around with the ID assignments a bit and came up with this: After every player is assigned and ID, the number gets put in a list called TakenIDs. A for loop checks which number isn't contained in TakenIDs. As soon as a viable number pops up, the for loop is broken and that number is returned then added to TakenIDs. When a player leaves, his ...


1

If you're using a server, even if only for matchmaking, just assign them one. You can use a counter as they sign up for accounts. Alternately you could use a random number and check for duplicates. Or use their screen name as a unique id. You can use a hash of their e-mail address or some other unique data. Microsoft came up with a system of generating ...



Only top voted, non community-wiki answers of a minimum length are eligible