Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - unmaker

Pages: [1]
1
TNet 3 Support / .NET Socket performance
« on: June 02, 2015, 03:38:53 AM »
Hello everyone,

I am creating a deterministic lock-step server for my mobile App. All my server does is take requests from players and sends it to all other players connected in the same room. No game logic on server or anything.

While determining how many players my server can handle by benchmarking some areas of the server. I found something that is really disappointing..
 
It turns out that it is really expensive to send a packet. On my server that is running on DigitalOcean, sending one packet takes a whooping 1600 ticks! this seems incredibly expensive.

I thought it may be because of running the server on Linux through mono. So I tried benchmarking on my windows.  It takes roughly 800 ticks to send just one packet.. That is still expensive if you are planning to have the few hundred players on one server.

For example, if it takes 1600 tick to send a packet and you send a packet 30 times a second(which means sending a packet every 33.33 milliseconds) If you do the math: 33.33 milliseconds = 333300 ticks. 333300/1600 = 208.That means you can only have about 200 players connected at the same time if you want to make sure to send an update every 33.33 milliseconds.

This is a little disappointing for server that all it does is relay the packets among all other players.

I wondering if you guys can help me by posting how many ticks it takes to send a packet on your server. You can easily check using C# stopwatch. for example this is how i benchmark mined.

  1.  
  2.  
  3. long start = System.Diagnostics.Stopwatch.GetTimestamp();
  4.  
  5.    // If it's the first datagram, begin the sending process
  6.                     mSocket.BeginSendTo(buffer.buffer, buffer.position, buffer.size,
  7.                         SocketFlags.None, ip, OnSend, null);
  8.  
  9. Console.WriteLine("Send time: " + (System.Diagnostics.Stopwatch.GetTimestamp() - start));
  10.  
  11.  

 Also please state what kind of server and providing you have.

Thank you every much for reading this
 

2
TNet 3 Support / UDP not working properly
« on: December 09, 2014, 09:38:07 PM »
I have a strange problem with TNet where my router doesn't seem to send or receive UDP packets.

This is really frustrating, I spent a week trying to get this to work, doing a lot of testing and etc... Ultimately, it came down to my router not being able to use UDP the way it is implemented in TNet.

I am making a somewhat 2.5D platform-er racing game where using UDP for quick position update is important, but can't get the damn SendQuickly to work. I have tried using only TCP, but even with noDelay = true; The movement is still jittery.

So, I started out with a new set up and decided to test the example3 scene that came with the package. After running two instances on my machine(connecting via my external IP) and using a program to track packets sent/received on my network. It showed that only TCP is being sent/received and no UDP at all. 

However, It shows canUseUDP  true on both clients and I have pretty much completely turned off my firewall. I am using the latest version of TNet.. the server message states 3 UPnP ports openedsuccessfully.. I have tried turning on and off mutlicasting - no luck there. I tried assigning my interface manually
  1. UdpProtocol.defaultNetworkInterface = new IPAddress(new byte[]{192, 168,0, 100});
no luck there...

I thought maybe there is a problem with looping back to my external IP, so I signed up for a free amazon ec2 micro... tried running the server there.. with all ports opened.. firewall off andddd still... Only TCP packets being sent with example 3, no UDP.

But here is the strange thing... after attempting many times of running server on amazon ec2 and connecting to it... there few times that it DID send UDP packets instead of TCP :0 As a result, the boxes wee moving much more smoother. But once closing the client connection and then reconnecting.. it goes back to TCP...

Finally I tried disconnecting my cable from my router and plugged it directly into the modem anddd.. what you know.. it worked! - it sends/receives UDP packets... Even when connecting to my server on amazon, it was using UDP - the boxes were moving much more smoother.

Furthermore, I tried running the server on my machine again WITH router, but this time connecting both clients through localhost(127.0.0.1) and yeppp that worked as well...

So, the problem seems to be that my router(DIR-857) is not compatible with how UDP is implemented in TNet.  This is a fairly expensive router and I have had no problem with other games online such as Quake.. CS:GO, HON, dota, and many other games...

I seen other people that have reported the same issue. I am really hoping there is a way to get UDP work because there is really not much point in releasing a game if it only works on some routers. I really like TNet and do not want to switch to another network as I did with photon.

If anyone has any suggestions, or perhaps that can point me to a direction would be much appreciated - Thank you!


 












Pages: [1]