If you answered yes to one of these
questions, I think you will appreciate this article. Indeed, here I
offer you a variation of the chinese checkers game... on a spherical
board ! This was already done for chess, but I think it is the first
time for chinese checkers. So, just stop to speak now and have a
game.
Choose to play against a friend on the same computer (Human VS Human), against the machine (Human VS AI), or just see the machine against herself. Then, drag the screen to navigate around the
sphere and just follow instructions :
This project was a good opportunity for
me to learn more about Unity 3D, C#, data structures and IA.
First I built the board in 3D Studio
Max (from the geosphere primitive) and then I imported it into Unity.
The most boring part in my C# code was to write a parser able to
analyze the mesh board structure and generate automatically the core
graph data structure. Indeed, it was out of question to generate the
graph structure "by hand" ; I wanted a flexible solution,
able to work quickly with new board designs without any long and
boring new configurations. So maybe the next version of the game will
offer you a large set of original boards, with some strange
topologies...
Then I built my game code following a
very simple MVC pattern. If you are curious about how we can apply
MVC to board games, I think it will be interesting for you to look
into my package structure. Maybe you could think that this is a very large package for such a simple game, but I always work in a way that allow me to extend my projects. Here my package structure is suitable to add new boards, new AI, new game modes...
- [_] chineseCheckers
- [_] controlers
- [_] ai
- AIControler
- DistanceTable
- [_] human
- HumanControler
- AbstractControler
- MoveData
- [_] data
- CellData
- DataManager
- [_] games
- AbstractGame
- AIVsAIGame
- HumanVsAIGame
- HumanVsHumanGame
- [_] gui
- [_] elements
- InGameHud
- Menu
- GameGui
- [_] navigator
- DragNavigator
- [_] parser
- BoardParser
- [_] view
- Cell3D
- CellColors
- Pawn
- View
[_] FOLDER
CLASS
Finally, I coded an AI, trying to keep it very simple and CPU-light. I will explain the algorithm in a future article, but you can see now that it is very fast (so fast that I must slow-down the run in order to keep the "AI vs AI" game comprehensible).
I hope you enjoyed the game !
No comments:
Post a Comment