I've just been hurrying to finish a passable first version of my chess game I'm doing as a challenge with Rutin. After a quick flurry of activity on the user interface and the rules, I tried to make some vaguely sensible recursive tree searching AI. It was interesting, and involved a lot more debugging than I originally intended. It was quite slow, play for a bit, discover it doing something wrong, isolate a case and fix. It became clear that chess engines are things that people spend years working on .. but I'm happy to have a pretty stupid AI.
Doing it all in gdscript was quite a challenge too, normally I'd do vaguely compex stuff in c++. But it is all possible in gdscript, just slower runtime than c++ (like 100x lol) and more tricky to debug.
Anyway to prevent the calculation times becoming stupid this version is limited to how difficult you can set it. It plays a passable game (cough!), and I've tried to include most end conditions. En passant and castling are mostly working, however there's no exchanging pawns, I might put that in at a later date.
There's obviously a load I can do to make it look better too, a skybox and different camera views, better pieces and it would be nice to have a timer for the AI to give some indication how close it is to completing. But not necessary for a first release.
Anyway if this works roughly for anyone else who tries it I'll move onto the next official gamedev challenge, the side scrolling shooter (with no guns!).
Download from my project page here:
Great work! I gave it a play and all the pieces are moving well. The check system seems a bit wonky for me though. I even finished a game where I took all the pieces but their last Bishop and the game ended there.
I also tried a quick checkmate move with the lowest setting and I'm unable to capture the king (checkmate). Unless my chess is really bad this should be a checkmate, but I wasn't able to click the King and was forced to click another piece losing my Queen.
This should now be checkmate I believe... King cannot take my Queen due to my Bishop at C4.
If I decide to do nothing at this stage I can move all my pieces non-stop without Player 2 taking a turn.
If I decide to move my queen now it will resume: