How to program a chess: a forum based tutorial
Hey guys,
I currently have the main game scene drawn, the camera movement all worked out (very smooth :) ) and I'm currently working on the picking (selecting a square). I'm only going to put in the necessities for this last tutorial. I'll leave the pollish up to you guys :).
Cheers,
- llvllatrix
I currently have the main game scene drawn, the camera movement all worked out (very smooth :) ) and I'm currently working on the picking (selecting a square). I'm only going to put in the necessities for this last tutorial. I'll leave the pollish up to you guys :).
Cheers,
- llvllatrix
Quote:
I'm currently working on the picking (selecting a square).
llvllatrix..does that mean we can drag the piece from one square to another square? ;)
if that works, then can start playing the game already... even without implementing the chess rules.. :) ...
Hey guys,
Its done :)
http://www.eng.uwaterloo.ca/~rramraj/Gamedev/chess_tutorial/src_tree/chess_src.zip
Here are the controls for the game so far:
Menu:
- f10
Camera movement:
- hold down the space bar and use the mouse to rotate yourself around the chess board
- hold up to zoom into the board
- hold down to zoom out
Playing (note that it is human(white) against computer(black)):
- use the mouse to move your cursor around the board
- left click on the mouse to select a piece
- left click again to move the piece
- if the move is illegal, repeat the procedure
Once you make your move, the computer immediately responds with it's move, so there is going to be a bit of lag after you make your move. That said, there are still quite a few things to do to the program to make it "playable" in the sense that you could commercially sell it. I'm going to leave this stuff up to you guys because it's good practice. Here's a list:
- remove the lag (you can do this by using threads to run the computer's thought routine through)
- provide a better user interface for the game (this means displaying who's turn it is, which pieces are captured, and other stats)
- provide more options for the game (ie setting the computers difficulty, the screen resolution...ect...)
- provide multiplayer and networked multiplayer.(This would require a bit of an addition to the engine, but it shouldnt be too hard. Just be advised that this is one of the only instances where you can add networked multiplayer after the game is completed. Its just too hard for larger games.)
- drag the pieces accross the board
- make some more asset mods (Use milkshape or blender and make your own pieces. You could do lord of the rings chess, Open Source vs Microsoft chess, Halloween town vs Christmas town chess...the skies are the limit :) )
- Add music and sounds
- Replace that horrible main screen text
- make better UI (ie better buttons ect...using texture maps for the buttons is an idea :) )
- Stick your own logo on the loading screen :)
I'm very curious to see what you guys come up with :),
- llvllatrix

[Edited by - llvllatrix on April 7, 2005 6:50:04 PM]
Its done :)
http://www.eng.uwaterloo.ca/~rramraj/Gamedev/chess_tutorial/src_tree/chess_src.zip
Here are the controls for the game so far:
Menu:
- f10
Camera movement:
- hold down the space bar and use the mouse to rotate yourself around the chess board
- hold up to zoom into the board
- hold down to zoom out
Playing (note that it is human(white) against computer(black)):
- use the mouse to move your cursor around the board
- left click on the mouse to select a piece
- left click again to move the piece
- if the move is illegal, repeat the procedure
Once you make your move, the computer immediately responds with it's move, so there is going to be a bit of lag after you make your move. That said, there are still quite a few things to do to the program to make it "playable" in the sense that you could commercially sell it. I'm going to leave this stuff up to you guys because it's good practice. Here's a list:
- remove the lag (you can do this by using threads to run the computer's thought routine through)
- provide a better user interface for the game (this means displaying who's turn it is, which pieces are captured, and other stats)
- provide more options for the game (ie setting the computers difficulty, the screen resolution...ect...)
- provide multiplayer and networked multiplayer.(This would require a bit of an addition to the engine, but it shouldnt be too hard. Just be advised that this is one of the only instances where you can add networked multiplayer after the game is completed. Its just too hard for larger games.)
- drag the pieces accross the board
- make some more asset mods (Use milkshape or blender and make your own pieces. You could do lord of the rings chess, Open Source vs Microsoft chess, Halloween town vs Christmas town chess...the skies are the limit :) )
- Add music and sounds
- Replace that horrible main screen text
- make better UI (ie better buttons ect...using texture maps for the buttons is an idea :) )
- Stick your own logo on the loading screen :)
I'm very curious to see what you guys come up with :),
- llvllatrix

