Board Game Dama
Tools & keywords
React, vanilla JavaScript, Sass, Figma, netlify, Visual studio code, Github.
Article
Check out the Game:
Project Overview:
- The project involved creating a SaaS (Software as a Service) board game called "Dama."
- The game was developed using React as the primary framework for building the user interface and managing component interactions.
- Vanilla JavaScript was utilized alongside React to implement additional functionality and customize game mechanics.
- Sass was employed as a CSS preprocessor to enhance the styling of the game's user interface, including the implementation of animations to bring the game to life with visually engaging effects.
- Implemented responsive design to ensure the game works well on various devices (tablets and phones).
- Deployed the project on Netlify.
Development Process:
- I used an agile approach in the Dama project, which means I worked in short cycles, focused on important tasks, constantly improved, and adapted to changes.
- Initial planning: driven by my passion for 'dama' board game. I often faced challenges finding suitable playing locations or carrying the physical board everywhere. This prompted me to explore existing online options, but I couldn't find a platform that served the Algerian rules of Dama. Motivated by my passion for coding and desire to pursue a professional career in web development, I created an online SaaS Dama game to overcome the challenges of finding suitable playing locations and the inconvenience of carrying physical boards. The objective was to make the game easily accessible, offering a convenient and enjoyable alternative for individuals encountering similar issues.
- Data structures used :
- In JavaScript: Arrays, Trees
- In React: Component, State, Props, Ref
- The hookes used in React: usestate, useEffect, useRef
Functionalities Developed Within the Game:
The game is played on a 10x10 checkerboard , with alternating dark and light squares. Each player starts with 20 pieces placed on the dark squares.- Movement:
- Pieces move diagonally forward (towards the opponent's side) to an adjacent empty square.
- Regular pieces (not kings) can only move forward.
- Diagonal moves can be made to the left or right.
- Capturing:
- If a player's pawn is adjacent to an opponent's pawn and there is an empty square beyond it, the player can jump over the opponent's pawn and capture it.
- Multiple captures can be made in a single turn if they are in the diagonal line.
- capturing is mandatory, and the player must continue capturing until no more captures are possible
- Promotion to Kings:
- When a regular pawn reaches the last row on the opponent's side of the board, it is promoted to a "king" pawn .
- King pawns have the ability to move both forward and backward.
- Kings Pawns Capturing:
- The king in Dama can capture both forward and backward and has the ability to make multiple captures in a single turn, as long as there are additional opponent's pieces available for capture in the chosen direction.
- It is always required to capture the maximum number of opponent's pawns available.
- Winning:
- The game ends when one player captures all of their opponent's pieces, or when the opponent has no legal moves left. The player with remaining pieces or no legal moves loses the game
Challenges faced:
To create a Dama game, I faced several challenges, and in order to overcome them, I had to implement some very complex logic. In the process of building the Dama game, I encountered the following difficulties:- Game Logic: Designing the core game mechanics, such as pawn movement, capturing, and promoting pawns to kings, king capturing, Mandatory capturing and continuous capturing, required careful planning and implementation.
- Board Representation: Creating an efficient data structure to represent the game board, manage the positions of pieces, and handle moves was crucial for smooth gameplay.
- Turn Management: Ensuring proper turn management for each player, detecting valid moves, and handling turn switches were essential for a playable game.
- Rules Enforcement: Enforcing the specific rules of Dama, such as mandatory captures and king movement, demanded meticulous rule-checking logic.
- Modular Design: Breaking down the game logic into smaller, manageable functions and modules improved code organization and maintainability.
- Testing and Debugging: Rigorous testing and debugging helped identify and resolve issues in the game's behavior and logic.
- Optimization: Profiling and optimizing critical parts of the code improved the game's performance and responsiveness.
- Algorithm Refinement: Iteratively improving the AI algorithm and experimenting with different strategies helped create a challenging opponent for single-player mode.
- Documentation and Research:Documenting the challenges and solutions and conducting research on Dama's rules and strategies aided in better understanding the game and making informed decisions.
Deployment and Hosting:
I have deployed and hosted the Dama game on Netlify. Netlify provides an excellent platform for seamless deployment and hosting of web applications, offering features like continuous deployment, easy scalability, and reliable performance. By utilizing Netlify's services, players can access and enjoy the Dama game with smooth and efficient gameplay experiences.Conclusion:
In conclusion, My Gains from Developing this Project:- Enhanced Development Skills: The project provided valuable experience in working with React, Vanilla JavaScript, and Sass, improving coding proficiency.
- Problem-Solving: Overcoming challenges in game logic and rules enforcement honed problem-solving abilities.
- Deployment Experience: Deploying the game on Netlify expanded knowledge of continuous deployment and hosting.
- Passion for Gaming: Combining a passion for the Dama board game with web development fostered a rewarding and enjoyable project.
- Potential for Growth: Future expansion plans, including a mobile app version and Facebook game, offer opportunities for further development and reaching a wider audience.