Chess challenge - first alpha

Published March 31, 2019
Advertisement

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:

2 likes 0 comments

Comments

Rutin

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.

image.png.7664dbdc5cfd7a31a2afe8a9543693b6.png

image.png.3f73f8718e8867ebc0d25ff1455ff235.png

image.png.6632d94a0686b60e55a1dcb1957e001a.png

image.png.5d12d95555f74f02d86ef3deff2810f2.png

image.png.1ad301c7d5f0d891eba4cd522d8250c4.png

This should now be checkmate I believe... King cannot take my Queen due to my Bishop at C4.

image.png.11030d615baa0c68a7efa43ad57b7ec0.png

If I decide to do nothing at this stage I can move all my pieces non-stop without Player 2 taking a turn.

image.png.0abb05ad91c3e35b0f07118937446822.png

If I decide to move my queen now it will resume:

image.png.f90fd5c1bd74b92910910f4ad8665d9e.png

image.png.0fd12ebddc75400681643d52a9e58b0c.png

March 31, 2019 11:46 PM
lawnjelly

Great thanks for trying it Rutin!! There are still loads of bugs I went from almost entirely unplayable yesterday morning to releasing it. I'll try and examine these ones.

Yes the bit for recognising the end game conditions (especially check mate) is a bit dodgy, I will try and fix this! :)

I also want to change the colouring to changing the square underneath the marked pieces so you can still easily make out which is black and white.

April 01, 2019 07:23 AM
Rutin

Great! :) I cannot wait to see your next release. Also looking forward to seeing what you come up with for the challenge. Keep up the great work!

April 01, 2019 07:51 AM
lawnjelly

Ok there is a new version (0.11) it should now recognise checkmate, it does a test after each move (AI or player) to look for check or checkmate conditions. There is also now a display of the AI doing its calculations which also helps indicate when it is thinking. There is also a fallback version I made for GoliathForge with lower hardware requirements (only use this if main version does not run). :) 

April 01, 2019 10:16 AM
Rutin

Awesome! :) 

April 01, 2019 10:32 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement