You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Matteo Benedetto d31de92758 Rimuovi parametri non necessari dalla riproduzione audio e semplifica la gestione delle posizioni del testo 12 months ago
assets Aggiungi gestione dei controlli da tastiera e migliora la logica di spawn delle unità 1 year ago
conf Aggiorna la gestione dei tasti e aggiungi nuovi file di configurazione per le schermate di pausa e menu di avvio 12 months ago
engine Rimuovi parametri non necessari dalla riproduzione audio e semplifica la gestione delle posizioni del testo 12 months ago
sound Aggiungi file di configurazione per i binding dei tasti e implementa la gestione degli input nel gioco 12 months ago
units Aggiungi file di configurazione per i binding dei tasti e implementa la gestione degli input nel gioco 12 months ago
.gitignore Aggiungi .env e rats.spec al file .gitignore 1 year ago
README.md Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto 12 months ago
cover.jpg Aggiungi file di configurazione per i binding dei tasti e implementa la gestione degli input nel gioco 12 months ago
get-pip.py Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto 12 months ago
get-venv.py Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto 12 months ago
imgui-test.py Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto 12 months ago
imgui.ini Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto 12 months ago
maze.json Aggiungi la classe Point e implementa la gestione delle esplosioni nel gioco 1 year ago
maze.py Aggiungi la classe Point e implementa la gestione delle esplosioni nel gioco 1 year ago
opengl.test.py Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto 12 months ago
pyglet-test.py Aggiungi implementazione di EGL per la gestione del contesto OpenGL 12 months ago
rats Modifica il percorso di caricamento delle immagini nella classe GameWindow; aggiungi file di configurazione per PyInstaller 1 year ago
rats.py Aggiorna la gestione dei tasti e aggiungi nuovi file di configurazione per le schermate di pausa e menu di avvio 12 months ago
requirements.txt Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto 12 months ago
sdl2-demo.py Aggiorna la gestione della finestra di gioco, modifica la dimensione e il ritardo di rendering, e cambia il suono della bomba 1 year ago
sdl2-tk-demo.py Modifica il sistema di rendering SDL e migliora la gestione delle unità nel gioco 1 year ago
testwindow.py Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto 12 months ago
wgdzh Aggiungi file di configurazione per i binding dei tasti e implementa la gestione degli input nel gioco 12 months ago

README.md

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.