[Edited by - llvllatrix on April 7, 2005 6:50:04 PM]
Congratulations llvllatrix for completing the game... :)
I just one to give one suggestion.. I think we can make it as two player game aswell..but that only happens if we change the code and remove the AI.. why don't we put a selection mode in the interface... lets say.. after we click new game button it will go to another interface with 2 buttons human vs computer button and human vs human.. that way we can play with other player as well as computer...
what do you think.. :) Do you think it is too difficult to be done? :)
I just one to give one suggestion.. I think we can make it as two player game aswell..but that only happens if we change the code and remove the AI.. why don't we put a selection mode in the interface... lets say.. after we click new game button it will go to another interface with 2 buttons human vs computer button and human vs human.. that way we can play with other player as well as computer...
what do you think.. :) Do you think it is too difficult to be done? :)
Quote:
Do you think it is too difficult to be done? :)
lol, nope. In fact, I think its extreemly easy :) Thats why I think you guys can do it. Review the code and see if you can figure out a way. If you have any questions, just ask ;).
Cheers,
- llvllatrix
ok... i will have a look at the code first... there might be a lot of questions I will ask.. just get ready... :)
O yeah.. I tried to play the game vs other player... I think there is something wrong with the rules.. It doesn't follow the rules.. lets say if i place my white pawn at the end of the black board position, lets say i capture the black castle there..usually we can change the pawn to queen, or etc.. but here it doesn't change.. it stuck there ..lol..
another thing is, when we check the king, it will straight away checkmate and the game end.. usually we can still move the king to other position to avoid the check right..
so this is the first question i will ask...
1. what kind of AI search algorithm does beowulf use? is it best first searh..emm I don;t think so.. is it A* algorithm ?
2. // Arrows + Home/End pad
#define UTIL_KEYBOARD_UP 273
#define UTIL_KEYBOARD_DOWN 274
#define UTIL_KEYBOARD_RIGHT 275
the above is how you define for the keyboard arrow key.. can you tell me how to define the alphabeth keys.. such as 'a' . 'b' etc... I think the value is different...such as the #define UTIL_KEYBOARD_UP the value is 273.. what about the alphabeth value key..
[Edited by - da_grat1 on March 29, 2005 1:38:14 AM]
O yeah.. I tried to play the game vs other player... I think there is something wrong with the rules.. It doesn't follow the rules.. lets say if i place my white pawn at the end of the black board position, lets say i capture the black castle there..usually we can change the pawn to queen, or etc.. but here it doesn't change.. it stuck there ..lol..
another thing is, when we check the king, it will straight away checkmate and the game end.. usually we can still move the king to other position to avoid the check right..
so this is the first question i will ask...
1. what kind of AI search algorithm does beowulf use? is it best first searh..emm I don;t think so.. is it A* algorithm ?
2. // Arrows + Home/End pad
#define UTIL_KEYBOARD_UP 273
#define UTIL_KEYBOARD_DOWN 274
#define UTIL_KEYBOARD_RIGHT 275
the above is how you define for the keyboard arrow key.. can you tell me how to define the alphabeth keys.. such as 'a' . 'b' etc... I think the value is different...such as the #define UTIL_KEYBOARD_UP the value is 273.. what about the alphabeth value key..
[Edited by - da_grat1 on March 29, 2005 1:38:14 AM]
Hey,
My computer parts arrived yesterday, so I've been kinda busy :).
I think its something like negamax. You can find a bunch of info on it at:
http://www.chessbrain.net/beowulf/theory.html
Just use the ascii value. For example if you want the letter c you would pass 'c' to the function.
Keep up the good work,
- llvllatrix
My computer parts arrived yesterday, so I've been kinda busy :).
Quote:
1. what kind of AI search algorithm does beowulf use? is it best first searh..emm I don;t think so.. is it A* algorithm ?
I think its something like negamax. You can find a bunch of info on it at:
http://www.chessbrain.net/beowulf/theory.html
Quote:
2. // Arrows + Home/End pad
#define UTIL_KEYBOARD_UP 273
#define UTIL_KEYBOARD_DOWN 274
#define UTIL_KEYBOARD_RIGHT 275
the above is how you define for the keyboard arrow key.. can you tell me how to define the alphabeth keys.. such as 'a' . 'b' etc... I think the value is different...such as the #define UTIL_KEYBOARD_UP the value is 273.. what about the alphabeth value key..
Just use the ascii value. For example if you want the letter c you would pass 'c' to the function.
Keep up the good work,
- llvllatrix
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement