Skip to content

Repository files navigation

Arcade Icon

🎮 Python Offline Arcade

Python Version Pygame Version License

A beautifully designed collection of classic offline multiplayer games built with Python and Pygame. Featuring a unified cyberpunk/neon theme, this arcade brings your favorite tabletop and logic games to your screen.

✨ Features

  • Welcome Page: A beautiful introductory screen that greets you before entering the arcade.
  • Unified UI/UX: A sleek arcade menu to select and launch games seamlessly.
  • Local Multiplayer: Grab a friend and play together on the same keyboard/screen.
  • Persian Language Support: Custom utility rendering for right-to-left fonts.
  • Single-Player AI: Challenge intelligent bots in Chess, Tic-Tac-Toe, Dots and Boxes, Snake Duel, Pac-Man, Backgammon, Connect Four, Bomberman, Pong, Flappy Bird, and Billiards.
  • Current Games Included:
    • ♔♕♖♗♘♙ Chess
    • ⚅🎲 Backgammon
    • ❌🟢 Tic-Tac-Toe
    • 🐍 Snake Duel
    • 💣💥 Minesweeper
    • 🐉🎲➡⬆ Snakes and Ladders
    • •🖊️▀▄▀▄▀▄ Dots and Boxes
    • 🎴🤔❓ Memory Cards
    • 🚢 Battleship
    • ᗧ•••ᗣ Two-Player Pac-Man
    • 🔴🟡 Connect Four
    • 💣🔥 Bomberman
    • 🪓🌲 Lumberjack Battle
    • ⌨👨‍💻 Typing Race
    • 🎱 Billiards (8-Ball with physics)
    • 🐤🕹️ Flappy Birds
    • 🏓 Pong (with power-ups)

📸 Game Previews

Billiards Flappy Birds
billiards flappybird
Bomberman Backgammon
bomberman backgammon
Pacman Duel Memory Cards
pacman Memory
Dots and Boxes Snake Duel
Dots Snake
Battleship Lumberjack
battleship lumberjack_battle
SnakeLadders Tic Tac Toe
snakeandladders tictactoe

🤖 AI Implementation

I have implemented intelligent, custom-built AI agents for several major games to provide a challenging single-player experience. Each AI is tailored to the specific rules and tactical depth of the game:

  • Chess: Implemented using a Greedy Material Evaluation Heuristic. The bot leverages the python-chess framework to scan all legal_moves, simulates potential captures, and scores them based on standard chess weights (Pawn: 1, Knight/Bishop: 3, Rook: 5, Queen: 9) to execute the highest-value tactical move.
  • Backgammon: Features a Rule-Based Heuristic Agent designed around standard backgammon probabilities and risk management:
    • Valid Move Evaluation: Automatically calculates all combinations of available dice rolls.
    • Strategic Priority: Prioritizes hitting opponent blots (exposed checkers), creating secure blocks (anchors) with two or more checkers, and moving vulnerable home-board pieces to safety.
    • Bearing Off: Optimizes efficiency during the final phase to bear off checkers as quickly as possible.
  • Snake Duel: Utilizes a multi-layered pathfinding and survival process:
    • BFS (Breadth-First Search): Calculates the absolute shortest path to food items.
    • Flood Fill Algorithm: Acts as a vital survival mechanism, performing real-time spatial analysis of the remaining grid to avoid trapping itself in "dead ends."
  • Dots and Boxes: Employs a strategic priority-based agent:
    • Capture Optimization: Prioritizes lines that immediately complete a box for scoring.
    • Chain Control: Evaluates potential board outcomes to avoid creating the 3rd edge of any box, preventing the opponent from capturing multiple boxes in a chain.
  • Tic-Tac-Toe: Utilizes the Minimax algorithm to ensure perfect play, making the AI unbeatable in this mode.
  • Two-Player Pac-Man: Features an advanced dual-layered AI system for both ghosts and bots:
    • Ghost AI: Implements precise pathfinding mimicking the original arcade logic, with states for Chase, Scatter, Frightened, and Dead. Ghosts dynamically calculate optimal routes and retreat intelligently when frightened.
    • Hard Bot AI: Utilizes Breadth-First Search (BFS) for dot consumption while maintaining a real-time "Ghost Danger Map" to predict and evade incoming ghost paths, ensuring maximum survivability.
  • Connect Four: Utilizes the Minimax algorithm with alpha-beta pruning. It evaluates the board state by scoring potential 4-in-a-row windows, ensuring optimal drops and proactively blocking player wins.
  • Bomberman: Features a dynamic Relentless Hunt AI that balances survival and aggression:
    • Survival & Pathfinding: Uses BFS and a real-time Danger Map to evade active bombs and flames.
    • Strategic Combat: Opportunistically plants bombs when aligned with the player, collects power-ups, and breaks soft walls to reach the target.

📂 Project Architecture

