Tag Info

New answers tagged

0

Your xyz position isn't likely to be kept as text so what you don't want to do is try to encode it as UTF8. If you don't need to do anything with the coordinates then you should just turn it into a string before encoding, i.e: string pos = GameObject.Find("Object").transform.position.toString(); byte[] data = Encoding.UTF8.GetBytes(pos); Or if you need to ...


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 ...


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 ...


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 ...


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 ...


0

According to your tutorial the fluid movement issue should be dealt with the smooth movement paragraph, which state the following: private float lastSynchronizationTime = 0f; private float syncDelay = 0f; private float syncTime = 0f; private Vector3 syncStartPosition = Vector3.zero; private Vector3 syncEndPosition = Vector3.zero; void ...


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 ...


0

If you're using a byte for Local IDs then create an ID array with 256 slots for each room. When a player enters the room assign their Global ID to the first empty slot in the array and their Local ID can be their position in the array. When they leave just set the array to a reserved Global ID that indicates it's unused. If Global IDs are 128bits a piece the ...


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 ...


0

You could generate a random ID, compare it to the existing used IDs ingame, and if the generated ID matches one of the existing IDs, you restart the process. You keep doing this until you have a unique id. Here is an example in C#: //Lets assume you're using an array named 'idArray' filled the existing IDs Random rand = new Random(); int generatedID = -1; ...


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 ...


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 ...


12

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 ...


-2

Most of RTS game like starcraft / warcraft etc only transmit player input between clients. After the game engine does the simulation with the input received. It's lighter for the network to only send the player's inputs. look at this post : How to implement lockstep model for RTS game?


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, ...



Top 50 recent answers are included