# Mice!

Mice! is a strategic game where players must kill rats with bombs before they reproduce and become too numerous. The game is a clone of the classic game Rats! for Windows 95.
## Compatibility
*It's developed in Python 3.11, please use it*
## Features

- **Maze Generation**: Randomly generated mazes using Depth First Search (DFS) algorithm.
- **Units**: Different types of units such as rats, bombs, and points with specific behaviors.
- **Graphics**: Custom graphics for maze tiles, units, and effects.
- **Sound Effects**: Audio feedback for various game events.
- **Scoring**: Points system to track player progress.

## Technical Details

- **Language**: Python 3
- **Libraries**: 
    - `sdl2` for graphics and window management
    - `Pillow` for image processing
    - `uuid` for unique unit identification
    - `subprocess` for playing sound effects
    - `tkinter` for maze generation visualization
- **Game Loop**: The game uses a main loop to handle events, update game state, and render graphics.
- **Collision Detection**: Each unit checks for collisions with other units and walls.
- **Sound Management**: Sound effects are managed using the `subprocess` module to play audio files.
- **Environment Variables**: 
    - `SDL_VIDEODRIVER` to set the video driver
    - `RESOLUTION` to set the screen resolution
- **Engine**: The game engine is built using SDL2, providing efficient rendering and handling of game events. The engine supports:
    - **Image Loading**: Using `Pillow` to load and process images.
    - **Text Rendering**: Custom fonts and text rendering using SDL2's text capabilities.
    - **Sound Playback**: Integration with SDL2's audio features for sound effects.
    - **Joystick Support**: Handling joystick input for game controls.
    - **Window Management**: Fullscreen and windowed modes, with adjustable resolution.

## Installation

1. **Clone the repository**:
        ```bash
        git clone https://github.com/yourusername/mice-maze-game.git
        cd mice-maze-game
        ```
2. **Create a virtual environment**:
        ```bash
        python3 -m venv venv
        source venv/bin/activate
        ```
3. **Install the dependencies**:
        ```bash
        pip install -r requirements.txt
        ```
4. **Run the game**:
        ```bash
        python rats.py
        ```

## Project Files

- `maze.py`: Contains the `MazeGenerator` class for generating and visualizing the maze.
- `rats.py`: Main game file that initializes the game and handles game logic.
- `engine/controls.py`: Contains the `KeyBindings` class for handling keyboard input.
- `engine/maze.py`: Contains the `Map` class for loading and managing the maze structure.
- `engine/sdl2.py`: Contains the `GameWindow` class for SDL2 window management and rendering.
- `units/bomb.py`: Contains the `Bomb` and `Explosion` classes for bomb units.
- `units/rat.py`: Contains the `Rat`, `Male`, and `Female` classes for rat units.
- `units/points.py`: Contains the `Point` class for point units.
- `assets/`: Directory containing game assets such as images and fonts.
- `sound/`: Directory containing sound effects.
- `README.md`: This file, containing information about the project.
- `requirements.txt`: Lists the Python dependencies for the project.
- `.env`: Environment variables for the project.
- `.gitignore`: Specifies files and directories to be ignored by Git.
- `scores.txt`: File for storing high scores.