Click to expand full Directory Tree
Offline_Games/
│   assets/
│   ├───sounds/
│   base_game.py                      # Base class for game structure blueprint
│   main.py                           # Main application entry point & Arcade Hub menu
│   myicon.ico                        # Main application icon
│   persian_utils.py                  # Custom utilities for Persian RTL text rendering
│   setup_chess.py                    # Setup configuration script for Chess module
│   Vazirmatn-VariableFont_wght.ttf   # Custom Persian font asset
│   requirements.txt                  # Project dependencies
│   LICENSE                           # MIT License file
│   README.md                         # Project documentation
│   
└───games/                            # Package containing all core game modules
    │   __init__.py
    │
    ├───billiards/
    │   │ game.py
    │   │ icon.png
    │   │
    │   └───assets/
    │       ├───images/          # ball_1.png ... ball_16.png, cue.png, table.png
    │       └───sounds/          # cue.wav, cushion.wav, hit.wav, pocket.wav
    │
    ├───flappy_bird/
    │   │ game.py
    │   │ icon.png
    │
    ├───pong/
    │   │ game.py
    │   │ icon.png
    │
    ├───backgammon/
    │       game.py                   # Backgammon logic and board renderer
    │       icon.png                  # Game icon asset
    │       
    ├───battleship/
    │       game.py                   # Battleship naval warfare logic
    │       icon.png                  # Game icon asset
    │       
    ├───bomberman/
    │       game.py                   # Bomberman classic explosive action
    │       icon.png                  # Game icon asset
    │       
    ├───chess/
    │   │   game.py                   # Chess logic and UI wrapper
    │   │   icon.png                  # Game icon asset
    │   │   
    │   └───assets/pieces/            # Visual chess piece sprites (Black & White)
    │           bb.png, bk.png, bn.png, bp.png, bq.png, br.png
    │           wb.png, wk.png, wn.png, wp.png, wq.png, wr.png
    │           
    ├───connect_four/
    │       game.py                   # Connect Four grid and win checking logic
    │       icon.png                  # Game icon asset
    │       
    ├───dots_and_boxes/
    │       game.py                   # Dots and boxes grid calculation & UI
    │       icon.png                  # Game icon asset
    │
    ├───lumberjack_battle/
    │       sounds/
    │             chop.wav, crack.wav, die.wav            
    │       game.py                  
    │       icon.png                  # Game icon asset
    │  
    ├───memory_cards/
    │       game.py                   # Memory puzzle card matrix logic
    │       barbie.png, book.png, cat.png, computer.png, ... (Card pictures)
    │       icon.png                  # Game icon asset
    │       
    ├───minesweeper/
    │       game.py                   # Grid mine generation and logic
    │       icon.png                  # Game icon asset
    │       
    ├───pacman_duel/
    │   │   game.py                   # Pac-Man entities, maze logic, and AI
    │   │   maze.py                   # Classic map layout and grid definitions
    │   │   icon.png                  # Game icon asset
    │   │   
    │   └───pacman_sounds/            # Original sound effects (waka, eat, death, etc.)
    │           
    ├───SnakeLadders/
    │       game.py                   # Board traversal and dice-rolling logic
    │       icon.png                  # Game icon asset
    │       
    ├───snake_duel/
    │       sounds/                   
    │       game.py                   # Core duel mechanics and UI
    │       icon.png                  # Game icon asset
    │
    ├───typing_race/
    │       game.py                   
    │       icon.png                  # Game icon asset
    │
    └───tic_tac_toe/
            game.py                   # Grid matrix and Minimax state logic
            icon.png                  # Game icon asset

🚀 How to Play

For Casual Players (No code required)

  1. Go to the Releases page of this repository.
  2. Download the latest offline_games.exe file.
  3. Run the file and enjoy the games!

For Developers

To run the game from the source code:

  1. Clone this repository:

    git clone https://github.com/MAINMMTTMAIN/Offline-Games.git
  2. Install the required dependencies:

    pip install -r requirements.txt
  3. Run the main file:

    python main.py

    or

    py main.py

🗺️ Roadmap (Upcoming Features)

I am actively working on adding more games and features. Contributions are highly welcome!

[ ] 🎳 Bowling

[ ] ✂️ Rock Paper Scissors

[ ] 🎯 Darts

[ ] 🛸 Space Shooter (1v1)

🤝 Contributing

Got an idea for a new game? Want to improve the AI or the UI? Pull requests are more than welcome!

  1. Fork the project

  2. Create your feature branch (git checkout -b feature/AmazingFeature)

  3. Commit your changes (git commit -m 'Add some AmazingFeature')

  4. Push to the branch (git push origin feature/AmazingFeature)

  5. Open a Pull Request

📜 License

Distributed under the MIT License. See LICENSE for more information.

Made with ❤️ and Python

About

An expandable collection of local single-player and multiplayer games built with Python. Designed to bring together a variety of classic and original games in one place, with support for playing locally with friends or against AI opponents.

Topics

Resources

Stars

19 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages