5/5/10

Summary

This 3D Chinese chess game is completely written in Java. The basic GUI part is constructed with widget toolkit Swing, and the 3D graphics part is constructed with Java 3D API.

Game features:
  1. The game is written in Java, which means it can be played on web browser. Of course, it's necessary to modify pieces of code using, such as, Java applet.
  2. When you press left button of mouse on a piece, all possible moves of the piece will be displayed on the chess board. This is a big different from other similar Chinese chess game.
  3. This game allows you doing drag & drop operation on a piece to achieve movement. But most of other chess games don't.
Weak points:
  1. Chess AI of this game is weak. Actually, if I have much more knowledge about AI, I think I can write a better one than now.
  2. No shadows for the pieces. Since in Java 3D, the shadow is geometry object, and it's position must be dynamically computed while the piece is moving. So, creating shadows is a little bit hard. (Java 3D tutorial chapter 6 talks about how does shadow mechanism work.)

5/2/10

AI

This game supports three levels of chess AI which the level 3 is the most difficult one. The AI level can be changed through game option menu. The default level is 2.

Description of three AI levels:
  1. AI makes a random move. Even though the move is randomly picked from all possible moves. However, the probability that the AI move attacks your (red) pieces is bigger than the probability that it doesn't.
  2. Be careful, at this level, AI will try to attack your (red) General and defend black General as possible as it can.
  3. For each piece, AI assigns it an appropriate point. And for all positions on the board, AI gives them different points, that the more important position has more bigger point. For all possible moves, AI evaluates each of them and picks the best move which has biggest point. Of course, the level 1 and 2 are still valid at this level.

4/12/10

New piece appearance

Without Chinese character support in Java environment, when you run this chess game on your PC, you probably will get a view as same as following figure. Since each piece consists of a Chinese character and a body shape, and both of them are 3D objects. Therefore, if your PC doesn't have Chinese character font, such as "HG明朝B", "HG正楷書体-PRO" or "HGゴシックM" etc, then the Chinese character of the piece will not be rendered.

Thus, to avoid above case, I decided to use texture image to wrap each piece. The next two figures show that pieces with Chinese character images and figuer images on the surfaces, respectively.


In order to switch these two kinds of piece appearance, I added a new "Design" menu item to "Game" menu. Players can change piece appearance whenever they want.