I started making one, but I wondered what might be the best method for representing board state? If I was doing it in C++, I would use 2d arrays… Would you suggest using parent/child stuff, or using 64 separate integer instances, or something else?
The first thing that comes to my mind is “Structure Variables”:
Structure Variables on the wiki
If you know C++ it surely will be easy, different, but easy
Using 64 variables will be painful, better try to use structures.
Chess are games with very specific rules that can be hard to make at first glance using events, so do not hesitate to use hidden objects that you can use at “markers”, for example to draw the cases that the player can click on, or to restrict a movement, or using the collision condition to erase something from the board.
This is very nice post thanks a lot…!!!
Ok, I want to share some thoughs about board game creation:
- I agree with 4ian and the other users. The best way to handle the board data is using an array of structures.
- Once I programmed a 4-in-line (long ago, in VB6) and to be honest, make the board and the functions controlling basic movement is easy; even it was a little more difficult in a 4-in-line game because it involves gravity.
- But there was something very hard to do it and was the programming of the internal A.I.; one that could understand and win against a human oponent. And well, that was a 4-in-line… “teach” an algorithm how to recursively react to any incredibly complex scenario in a chess game, well, it’s perfectly possible, but it’s hard work; REAL hard work. And if you don’t have idea how to do it since now, you’ll stuck up with a P2P chess board game when you face that problem.
- Board games valid moves and internal A.I. move calculation is a huge process trough iteration. It will make your game run slow even if your game is something very simple at graphic level, with just some basic sprites. My advice is to design an algorithm focusing on priority and synthesis; remember: there’s a lot of things you don’t need to calculate or “know” the answer if you get a more practical answer before, the trick of an optimized algorithm, engine or “gameflow” is to make the right questions, choosing the right order.
Like always, sorry for my english and good luck.