Gaming | Target 60ms by delaying packets?

I've previously read that the netcode for a lot of shooters is designed to level the playing field and actually 'punishes' players for having too low a ping. The optimum ping is, apparently, 60ms.

I have 1 Gbps fibre and my ping shows as 2ms when performing ping tests.

I'm using a Raspberry Pi 4 2GB.

Is it possible for the router to store and forward packets in an attempt to hit a target ping?

For example, Call of Duty uses port 3074. The connection is outbound from the server towards the player, so for the inbound connection source port = random and destination port = 3074. For the outbound connection source port = 3074 and destination port = random

The router could detect the ping for packets with source/destination = 3074 and then delay the packets for x ms to target a ping of 60ms.

The total data involved is very small, so it wouldn't require a large amount of RAM to achieve.

What do you think?

I have seen a similar question with some people answering to it in following topic:

I know, it is a long read, but I am sure you will find something. Also, if your Game sets the ping to 60 ms, then that's more on the higher end of the range that people commonly refer to as lagg free (gaming) latency. 60 ms on average means, there will be laggs during gameplay. At least that's my past experience, when wifi is involved. I personally would aim for something like 20 - 40 ms, if you think your ping is way too low, but even then, i would first try out other methods to reduce lagg, like using QoS to eliminate bufferbloat and other stuff.

Haven't tried it myself but over in this thread "netem" was brought up a couple of times.
As far as I can tell it's not exactly what you're looking for as it seems it can only add a static delay and you seem to be looking for something that dynamically adjusts the added delay but it might be worth trying.

I'd caution you though to

  1. don't go too far the rabbit hole if you look into the thread I linked and
  2. be mindfull that there's a thin line between "leveling the playing field yourself" and cheating.

Also keep in mind that the ping that Ookla shows varies a lot from the ping to actual game servers like https://gameserverping.com/ or even better yet in-game ping monitors will show.
In my case Ookla will pick the server fastet/closest to my place and show 8/12/8 idle/down/up while the closest game servers will typically have a ping between 40-70ms.
So you might not even have to adjust anything.

I'm using SQM QoS and I don't have 'lag' in terms of bullet registration. It is more to do with being in a different time zone to the opponent. The kill cam shows something completely different to what I experienced.

I think this is due to the 'lag compensation' built into the game. It gives those people with higher pings a leg up vs those with lower pings.

As you can see, my ping is very low.

Thanks. I'll take a look at netem.

Will this replace SQM QoS? I only want to match specific traffic (port 3074) and I don't want that traffic to experience buffer bloat. I'm just trying to experiment with delay.

Sorry, can't answer that question. As previously stated I haven't tried it myself.
I merely set up Cake for my pedestrian Docsis3.0 connection and called it a day.

From what you can find on the forum it seems that it's probably not possible to combine SQM and netem.
But @dlakelan has a script with lots of bells and whistles including support for netem:

I'd be curious as to what you end up using and if you find that the hypothesis of modern games going overboard with their 'lag compensation' on low latency connections holds up.
So please let us know and good luck.

I've been wondering why it seems once I increase in rankings that anamolies occur (e.g. lagging, freezing, rewinding position to where I already ran, etc.). Now I realize that people must be causing packets to drop on their routers.

I didn't realize this was still a "thing" gamers did. Back in the day, systems would ban people they discovered doing things like that.

This is vague and and depends on version/console. For example, in some versios - another user is the "server".

If you were the server, you'd be describing cheating.

This sounds like you need to join less laggy games.

1 Like

So the cleanest is to built a bump-in-the-wire kind of device that you put between your gaming machine (be it PC or console) and your main router, run netem, and only netem on that device using two different ethernetports, keep running SQM on the primary router. That way your increased delay is only going to affect the gaming device(s) and will not interfere with SQM (there were some reports in the past of netem not working well with some other qdiscs, not sure that was ever true or has been resolved since then).

1 Like

Another way would be to use Policy based routing and only send specific traffic to a virtual interface where you apply netem on.
In my example I used a vpn + policy routing and only routed gaming traffic of my pc (udp 3074) over the vpn interface (tun2) where I applied netem on. This was actually working pretty well.

A better/more elegant way would be to use some sort of virtual interface between your lan and wan to apply netem on.

1 Like

That assumes that the router has the reserves for netem delay (which takes a bit of RAM, after all you need to be able to store X ms worth of packets at the required link speed), and that the issues with combining netem with other qdiscs are truly solved.

This seems doable. Personally I would likely still go the bump-in-the-wire route, why complicate things more than necessary :wink: but unlike you I never actually used netem delay, since I never needed it so you offer first hand experience which IMHO trumps my pure opinion ;).

That's an interesting suggestion.

I have an OpenWrt router that I'm using as a WAP. I guess I could:

  • Route outbound port 3074 traffic to that router on one VLAN.
  • Apply the delay via Netum.
  • Route the traffic back to the WAN router via another VLAN.
  • Route via WAN.

It might not be perfect, but might be good for testing purposes.

My PC connects to my WAN router via eth0.1. Would that be suitable?

I'm using a Raspberry Pi 4, so I think I have enough CPU and RAM to run netum on my WAN router.

you can also use CBQ with 2 or more classes (or HFSC with multiple classes), and put netem on a specific class, and then filter all your game traffic to that class. You can combine this with cake by putting cake on the other class.

For inbound traffic you can do a similar thing in an IFB.

My script uses a specific HFSC class to handle gaming traffic tagged by DSCP and you can select netem for that class if you want. I don't think anyone who's tried it thinks it improves anything.

How would I implement that?

The easiest thing is to try out my script, use the nftables version:

Read the install instructions, select netem as the game qdisc, try it out.

2 Likes

Of course, you are right. I have a mini pc with a j4125 and 8 GB RAM so no issues here. Op's specs also seem sufficient.

The Op never told us if he plays on console or pc.
If he plays on console I think your bump-in-a-wire solution is a good idea but if he is playing on pc and also uses the pc for other things I guess it would be better and more flexible to just only apply netem on the specific ports his game uses other than also affecting web browsing, streaming etc… I mean this is also doable with your solution but I guess it would be easier to manage on one device.

You mean would this be suitable to apply netem on? Is eth0.1 your lan port and eth1 your wan?

1 Like

Sorry for being dumb, I’m interested in doing this as being a gamer it’s so frustrating to Have a good ping, what is bump-in-the-wire? main router SQM - Netem Router - Console only on the Netduma router?

'Bump in the wire' is short hand for a device that does a single function (here running netem) ideally requiring no/little maintenance. While I never tried myself, I have been told that running netem in addition to other qdiscs likely causes issues, hence the advice to run netem on a dedicated machine..,.

Hello, @Hudra do you have a thread or can you explain to me how to apply one of those 2 methods to add more to my connection (by the way, I play on a console)

This isn't remotely true. First it entirely depends on the netcode of the game, if you have a specific game that you know does that then post it. Most multiplayer games would never "punish" players for low pings.

Look at new games that use high tickrates like CS2 (>64Hz + subtick) and Valorant (128Hz). MW2 was shown to be around 60Hz tick. The lower your latency the better and peakers advantage is real.

You want the lowest ping possible that's why people turn to OpenWrt on slower/heavily loaded connections for SQM cake.