# Checkers Logic Package for Unity
A fully customizable and extensible checkers engine for Unity, supporting both 2D and 3D gameplay. Designed for easy integration, flexible visuals, and robust game logic, this package is ideal for developers who want to add checkers mechanics to their projects or build a complete checkers game.
## Features
- **2D & 3D Checkers Support:** Seamlessly switch between 2D and 3D board layouts.
- **Customizable Grid:** Set grid size and cell size to fit your game’s needs.
- **Piece Prefabs:** Assign your own prefabs for each piece type (Man, King) for full visual control.
- **Flexible Board Setup:** Easily modify board appearance and layout.
- **Layer Management:** Squares and pieces are auto-assigned to layers for correct interaction and rendering.
- **Parenting Structure:** Pieces and move plates are organized under parent objects for clean scene management.
- **Game Modes:** Supports Player vs Player, Player vs Bot, and Bot vs Bot.
- **AI Bot:** Built-in bot logic for single-player or AI vs AI games.
- **Undo, Redo, and Replay:** Integrate the `RecorderManager` for full move history, undo/redo, and replay functionality.
- **UI Integration:** Includes UI scripts and templates for game screens, stats, and controls.
- **Editor-Friendly:** Designed for Unity’s built-in tools and workflows.
- **Extensible Logic:** Each piece (Man, King) has its own script for easy customization of movement and rules.
## Getting Started
### 1. Add the Checkers Component
- Attach the `Checkers` component to a GameObject in your scene.
- Assign your piece prefabs (Man, King) in the inspector.
- Set the grid size and cell size as needed.
### 2. Configure Game Mode
- For Player vs Player, no extra setup is needed.
- For Player vs Bot or Bot vs Bot:
- Add a `Bot` component to the scene.
- Reference the `Bot` in the `Checkers` component.
- Set the desired team for the bot (Black or White).
### 3. Enable Undo/Redo/Replay
- Add a `RecorderManager` component to your scene.
- Reference it in the `Checkers` and `GamePlay` components and subscribe to its UndoRedoCommand delegate
- This enables move history, undo/redo, and replay features.
### 4. UI and Visuals
- Use the provided UI Toolkit assets and scripts (see `Runtime/Scripts/UI`) for game screens, stats, and controls.
- Customize or extend the UI as needed.
## Advanced Features
- **Custom Rules:** Extend the `Man` and `King` scripts to implement custom movement or capture rules.
- **Game State Tracking:** The `BoardInfo` and `RecorderManager` handle full game state serialization for saving/loading and replay.
- **Statistics:** Track wins, losses, streaks, and more via the built-in stats system.
- **Visual Feedback:** UI scripts provide turn indicators, game over screens, and stats panels.
## Example Scene Setup
1. Create an empty GameObject and add the `Checkers` component.
2. Assign your piece prefabs and configure the grid.
3. (Optional) Add a `Bot` component and set its team.
4. (Optional) Add a `RecorderManager` for undo/redo/replay.
5. Add the provided UI prefabs or use your own.
## Folder Structure
- `Runtime/Scripts/Logic/` – Core game logic (Checkers, Bot, RecorderManager, BoardInfo, Man, King, Cell)
- `Runtime/Scripts/UI/` – UI scripts and templates
- `Documentation/` – This README and additional docs
## Extending the Package
- Add new piece types or rules by extending the base scripts.
- Customize the UI or integrate with your own menu systems.
- Use the event system to hook into moves, promotions, and game state changes.
## Support
_Email_:bluebilly111@gmail.com