TCPNoDelay Tutorial

From NovaRO: Wiki
Jump to: navigation, search

Hello fellow players!

Welcome to this short Tutorial on TCPNoDelay, which can improve your games responsiveness.

If you just wanna set it up, go to the Setup Guide directly.

If you are interested what we actually do with this, just read on.

Elaboration

What is Ping

Since NovaRo is located in Canada, which is half a world away for most users, we all suffer from a medium to high ping.

Every time you send a command message to the server (like drinking a potion, walking to a spot, or using a skill) it takes a while until it actually reaches the server. After that, it takes the same amount of time for the answer to get back to your computer, telling your Ragnarok:

Okay, you used a potion, this is what happened! HP increased

Those Messages and Answers are called Packets. The time it takes until you see the action you did is called Ping, or Latency and is measured in milliseconds.

You can determine your ping by clicking on Start and Run, entering cmd and pressing enter. In the upcoming window, just type ping www.novaragnarok.com and hit enter again.

It should output something similar to

C:\Users\Generic> ping www.novaragnarok.com
PING www.novaragnarok.com(149.56.25.161) 32 data bytes
    32 bytes from 149.56.25.161: bytes=32 time=162 ms ttl=58
    32 bytes from 149.56.25.161: bytes=32 time=177 ms ttl=58
    32 bytes from 149.56.25.161: bytes=32 time=171 ms ttl=58
    32 bytes from 149.56.25.161: bytes=32 time=173 ms ttl=58

--- www.novaragnarok.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, average time 167ms

The bold numbers are your actual ping.

So, 1000ms Ping tell you, it takes a whole second until you actually see what you did (but the server already got your pakets after 0.5 seconds).

About the Ping itself you can't do too much, since it depends on your internet and the distance from servers. If it gets higher than 100ms you start to experience some delay for everything you do, especially if playing a game like Ragnarok.

Nagles Algorithm and TCPNoDelay

Now, starting with Windows Vista, Microsoft has introduced a mechanism to stabilize your connection, and to reduce traffic on your connection.

This mechanism is called Nagles Algorithm. More detail on this can be read on https://support.microsoft.com/de-de/help/235624/fix-tcp-ip-nagle-algorithm-for-microsoft-message-queue-server-can-be-d

It makes sure, that for every packet you send, your computer waits for an answer. If there is no answer within time, the packet is repeated until it gets an "ok" from the server.

For most stuff like websites and sending emails this is good, because you get less random "error loading image" and such, but for playing games it bad:

Look at the example above, with Nagles algorithm you will have to wait for the answer, until you can send any other action to the server. So in Theory with 1000ms Ping, you could only use one potion per second, or use only one skill, or send one walk click. And even worse: you can only do one single action at all in that time - no skill using, potion drinking and walking in the same second!

Well you most likely don't have 1000ms ping, but even with 200ms you are already limited to 5 actions per second.

That is bad, it feels unresponsive, and you cannot react in time, because your actions get "stacked up" on your computer.

This chart explains the difference between Nagle on and off:

TCPNoDelay Nagle.png

The algorithm itself can be turned off by a setting known as TCPNoDelay. Sadly there is no "easy" GUI for that, you actually have to use the windows registry editor to change this setting. Good thing is, you mostly can't do harm. If you feel to unsure about it, you may ask a friend to help you though.

Be awarem this can increase loading errors for websites as told before, but if your connection in general is stable, you won't have any issues.

TcpAckFrequency and what it does

Together with disabling Nagle it is also recommended to reduce TcpAckFrequency to 1.

Think of your network as of a guy who brings your packets to the server. TcpAckFrequency tells him, how many packets he should collect from you until he starts walking. If you set this to any value higher than 1, he will wait until you pile up that amount.

With a value of 5, he would wait until you actually did 5 actions of any kind (like clicking, potion use etc.) in Ragnarok, before even starting to send them to the server.

So, obviously, set this to 1, so every single packet gets sent as soon as it is there.

Let's get started

Setup Guide for disabling Nagles Algorithm

First of all, you do all of this at your own risk!

No responsibility taken by my side if it has any bad side effects on your computer!

  1. click Start, click run and type in regedit If you are on Windows 10, just click Start and type regedit right away, then press enter.
  2. You should get the windows registry editor.
    TCPNoDelay regedit1.png
  3. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces On Windows 10 you can simply copy & paste the path into the search bar on top.
  4. Find the network device, that is your local network adapter. It will have an IP address like 192.168.?.?
    TCPNoDelay regedit2.png
  5. Create two new entries: right click on the right side, click new > DWORD and create TCPNoDelay and TcpAckFrequency If one already exist, just do step 6 for it. Make sure you got the capitalization right, it really matters. tcpnodelay won't work!
  6. Double click both new entries (or right click > change), and set the value to 1 (hexadecimal) Now they should both have the value REG_DWORD 0x000001
  7. Restart your computer. You can actually deactivate and reactivate your networking adapter, but that takes another tutorial if you don't know how to do. So restarting is the easy way.
  8. Done. Now Nagles algorithm should be disabled.

To revert this, simply delete both TCPNoDelay and TcpAckFrequency entries from the registry, but why would you ever want to revert this?

Conclusion

Depending on your ping, you should feel a much more responsive gameplay, when playing on NovaRo!

You will still have the delay from your ping, but at least you can now spam skills faster and react to Bosses hurting you by spamming your potions!

Have Fun ingame!