News for hackers. Stuff that matters.
Re:What happens when you make a move in lichess.org? by MobileVet on Wednesday October 23, 2024 @04:20PM (#41928942)
I wish this discussed the timing arbitration of each move. Based on the packet information (if that is correct & complete) then the timing is done entirely on the clients. However, they show the time in seconds which can't be right so I am curious how accurate this packet schema is (or if those are float values).

Regardless, one thing I find maddening about chess.com is the time architecture of the game. I haven't seen the underlying code, but it feels like the SERVER is tracking the time. This completely neglects transport time & latency meaning that 1s to move isn't really a second. Playing on the mobile client is an exercise in frustration if you are playing timed games and down to the wire. Even when you aren't, your clock will jump on normal moves and it is most obvious during the opening.

This could also be due to general poor network code as well. The number of errors I get during puzzles is also frustrating. Do they really not retry a send automatically?? <breath>

Chess.com has the brand and the names... but dang, the tech feels SO rough to me.

Re:What happens when you make a move in lichess.org? by pengowray on Wednesday October 23, 2024 @06:12PM (#41929718)
> they show the time in seconds which can't be right

Seems right.

If you export/download games from lichess, they use the .pgn (Portable Game Notation) format, which is a standard plain-text format circa 1993, used by pretty much everyone for describing a chess game.

Lichess follows the specification to the letter, and as it only technically allows one-second accuracy, lichess only record moves with one-second accuracy. It seems insane, but that's how they do it.

Chess.com also exports PGN files, but they add a decimal place, allowing subsecond accuracy. No one has a problem with this. There is no software which cannot handle this. But Lichess refuses to "break" the spec.

lichess PGN export example:

> 1. d3 { [%eval -0.15] [%clk 0:01:00] } 1... g6 { [%eval 0.04] [%clk 0:01:00] }

Chess.com PGN export example:

> 1. d4 {[%clk 0:02:58.6]} 1... b6 {[%clk 0:02:59.2]}

Re:What happens when you make a move in lichess.org? by kibwen on Wednesday October 23, 2024 @07:59PM (#41930479)
> lichess only record moves with one-second accuracy

According to this blog post, this doesn't appear to be the case since at least 2017:

https://lichess.org/@/lichess/blog/a-better-game-clock-histo...

"Move times are now stored and displayed with a precision of one tenth of a second. The precision even goes up to one hundredth of a second, for positions where the player had less than 10 seconds left on their clock."

Re:What happens when you make a move in lichess.org? by pengowray on Wednesday October 23, 2024 @09:08PM (#41930903)
Interesting. Thanks for the correction and link. I'll note though the .pgn downloads still only show 1 second precision, as do the game PGNs in lichess's "open database" archive.
Re:What happens when you make a move in lichess.org? by pshc on Wednesday October 23, 2024 @05:26PM (#41929393)
> it feels like the SERVER is tracking the time

TBH this is what I expected for all online chess. How else to reconcile the two players' differing clocks and also prevent client-side cheating?

Re:What happens when you make a move in lichess.org? by MobileVet on Wednesday October 23, 2024 @08:07PM (#41930521)
I guess my naive frustration comes from crazy fps games tracking things so precisely and yet somehow Chess.com can’t handle a turn based game?! Honestly.

I do recognize that fps games utilize predictive algorithms and planning to estimate future player positions but still, turn based networking with 100ms accuracy should be a solved problem

Re:What happens when you make a move in lichess.org? by pshc on Wednesday October 23, 2024 @11:03PM (#41931514)
Yeah honestly I agree like it would be nice if they switched to WebRTC or UDP.
Re:What happens when you make a move in lichess.org? by palata on Thursday October 24, 2024 @04:02AM (#41933199)
So you need to send a few bytes of information every few seconds, but you want to spam the network with UDP packets containing those few bytes?
Re:What happens when you make a move in lichess.org? by lomase on Thursday October 24, 2024 @04:57AM (#41933564)
Every single online multiplayer game that cares about latency reimplements a subset of HTTP over UDP.
Re:What happens when you make a move in lichess.org? by WJW on Thursday October 24, 2024 @06:39AM (#41934166)
Huh, that's not what I would expect at all. If you are having custom network protocols anyway, why deal with all the overhead that even a subset of HTTP brings? You might as well make an entirely new protocol at that point.
Re:What happens when you make a move in lichess.org? by lomase on Friday October 25, 2024 @04:06AM (#41943242)
Is TCP. Why everybody does it you ask?
Re:What happens when you make a move in lichess.org? by gs17 on Thursday October 24, 2024 @12:36PM (#41937154)
>reimplements a subset of HTTP over UDP.

TCP, although I like to imagine FPS games where shooting someone sends "DELETE /players/n00b HTTP/1.1" to the server.

Re:What happens when you make a move in lichess.org? by lomase on Friday October 25, 2024 @04:03AM (#41943233)
Yes TCP!!!!
Re:What happens when you make a move in lichess.org? by sokoloff on Thursday October 24, 2024 @05:45AM (#41933877)
Sure; why not? If I can stream videos on that same network for entertainment, or play another online, multiplayer game, why not use UDP if it gives a better user experience? It's not like UDP transport of those bytes is significantly worse network-wise and certainly lighter weight than those other alternatives.
Re:What happens when you make a move in lichess.org? by ajuc on Thursday October 24, 2024 @08:50AM (#41934997)
Bullet chess is almost an RTS ;) You need starcraft-like micro ;)
Re:What happens when you make a move in lichess.org? by MichaelZuo on Wednesday October 23, 2024 @05:39PM (#41929496)
It hasn’t been done client side in any pvp game I’ve heard of.
Re:What happens when you make a move in lichess.org? by stevage on Wednesday October 23, 2024 @06:31PM (#41929862)
I'm pretty sure freechess.org did.
Re:What happens when you make a move in lichess.org? by MichaelZuo on Wednesday October 23, 2024 @08:06PM (#41930512)
How is it being done client side?
Re:What happens when you make a move in lichess.org? by stevage on Wednesday October 23, 2024 @08:34PM (#41930707)
Well it's a long time since I played there. But it had custom chess clients, which I assume just recorded how much time your move actually took and sent that with the move.

Yes, it's easy to cheat with this, but it's very easy to cheat with chess anyway.

Re:What happens when you make a move in lichess.org? by 4star3star on Thursday October 24, 2024 @09:45AM (#41935439)
This makes the most sense. Start a timer when the UI actually hands control to the player whose move it is, stop the timer when they've completed their move, and simply subtract that from their remaining time. The interval gets sent to the server and relayed to the other player to update their opponent's clock accurately.
Re:What happens when you make a move in lichess.org? by compiler-guy on Thursday October 24, 2024 @01:56AM (#41932359)
Freechess shipped a binary called “timeseal” that did the calculations for you and encrypted the communications. It was not foolproof—-not by a long shot, but it also didn’t completely suck.

You can read about what became timeseal here. https://eprint.iacr.org/2004/203.pdf

Re:What happens when you make a move in lichess.org? by bongodongobob on Wednesday October 23, 2024 @05:50PM (#41929569)
Track the two clients pings? What client side cheating prevention would you need to do in chess? Afaik you can't cheat by clipping through walls or jumping around on the map.
Re:What happens when you make a move in lichess.org? by connicpu on Wednesday October 23, 2024 @05:53PM (#41929589)
The client side cheating would by lying about when you received the packet in order to give yourself more time to think. Even if you only shifted it by 200ms per move, that could add up to a lot over the course of a long game.
Re:What happens when you make a move in lichess.org? by kaoD on Wednesday October 23, 2024 @06:51PM (#41930032)
To give additional context: bullet chess can go down to 1 minute per player. Lying about a few millisecond per move there is huge.
Re:What happens when you make a move in lichess.org? by HDThoreaun on Wednesday October 23, 2024 @05:57PM (#41929619)
Cheat by giving yourself more time
Re:What happens when you make a move in lichess.org? by nightowl_games on Wednesday October 23, 2024 @10:11PM (#41931233)
Netcode dev here. Predicting the clock is a trivially solved problem. The client and server know the latency between each other, the server can offset the timestamp on the input from the client to compensate for this difference, and the client can offset it's rendering of the clock data from the server. The same techniques used in regular online gaming would apply here. The only X factor here is the impact of the client lieing about its latency to the server, perhaps that could have an impact, not sure.
Re:What happens when you make a move in lichess.org? by crashbunny on Wednesday October 23, 2024 @10:48PM (#41931433)
> The only X factor here is the impact of the client lieing about its latency to the server, perhaps that could have an impact, not sure.

on lichess it does have an impact. lichess has a thing they call lag compensation where the server can add time to a player's clock after the server receives their move.

The goal is to make it fair for someone with high lag playing someone with low lag.

I don't know the exact cheating method used. I'll have a guess, though. What if someone spent a few seconds looking at the board before making their move, and then adding (edit: oops, subtracting) a few seconds to their clock in their response packet. The server would see the client made their move instantly based on the time in the response packet, but it took a few seconds for the server to receive the packet. i.e. lag. So it might add time to compensate for the perceived lag.

Lag compensation cheating is a frequent topic on the lichess forums.

Re:What happens when you make a move in lichess.org? by palata on Thursday October 24, 2024 @04:06AM (#41933226)
> How else to reconcile the two players' differing clocks and also prevent client-side cheating?

Is there a point in preventing cheating, really? I can just make a bot...

Re:What happens when you make a move in lichess.org? by bongodongobob on Wednesday October 23, 2024 @05:48PM (#41929554)
I can't play bullet on chess.com for this reason. Lost way too many games on "time" even though I had a second or two on the clock. Incredibly frustrating.
Re:What happens when you make a move in lichess.org? by mkagenius on Wednesday October 23, 2024 @04:45PM (#41929123)
Vladimir Kramnik agrees with your observations about chesscom.
Re:What happens when you make a move in lichess.org? by chongli on Wednesday October 23, 2024 @05:09PM (#41929282)
I'm surprised to see anyone bring him up here!
Re:What happens when you make a move in lichess.org? by sourcepluck on Wednesday October 23, 2024 @10:05PM (#41931200)
You're surprised that Kramnik is mentioned when the discussion topic is related to chess? I don't understand why. He's well-known in chess (and in chess memeland).
Re:What happens when you make a move in lichess.org? by chongli on Thursday October 24, 2024 @01:54AM (#41932339)
Kramnik is a former world champion who has taken a torch to his own reputation by accusing tons of people of cheating without evidence. He’s been banned as a regular columnist on chess.com after using his column as a platform to attack people. He has next to no credibility on any chess issues these days.
Re:What happens when you make a move in lichess.org? by rjatran on Thursday October 24, 2024 @07:45AM (#41934586)
A ban just means that a group of bureaucrats decided to take public action against a specific person and not against others.

Carlsen, Nakamura and chess.com itself have participated in the Niemann witch hunt. No evidence of over-the-board cheating has ever been provided.

None of the accusers is banned.

Kramnik did the same as they did (by indeed going too far).

Re:What happens when you make a move in lichess.org? by watwut on Thursday October 24, 2024 @10:08AM (#41935640)
I think there is difference between "accusing tons of people" and "using his column as a platform to attack people" vs "accusing that one person in one instance".

It is actually perfectly fine to not ban people doing something wrong one or two times while banning people doing that exact thing for fifth time.

Re:What happens when you make a move in lichess.org? by krlamn on Thursday October 24, 2024 @11:38AM (#41936617)
No, the difference is between a well connected mob going after a single person (Niemann) vs. a single person going after several.

The former is always excused, presumably because people's ancient group instincts kick in. The latter is a single heretic that must be destroyed.

The group does much more damage than the individual. Everyone already thought that Kramnik's pseudo-mathematical evidence was garbage, so why the ban? The answer is that he mentioned well connected people like Nakamura, so the rogue nail needed to be hammered in.

Groups are never punished, and 95% of Internet commenters always excuse the group.

Re:What happens when you make a move in lichess.org? by chongli on Thursday October 24, 2024 @11:56AM (#41936794)
No, Kramnik deserved a ban because he was going after not-well-connected, young, up-and-coming players who have no other recourse to defend themselves. Nakamura made it very clear that he was not going to tolerate this because it jeopardizes the future of the game.

Niemann was already an admitted cheater who had been previously sanctioned for his activities. Carlsen’s accusations against him may have been unfounded for the specific game in question but Niemann’s reputation was already blemished. Niemann’s lawsuit was inexcusable though, as it was essentially a SLAPP [1] designed to hinder everyone’s efforts to get cheating out of chess. Thankfully the lawsuit was unsuccessful and Niemann continues to play chess.

[1] https://en.wikipedia.org/wiki/Strategic_lawsuit_against_publ...

Re:What happens when you make a move in lichess.org? by progbits on Thursday October 24, 2024 @01:01PM (#41937393)
Three new accounts just so you can keep agreeing with yourself, huh?
Re:What happens when you make a move in lichess.org? by tkahlrt on Wednesday October 23, 2024 @07:07PM (#41930148)
Yes, he had timing problems in an online tournament on chess.com (against a Mexican GM in the same room) where his computer did not have all Windows updates and/or the timezone was wrong.

chess.com confirmed the issue.

Re:What happens when you make a move in lichess.org? by nih on Wednesday October 23, 2024 @05:33PM (#41929444)
Interesting
Re:What happens when you make a move in lichess.org? by Scene_Cast2 on Wednesday October 23, 2024 @09:05PM (#41930890)
What I'd love is for my pre-moves to be sent to the server immediately so I don't time out when I pre-moved.
Re:What happens when you make a move in lichess.org? by y-curious on Wednesday October 23, 2024 @10:46PM (#41931430)
The worst part is they call it an intentional choice. "First off, premoves take 0.1 seconds. That is what has been preferred and agreed upon by most professional players we have consulted on the topic. They prefer .1 to .0 for premove. This is also what other chess servers do."[1]

It's super annoying and the reason I only play blitz+ on chesscom.

[1]https://www.chess.com/forum/view/help-support/mate-in-one-qu...

Re:What happens when you make a move in lichess.org? by CamelCaseName on Thursday October 24, 2024 @01:14PM (#41937490)
Well, I'm not sure about "most professional players" but I strongly prefer .0 to .1
Re:What happens when you make a move in lichess.org? by fbernier on Wednesday October 23, 2024 @09:47PM (#41931113)
What's interesting about this is chess.com allows you to stack as many pre-moves as you like but they each cost 0.1s, whereas on lichess you can only have one pre-move which is technically free but maybe not because of delay.
Re:What happens when you make a move in lichess.org? by KolmogorovComp on Thursday October 24, 2024 @07:22AM (#41934428)
That would introduce other issues I think. Since premove are cancellable/changeable, what happen if you changed at the very last moment but due to delay it did not reached the server in time?
Re:What happens when you make a move in lichess.org? by ycombinete on Thursday October 24, 2024 @08:39AM (#41934902)
This is how it works on Lichess
Re:What happens when you make a move in lichess.org? by bluecalm on Thursday October 24, 2024 @01:53AM (#41932334)
Chess.com software might be the worst public facing software ever assembled. During their most popular weekly tournament (by the number of spectators) called Titled Tuesday where significant % of the world elite regularly competes they send links on a public chat to a 3rd site every 4 rounds. The reason is that there is a few minutes break and they failed implementing a clock on their side so they need 3rd party service for that.

This is one of the many, many things but imo it's the most telling. They can't even add a clock counting down the 6 minutes to their web client.

Re:What happens when you make a move in lichess.org? by luisgvv on Thursday October 24, 2024 @10:39AM (#41935958)
I can't believe this, but it makes sense now lol I think I heard a streamer say it was for kicking out the cheaters
Re:What happens when you make a move in lichess.org? by bluecalm on Thursday October 24, 2024 @04:29PM (#41939418)
Another thing is that you need to click around the chat area just before the break ends (and you need to monitor when the break ends on that 3rd party site) so the chess.com server won't throw you out of the tournament for inactivity :)

>>I think I heard a streamer say it was for kicking out the cheaters

I can't see how it can possibly help. Maybe he meant something else?