🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Game of Chess

Published March 07, 2019
Advertisement

Having a few potentially free days I've decided to have a go at Rutin's challenge, making a chess game:

https://www.gamedev.net/blogs/entry/2266806-challenge-1-3d-chess/

I've fancied having a go at this for a few months now as I've never done one before and think the AI will be interesting to try. Anyway I'm using Godot again and have managed to write a basic framework and build some dodgy chess pieces in Blender. This has taken me about 3 hours, so I'm pleased that it is already taking shape.

chess.png.4525cf933ffe25ed5dc714da28330483.png

I will probably have to modify the pieces to make them easier to identify, for instance the knights are too similar to the bishop at the moment.

My plan is to give each piece type a ruleset for how it can move and take other pieces. This can be used to determine legal moves for the human player, and to determine moves for the AI. I'm thinking along the lines of using some kind of heuristic function to determine a score for each team, based on how many pieces are left, and which enemy pieces are threatened, and which of the team's pieces are threatened.

The initial goal for the AI will be to try lots of possible moves and go for the one that increases the AI score the most. This could involve a lookahead for 1, or several moves, maybe trying to predict the enemy countermoves.

I'm sure there are some well established algorithms for all this, but first of all I'm going to try it blind without doing any googling. I find it a lot of fun trying to figure out these things myself, I can always cheat and read some references once I've given it a go.

Previous Entry Islands and Land
Next Entry Game of Chess Day 1
2 likes 9 comments

Comments

Rutin

I cannot wait to see some AI action! :) I'm almost ready to post my update as well, just so delayed. :D I like your chess pieces! :) 

On the AI part, I found the simplest approach is just making a score based algorithm for moving that will weed through the possible moves and select the highest value move. Beyond that, I'm sure it would be a major time sink for any more advanced AI.

Best of luck, and I look forward to seeing your entries to follow.

March 07, 2019 05:59 PM
lawnjelly

I now have the mouse picking working, you can select a piece and select where you want it to move and it will do the move. Am now implementing the rulesets for the different piece types, and I have a board 2d array which stores the ID of each piece on a chessboard tile, or -1 for empty tile.

Like Steven Seagal in 'Under Siege', I also cook. I have been attempting to bake some bread while making this game. However I fear I will have the chess finished before I manage to make a decent loaf.

Chess is well designed to be implemented by computer, they even designed the board to be 8x8 in size, pre-dating the 8 bit computer, but optimized for lookup tables. That's foresight. :) 

March 07, 2019 06:13 PM
Rutin

Nice. :)  I did the same thing. I use a 2D array to represent the board. Then I ray-cast for piece selection. :) 

What kind of bread are you baking?

March 07, 2019 06:19 PM
lawnjelly

I'm not sure what kind of bread, I'm really very bad at cooking. I mixed some flour and yeast and brown sugar and have it in the oven to try and get it warm enough to rise (UK winter too cold for this). I have only once before tried this kind of thing. I made lager - vindaloo - bread when I was a student and ran out of food, except flour, lager and curry powder. :) 

March 07, 2019 06:30 PM
Rutin
2 minutes ago, lawnjelly said:

I'm not sure what kind of bread, I'm really very bad at cooking. I mixed some flour and yeast and brown sugar and have it in the oven to try and get it warm enough to rise (UK winter too cold for this). I have only once before tried this kind of thing. I made lager - vindaloo - bread when I was a student and ran out of food, except flour, lager and curry powder. :) 

Oh nice! :) 

March 07, 2019 06:33 PM
Awoken

very inspiring you two.  I love a good game of chess.  Do either of you have a preferred piece?  Mine would be the horse, love besting my challenger with some horse action. 

March 07, 2019 08:52 PM
Rutin
1 hour ago, Awoken said:

very inspiring you two.  I love a good game of chess.  Do either of you have a preferred piece?  Mine would be the horse, love besting my challenger with some horse action. 

Mine has always been the Knight. :) Just the versatility to jump through defenses and take pieces is why I love this piece.

March 07, 2019 10:00 PM
lawnjelly

Hmm, I always like getting my rooks / castles into the action. But difficult to say a favourite piece, they all have uses. I'm not that expert at chess though. All set for another day's work after a knight's sleep. I've realised I need a 'move' class (e.g. pawn B3 to C3) to store previous moves and to store a list of possible moves to assess for enemy AI.

March 08, 2019 08:04 AM
Rutin

I'm a world class GM! ;) 

March 08, 2019 08:54 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement