lichess.org
Donate

A solution to the lag problem in ultrabullet: peer to peer connections

Due to the way Lichess is set up, there is only one server in France. This leads to players far from the server lagging in ultra and hyper.
Lag slows down the pace of games and makes it less fun for both laggers and nonlaggers. As a lagger myself, I have been searching for a way to improve my ping and I have found a way to significantly reduce the lag caused by distance in many cases. The solution is for Lichess to use peer to peer (p2p) connections instead of a standard server.
For those who do not understand what a p2p connection is, I will explain: Normally, moves are sent to the Lichess server and then sent to the other player (move played on your computer -> lag -> move reaches server -> lag -> move reaches opponent computer). This is not an optimal setup if the goal is to minimize lag, as what if both players are very close to each other but both far from the server? Time is wasted sending moves to the server when they could be just sent between the two players.

One solution to this is to use multiple servers spread around the world, but this is very expensive and complex to implement, so I doubt Lichess will ever do this.

Instead, Lichess should use p2p. When p2p is used the moves are sent directly from your computer to the opponent's computer, skipping the central server entirely. Now there is only a single source of lag (move played on your computer -> lag -> move reaches opponent computer) and your distance from Lichess does not matter at all. The players' ping will now only depend on the distance between them and not the distance between them and the server. This will greatly reduce lag in many cases.

Another benefit of this system is that both players will get the exact same ping and lag compensation, so no one will be able to complain about unfair lag.

I have created a website where you will be able to play ultrabullet with this p2p system. If you are interested in trying it out, send me a message and if you normally get 2-3 bars on Lichess this might be your opportunity to finally feel what a good connection is like.
Now I have 0 clue how this techy stuff work, but how does the move get processed and recognized by the server?

(I am a dumbie therefore I apologize if my question is stupid)
@potatothing The game and moves will be processed by the two players' computers, not the server. I guess you could still send the moves to the server for anti-cheating purposes.
This sounds highly unsecure to me. My pc shall directly connect to a completely unknown pc of any other user around the world?
And at least one of the two directly connected pc's must be a webserver, which reacts to a message he has got from another pc (instead of the usual way where the client starts a connection and then only receives messages from the webserver it has connected to)
"The time it takes to send a move from your computer to Lichess server, and get the response back. It's specific to your distance to Lichess (France) as well as the quality of your Internet connection. Lichess developers cannot fix your wifi or make light go faster."

From lichess.org/lag

Well... #1 I dont know much about p2p but hopefully it means player to player. And lichess is using p2s2p player to server to player.
@GrandMastersofIndia that is correct.

@sheckley666 It is not insecure at all. In fact, it is probably just as secure as Lichess. No sensitive data is being exposed, the only thing being sent over the network is moves and game data. And you don't need a webserver, that is the big advantage of the p2p system: no server is needed :)
You said you created a website, so I guess both players only need a web browser. Maybe you could explain a little bit deeper, which of these both browsers starts the communication with the other browser, and how is the other browser supposed to react to a message received from the first browser?
A server is still needed to 'handshake' the connection (in other words, initiate it) between the two browsers, however after the connection is established it is not needed at all. The browser that initiates the connection is in my case the one that finds an open game seek on my site. The other browser then detects that another browser is attempting to connect to it. It starts the game and opens the connection channel, and then the two browsers are able to exchange data without a server.
This is a great idea has it will reduce ping and latency as the way games work will change.

This topic has been archived and can no longer be replied to.