Animated-Chess
- 1 Devlogs
- 11 Total hours
A chess game which is actually fun to play
A chess game which is actually fun to play
I am trying to make a chess game like not just a boring grid with pieces moving around, but something that actually has WEIGHT and IMPACT when you capture a piece.
So here’s the thing. I started with chess.js for the game logic because honestly why would I write chess rules from scratch when there’s a library that does it perfectly. But the rendering? Pure Canvas 2D. No WebGL. No Three.js. Just me, a element, and a LOT of ctx.drawImage() calls. And yeah it sounds like a bad idea but hear me out — it actually runs at 60fps bruhhhhhhh. It also has an elo system just like standard chess when u win elo rating increases and likewise if u lose it decreases.
So i added stockfish in my game so that people can do a bot verses match with the world’s strongest open-source chess engine. It’s been around forever and it’s insanely good — like stronger than any human who has ever lived. The thing is, it’s written in C++, not JavaScript. So you can’t just drop it into a website or an app and call it a day.
What I did was take the WebAssembly version of Stockfish — that’s basically the C++ code compiled down to something a browser can run. And I stuck it in a Web Worker, which is like a helper thread that runs in the background. So while Stockfish is busy calculating the best move, the rest of the game doesn’t freeze or lag. The player can still see the board, the animations keep running, everything stays smooth.
The fun part is making it feel human. Stockfish at full strength would destroy anyone, so I had to nerf it. It has a built-in “skill level” setting from 0 to 20.
I mapped that to four difficulty levels:
For now i have added some animations while capturing and moving the pieces which look like;