Wanting to know the best way to send data TCP UDP

My game is fully ready to accept connections via TCP and UDP and i can send data back and forth but i have a few questions on how i should package my data.

  1. What is the most reliable way to send a one time packet sending players information that consists of; Name, SessionID, IP
  2. Whats the best way to pack a movement request? in a array or some other means?
  1. Aren’t you making a huge multiplayer game? You should know what protocol is more reliable by now if you are trying to make a game of that scale. You should use TCP to send important data that must be transmitted. UDP can be used, but you have to write your own software layer on top of it to ensure packets are actually sent.
  2. What does a movement request consist of? Why are you requesting a movement? The client should send movement updates to the server, which in turn transmits the new player position to all other connected clients. The server is dumb; it should transmit packets and that’s about it. There is no such thing as a “movement request”, so you’ll have to provide more information before anyone can provide you with a helpful answer.

I beleve i worded it wrong i mean the best format/data type to send my movement info with as little data as posible

I believe that UDP packet headers are smaller (If I’m wrong please tell me).

Well, what does your movement info consist of? How do you move your objects in game? I would say use two booleans to represent the four cardinal directions. Maybe a byte? It’s up to you to test and debug it. If you are having performance issues, then figure out another way. Right now there is not much I can tell you because I don’t know how your program is set up.

If the coordinates never reach 65000 (approx.), then I would say do this:

1 byte for direction
2 integers for x and y

(8 + 1 + 4 + 4) = 17 bytes of data

otherwise I would do this:

1 byte for direction
2 longs for x and y

(8 + 1 + 8 + 8 ) = 25 bytes of data

I wouldn’t send over the position every update cycle. What I would do is every time the client moves the player, send a position update packet that contains a byte to represent in which direction the player moved. Then, every couple of frames, send over a position update packet that also includes the exact position of that player. You may need to interpolate the position of the player on the other client’s screens if a update position packet is dropped, but that should be fairly easy.

The game as it stands has the potential to be 3,100,000,000 - -3,100,000,000 both on the x and y

If these numbers are in meters, your gameworld is 3’100’000 kilometers in diameter… and that may just be a little bit insane.

That it is, but im aiming to get my game fully freerome (only limit = storage space xD)

Don’t free-roam games like runescape have multiple worlds so that worlds don’t get that (absurdly) large? And you can scale up coordinates so 1 would be like 300 pixels or so.

Runescape has a pre made map, im wanting to break the boundaries and allow it to make quests, towns, citys on the fly

Well you could give every chunk new coordinates, so that you send a chunk as two integers and then the actual coordinates as 2 doubles