Skip to content

VARUN3WARE/Bomberman-AI-Project-Group-17-CSL304-Artificial-Intelligence-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Bomberman (Tkinter) โ€“ AI Project README

iamge

A complete breakdown of the Bomberman AI project, including gameplay features, AI logic, and file structure.

โญ Overview

This is a classic Bomberman game implemented in Python (Tkinter) with intelligent AI-controlled bots.
The player and bots move around a destructible grid environment, placing bombs, avoiding explosions, and trying to be the last one alive.


๐ŸŽฌ Project Demo Video

๐Ÿ“Œ YouTube Link

Watch the full gameplay demo here:
๐Ÿ‘‰ https://www.youtube.com/watch?v=fGdCZeGzFvk


๐Ÿ”ฅ Core Features & Gameplay

This project recreates the traditional Bomberman experience with added AI enhancements.

โ–ถ๏ธ Player Controls

  • Move: Up, Down, Left, Right
  • Drop bombs to destroy soft walls and enemies

๐Ÿค– AI Bots

  • Navigate the grid intelligently
  • Place bombs strategically
  • Avoid explosions
  • Hunt down the player

๐Ÿงฑ Destructible Environment

  • Soft walls can be destroyed by bombs
  • Hard walls remain indestructible

๐Ÿ† Win/Loss Conditions

  • Win: All bots defeated
  • Lose: Player runs out of HP or gets caught in an explosion

๐Ÿง  AI and Bot Logic

The AI system is the heart of this game. It uses a layered approach with a state machine, A* pathfinding, evasion scoring, and safety checks.


1๏ธโƒฃ State Machine

Every bot operates on 3 core states:

๐Ÿ”น search (Default)

Bot searches for soft walls to destroy while exploring the map.

๐Ÿ”น chase

Triggered when bot detects the player within its vision range.
Bot actively moves towards the player.

๐Ÿ”น evade (Highest Priority)

Activated when bot detects danger (bomb blast radius).
Bot immediately searches for safe tiles.


2๏ธโƒฃ Pathfinding โ€“ A* Algorithm

Bots use A* to navigate the map efficiently.

  • Heuristic: Manhattan distance
  • Pathfinding implemented in: pathfinding.py
  • Supports:
    • Avoiding bombs
    • Avoiding dangerous tiles
    • Avoiding forbidden zones

The algorithm returns an optimal path from start โ†’ target.


3๏ธโƒฃ Intelligent Movement & Evasion

โœ” Improved Myopic Evasion Fix

Bots:

  1. Identify up to 5 nearest safe tiles
  2. Evaluate each tile based on openness (number of walkable neighbors)
  3. Choose the safest + most open tile
  4. Navigate toward it

This prevents bots from running into dead ends.

โœ” Bomb Placement Safety Check

Bots simulate future states using:

bot_can_escape_after_placing()

Before placing a bomb, they check if they can escape before it explodes.

โœ” Path Interruption

If a path becomes unsafe (bomb placed mid-route), bot cancels the path and recalculates.


โš™๏ธ Game Settings & Their Impact

The settings.py file allows customization of gameplay and AI behavior.

๐Ÿ”ธ bot_aggression (0.1 โ†’ 1.0)

Controls how frequently bots place bombs when chasing.

  • Low = cautious bots
  • High = extremely aggressive bots

๐Ÿ”ธ bot_vision

How far bots can โ€œseeโ€ the player (in tiles).

๐Ÿ”ธ game_tick_ms

Controls game speed. Lower = faster gameplay.

๐Ÿ”ธ player_max_bombs / player_bomb_power

Tune difficulty for the player.


๐Ÿ“ Project Structure

The project follows a clean, modular architecture with organized source code:

.
โ”œโ”€โ”€ main.py                     # Application entry point
โ”œโ”€โ”€ README.md                   # Project documentation
โ”œโ”€โ”€ Group17_projectReport.pdf   # Detailed project report
โ”œโ”€โ”€ assets/                     # Media files (demo video)
โ”‚   โ””โ”€โ”€ bombermanai.mp4
โ””โ”€โ”€ src/                        # Source code (organized)
    โ”œโ”€โ”€ game.py                 # Main game loop & rendering
    โ”‚
    โ”œโ”€โ”€ core/                   # Core utilities & config
    โ”‚   โ”œโ”€โ”€ config.py           # Game constants
    โ”‚   โ””โ”€โ”€ utils.py            # Helper functions
    โ”‚
    โ”œโ”€โ”€ game_objects/           # Game entities
    โ”‚   โ”œโ”€โ”€ entities.py         # Player, Bot, Bomb classes
    โ”‚   โ””โ”€โ”€ map.py              # Map generation
    โ”‚
    โ”œโ”€โ”€ ai/                     # AI & pathfinding
    โ”‚   โ””โ”€โ”€ pathfinding.py      # A*, Dijkstra, BFS
    โ”‚
    โ””โ”€โ”€ ui/                     # User interface
        โ””โ”€โ”€ settings.py         # Settings screen

๐Ÿš€ Installation & Running

Prerequisites

  • Python 3.7+
  • tkinter (usually comes with Python)

Run the Game

# Clone the repository
git clone https://github.com/VARUN3WARE/Bomberman-AI-Project-Group-17-CSL304-Artificial-Intelligence-.git

# Navigate to project directory
cd Bomberman-AI-Project-Group-17-CSL304-Artificial-Intelligence-

# Run the game
python main.py

Game Controls

  • Arrow Keys / WASD: Move player
  • Space: Place bomb
  • Q / ESC: Quit game

๐ŸŽฏ Features

โœจ Intelligent AI System

  • State Machine: Search โ†’ Chase โ†’ Evade behaviors
  • Multiple Pathfinding Algorithms: A*, Dijkstra, BFS
  • Multiple Heuristics: Manhattan, Euclidean, Chebyshev
  • Smart Evasion: Evaluates safe zones and escape routes
  • Safety Checks: Won't place bombs without escape path

๐ŸŽฎ Customizable Gameplay

  • Adjustable game speed
  • Configurable bot count and aggression
  • Variable player power and bomb capacity
  • Selectable pathfinding algorithm and heuristic

๐Ÿ—๏ธ Clean Architecture

  • Modular code organization
  • Separation of concerns (game logic, AI, UI, entities)
  • Easy to extend and maintain

๐Ÿงฉ Module Descriptions

src/core/

config.py: All game constants (dimensions, timing, entity properties)
utils.py: Time tracking and distance calculations

src/game_objects/

entities.py: Entity classes (Player, Bot, Bomb, Explosion)
map.py: Procedural map generation with hard/soft walls

src/ai/

pathfinding.py: Pathfinding algorithms with configurable heuristics

src/ui/

settings.py: Pre-game settings screen with algorithm selection

src/game.py

Main game engine handling game loop, entity management, collision detection, and rendering

About

An AI-powered Bomberman game built using Python and Tkinter, featuring intelligent bot agents with pathfinding, bomb avoidance, strategic movement, and real-time gameplay simulation. Developed as part of the CSL304 Artificial Intelligence course by Group 17.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages