Looking for advice on TCP Server with Unity.

Ollie

Member
Jan 7, 2013
72
11
Hi,
So I'm looking into making a simple multiplayer game with Unity. This would be my first project working with C#, but not my first time using Unity.

I am just looking for some advice really, as I have never made a Server or worked with anything to do with TCP or Websockets ect. before so kind of need somewhere with good advice on where to start.

So my first question is, what should I be using? Should I be using Websockets to transfer my data about player positions, or should I make a TCP Server or something similar?

Also, what language should I be using to do this. I don't want to start a fucking benchmark war like threads similar to this usually do but I'm just looking for a simple answer. Should I be coding this in C#, Javascript or any other language you can think of.

Just bare in mind its not going to be a dedicated server, that all players would connect to, but similar to the system in other games like Minecraft, where you host your own server. So each servers only going to have a small amount of players on at a time, I'm not trying to build some system that can manage 10,000's of players on some MMO scale.

I'm not really looking for any code, so not even sure if this is the right section. But just some suggestions from people that know more about this than me.

Thanks.
 

Jaden

not so active
Aug 24, 2014
886
263
Python.



OR Java (make sure to use STABLE releases).



You can view my implementation of netty 4.1 on GitHub.
 

Ecko

23:37 [autobots] -!- eckostylez [[email protected]]
Nov 25, 2012
1,396
960
Many reasons. TCP was designed for all information sent to arrive at the destination and also for all packets to be in order. In most games this is not needed. This adds unnecessary overhead.
Surely if you were sending packets about player position, you would want them to arrive in order (and with a guarantee that they actually arrive, since UDP does not offer that).
 

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,744
1,326
Depends on what type of game you're making. Habbo, for example uses ONLY the TCP protocol and does just fine.
All that post was saying was the differences between the two.

It wasn't saying UDP should be used for Habbo, (an unmentioned emulator game here or there)

but yea, add onto a general post distinguishing the difference. kek
 

Jaden

not so active
Aug 24, 2014
886
263
All that post was saying was the differences between the two.

It wasn't saying UDP should be used for Habbo, (an unmentioned emulator game here or there)

but yea, add onto a general post distinguishing the difference. kek
They did, at the end, recommend using the UDP protocol for games... after stating the differences.

what is an emulator game
 

M8than

yes
Mar 16, 2012
463
102
Surely if you were sending packets about player position, you would want them to arrive in order (and with a guarantee that they actually arrive, since UDP does not offer that).
Well the problem with TCP is that is sends many more packets to ensure that packets get to the destination and well by the time the packets actually get there if there is an error the information is useless to the client.

The reason habbo uses TCP is because the game doesn't require split second decision making. And also the amount of packets and data transferred is low compared to example the 64 ticks per second of CSGO .
 
Last edited:

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,744
1,326
They did, at the end, recommend using the UDP protocol for games... after stating the differences.

what is an emulator game
Oh, I didn't read until the end.

I just assumed he would recommend TCP because seeing packets in order and ensuring you would get them is kind of important
 

Ollie

Member
Jan 7, 2013
72
11
To be honest, the game isn't a competitive game or a game that would require very very accurate information about each player, and even if it did, its only a test at the moment anyway. It seems like UDP would be a bit more work for something at the moment is not really a considerable gain, as this would be my first time working with something like this.

If anyone else has any other recommendations let me know.

Thanks everyone.
 

M8than

yes
Mar 16, 2012
463
102
To be honest, the game isn't a competitive game or a game that would require very very accurate information about each player, and even if it did, its only a test at the moment anyway. It seems like UDP would be a bit more work for something at the moment is not really a considerable gain, as this would be my first time working with something like this.

If anyone else has any other recommendations let me know.

Thanks everyone.
Theres a reason UDP is used in 99.9% of multiplayer games
 

Users who are viewing this thread

Top