detect game lag in lobby

An idea I have is to create a little visual simulation within the lobby.

idea.png

Each client sends commands to move the coloured circle up and down to the host, once a command is sent the player's coloured circle start moving either down or up. This would be like all players moving their acu around. This will simulate how smooth the game will be before it starts.

Never Fear, A Geek is Here!

I'm open for experimenting with it.

A work of art is never finished, merely abandoned

Maybe we could test with a modified pong game in lua
here is an example i found
https://gist.github.com/daem-on/d19443e68e6adb2e64849e224c6d27d7
And have the clients send movements to the host
I am not sure if this is the correct approach to reproduce players lagging but it could be a start

Never Fear, A Geek is Here!

I like the idea of the simple animation you just send - it being (not) smooth may be a good indicator

A work of art is never finished, merely abandoned

@thecore did some quick testing. We can make it run at say 10 fps, and then see what happens. Issue is the code of the lobby - almost any change I make ends up in technical issues due to limitation of the language (upvalue limit). It is really that bad with the state of the lobby code

A work of art is never finished, merely abandoned

Creating a client-server pong game in the lobby seems entirely orthogonal to determining if the players in the game can send data around peer to peer fast enough to play FAF without lag. There's nothing visual about the problem, you send data around and measure the time it takes.

@Jip Thanks for testing, too bad the idea had technical issues.

@ThomasHiatt Users like visual elements, so the idea was to visually show how smooth the game will run.

" you send data around and measure the time it takes."
Maybe we could use polling to get the time it takes to send data around
Here is another example in lua of polling.
https://github.com/smiirl/luasocketio/blob/master/socketio/polling.lua
When players have slow response times then we can show a visual element indicating this.

Never Fear, A Geek is Here!

We could just use the ping, provided by the engine.

@ThomasHiatt it is not about making a pong game, I was experimenting for the animation idea. If the connection is stable then the animation would be smooth. If it is not then the animation stutters. I thought it to be a clever way to visualize jitter 🙂

A work of art is never finished, merely abandoned

@thecore the issue is with the lobby though, not with the idea.

A work of art is never finished, merely abandoned

The issue is you are calling it ping, when it's hardly consequential - sure it can affect the game, but I'd defer to Exselsior's explanation.

The 'lag' problem in most cases can be traced to two primary sources:

  1. bandwidth - can a player sustain the needed throughput to receive and send packages to every other player. Even if the player has the best PC out there, if the player can't send and receive data at required speed, it will lag.
  2. simulation - even if the player has the best connection out there, if a player's PC can not calculate what to send in those packages fast enough, it will lag.

Regardless, the idea with the visual seems really interesting actually, but I see 2 problems with it, assuming you measure the above-mentioned things, and not ping that is borderline irrelevant unless you are playing from the low-Earth orbit on the other side of the planet (though feel free to argument otherwise):

1. Players could be running something in the BG while waiting for the lobby to fill.

As the 'title' states. This could affect both bandwidth and simulation testing. The solution to this could be you plea players to turn their stuff off before starting the game (a.k.a. putting the PC in the state it will be in while the game will be running), but I don't see how you could enforce this - hence, there will be some who will disregard this recommendation, and after a while, everyone will.

2. Who's the lagger?

Let's assume you have 3 players that are in a lobby - A, B and C . Let's run a little thought experiment, assuming all players have relatively low ping (<300, which in truth only means they are 'very close to each other', network-distances speaking).

A has awesome internet, both up and down way beyond necessary, and has perfect connection to both players B and C. Let's assume player B has a decent enough connection, where it's good enough to support what is required to have a smooth play. Player C, on the other hand, has a bit worse internet connection, and for some reason (not unrealistic), his connection to A is completely stable, while his connection to B is absolute chaos.

Hopefully I don't have to explain how player A could not be able to tell who of the two players was the source of lag - even if he had insight on their own points of view. And if he were the host, he would not be able to decide on who to kick. The situation gets even messier the more players you have of course.


If we are already thinking of a way to represent "connectivity fitness", why not, if possible, extrapolate that from the last few games (say 20)? Measure both connectivity and simulation rates (not sure if it's possible to do that, or if 1 player bottlenecking causes everyone to have reported reduced sim speed) during the game, and extrapolate a 'score' out of that.

To make sure data is more representative, you add weight(multiplier) to the score, depending on how many connections had issues - e.g. if you're lagging with everyone (from your perspective), you get a higher weight, if you lag with only 1 person out of say a team game of 12, you get less weight on your score (though in-game it'll probably play out the same, that is game will lag for everyone, but that's the exact purpose of the weight, to not punish players because they had a 'lagged' connection to someone because of that someone).

In order to make the system even more fair, you could keep independent scores for each player count. Reasoning for this is, often lag is not due to poor internet connection, but due to player's PC not being able to handle the simulation at proper speed. E.g. even though a player might have 100000 exabytes/femtosecond of upload and download speed, if he is playing on his mom's clothes iron, he won't be able to utilize that because his game is lagging internally. But, this might be due to him trying to play 50 player games, and maybe his rancid potato can handle 3v3 (and less players) amount of games without a hitch - so you don't want his score to look abysmal when he would actually run perfectly well in smaller games.

  • this one, I'm talking from experience, I do not lag whatsoever in 4v4 games, but start having sim speeds in 6v6 and larger, which presents itself as lag.

Anyways, once you have a score, you can represent it by a simple circle, and a few colors. Say 3: green for 'great', yellow for 'good' and red for 'bad'. You then have 2-3 such circles, maybe representing (as before mentioned) your overall score in last 3, 10 and 20 games - so you don't get nailed by random noisy data. First one might be red, but if 3rd is green, you know that the player in general has good connection.


Another 'problem' could be that players run into 'bad rating hell' of sorts, where they get a red rating, so green rated players refuse to play with them, so they can only play with other red-rated players, but because of disproportionate lag in those, they get stuck on red rating.

In such a case, you could have an automated 30 second game simulation where a virtual game would be simulated, measuring connectivity to the server, but simulated as several ports, and measuring average game simulation speed at several units amount values, to see how well your PC can handle those.
This functionality would have to be used 'manually', a.k.a. there would be a 'Test connectivity' button somewhere in the settings menu, and it would just start a game u for you, you'd wait, not do anything, and then you'd get a 'fresh score' (then you'd get the first circle be in color, and the other 2 in black, so other players knew you 'reset'). The problem of 'you can login somewhere else and run a simulation on a better PC just to play on a worse one' can be solved by also gathering system hardware data, and invalidating the 'reset test' for the next several games if discrepancy is detected.

@fichom This is a good discussion, this is one of those simple to defined the problems but hard to find a solution to. So discussions like this is a good way to flesh out ideas for this problem.

CPU rating is helpful for working out if a player will sim lag, the problem is players who have a bad cpu can change that value locally to hide this fact, which results in them lagging late games where there are a lot of players.

Also sometimes there are unexpected connection issues that can happen, like your ISP is having issues or a undersea cable breaks etc. So having a connection rating based on pass games can be inaccurate.

The ideal solution is (before the game starts) have the ability to check the connection health (ping, jitter and latency). Ping is already added so jitter and latency could be added.

Untitled-1.jpg

How to calculate jitter https://piazza.com/class_profile/get_resource/hnd936blk4c26r/hnwio4j6bb5nm

How to calculate Latency
https://www.baeldung.com/cs/packet-time-latency-bandwidth

Never Fear, A Geek is Here!