Live data from Hacker News

One Million Chessboards

onemillionchessboards.com

61–70 of 82 posts

Re: One Million Chessboards

#61
post #18

Earlier quoted context omitted.

> The frontend optimistically applies all moves you make immediately. It then builds up a dependency graph of the moves you’ve made, and backs them out if it receives a conflicting update before the server acks your move. The dependency graph is between pieces you’re interacting with? Meaning if you move a queen and are trying to capture a pawn, and there’s potentially a rook that can capture your queen, those 3 are…

Ah yes good question! Here's some context for you. First off, the way moves work: (edit: I realized I didn't answer your question. If we receive a captured for a piece we're optimistically tracking that always takes precedence, since once a piece is captured it can't move anymore!) * clients send a token with each move * they either receive a cancel or accept for each token, depending on if the move is valid. If they…

Amazing thanks for the explanation!

Would be really cool to read about the different designs and consideration and how you arrived at this in your blog post!

Re: One Million Chessboards

#62
It crashed for me:

    Uncaught TypeError: Cannot read properties of null (reading 'type')
        at $80b91fc9d2f468ec$export$4abc8fab4139dfcd (index.e2b13a6c.js:1:406898)
        at $c692b767326c99ec$var$PieceHandler.getMoveableSquares (index.e2b13a6c.js:4:4373)
        at index.e2b13a6c.js:4:13557
        at oQ (index.e2b13a6c.js:1:60912)
        at o0 (index.e2b13a6c.js:1:61761)
        at oZ (index.e2b13a6c.js:1:60941)
        at Object.useState (index.e2b13a6c.js:1:72377)
        at Object.q (index.e2b13a6c.js:1:10352)
        at $a2d3bef833187ce9$export$474cd6ee072cf5a4 (index.e2b13a6c.js:4:12305)
        at oF (index.e2b13a6c.js:1:58673)

Re: One Million Chessboards

#63
This game has gotten interesting, for instance people have figured out a single board with pieces filling the outside edges two squares deep is impervious.

I love how we're seeing emergent gameplay. That's the genius in eieio's projects. He's inventing game systems that on the surface seem simple, but at this mass scale they have interesting possibilities that people discover. And they're entirely new and invented, so we have no idea what to expect until the community figures it out.

Re: One Million Chessboards

#65
We definitely have some cheaters, playing as the other color. Thought I saw it last night but I know I saw it today. I think I saw vindictive use of it too, both times. One black fortress was destroyed and next thing you know the nearest white fortress found its pieces moving into the worst possible positions, often next to a waiting black bishop or rook. I'm not sure how exactly you handle the colors, but in a world where I can RDC onto a dozen computers on a half dozen continents in seconds I suppose this was inevitable.

Re: One Million Chessboards

#66
post #32
post #20

Earlier quoted context omitted.

If you don’t mind explaining, I’m curious how you test something like this before it goes live. It seems like it would be hard to simulate all the things that could happen at scale.

So sometimes I don't test these projects that much but I did this time. Here are a few thoughts: My biggest goal was "make sure that my bottleneck is serialization or syscalls for sending to the client." Those are both things I can parallelize really well, so I could (probably) scale my way out of them vertically in a pinch. So I tried to pick an architecture that would make that true; I evaluated a ton of different…

> To validate that I made a script that spins up ~600 bots

Funny, when I went there were just over 600 active players and things were running super smoothly, even on my mobile. Kudos!

Do you see this project and the things you’ve tried applying to other future projects?

Re: One Million Chessboards

#67
post #32

Earlier quoted context omitted.

So sometimes I don't test these projects that much but I did this time. Here are a few thoughts: My biggest goal was "make sure that my bottleneck is serialization or syscalls for sending to the client." Those are both things I can parallelize really well, so I could (probably) scale my way out of them vertically in a pinch. So I tried to pick an architecture that would make that true; I evaluated a ton of different…

> To validate that I made a script that spins up ~600 bots Funny, when I went there were just over 600 active players and things were running super smoothly, even on my mobile. Kudos! Do you see this project and the things you’ve tried applying to other future projects?

Hah, yes, but for testing I removed all my rate limits so I pushed 1 million moves in 2 or 3 seconds, whereas now I think I rate limit people to like 3 or 4 moves a second (which is beyond what I can achieve on a trackpad going as fast as I can!) so the test isn't quite comparable!

I definitely learned a lot here. Most of my projects like this are basically just "give the internet access to my computer's memory but with rules." And now I think I've got a really good framework for doing that performantly in golang, which should make the next set of projects like this much quicker to implement.

I also just...know how to write go now. Which I did not 6 weeks ago. So that's nice.

Re: One Million Chessboards

#68

It's interesting how the game will end. Will it end up in a deadlock, or in a fierce duel of two power pieces with hundreds of players behind each struggling to gain control concurrently?

After further reflection I guess it will be a fierce duel of bots, not humans

Re: One Million Chessboards

#69
post #67

Earlier quoted context omitted.

> To validate that I made a script that spins up ~600 bots Funny, when I went there were just over 600 active players and things were running super smoothly, even on my mobile. Kudos! Do you see this project and the things you’ve tried applying to other future projects?

Hah, yes, but for testing I removed all my rate limits so I pushed 1 million moves in 2 or 3 seconds, whereas now I think I rate limit people to like 3 or 4 moves a second (which is beyond what I can achieve on a trackpad going as fast as I can!) so the test isn't quite comparable! I definitely learned a lot here. Most of my projects like this are basically just "give the internet access to my computer's memory but w…

Six weeks is pretty quick! Can I ask what editor you use (always curious), and what other languages you have a background in?

Re: One Million Chessboards

#70
post #8

Ah hello! I made this :) My blog describing it is pretty sparse, sorry about that. Happy to answer any questions that folks have about the architecture. Not that it was necessary, but I got really into building this out as a single process that could handle many (10k+/sec) moves for thousands of concurrent clients. I learned a whole lot! And I found golang to be a really good fit for this, since you mostly want to gi…

I'm inspired to make something with comparable requirements! Do you need some beefy server to handle the load?
Post reply on HN