A complete breakdown of the Bomberman AI project, including gameplay features, AI logic, and file structure.
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.
Watch the full gameplay demo here:
๐ https://www.youtube.com/watch?v=fGdCZeGzFvk
This project recreates the traditional Bomberman experience with added AI enhancements.
- Move: Up, Down, Left, Right
- Drop bombs to destroy soft walls and enemies
- Navigate the grid intelligently
- Place bombs strategically
- Avoid explosions
- Hunt down the player
- Soft walls can be destroyed by bombs
- Hard walls remain indestructible
- Win: All bots defeated
- Lose: Player runs out of HP or gets caught in an explosion
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.
Every bot operates on 3 core states:
Bot searches for soft walls to destroy while exploring the map.
Triggered when bot detects the player within its vision range.
Bot actively moves towards the player.
Activated when bot detects danger (bomb blast radius).
Bot immediately searches for safe tiles.
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.
Bots:
- Identify up to 5 nearest safe tiles
- Evaluate each tile based on openness (number of walkable neighbors)
- Choose the safest + most open tile
- Navigate toward it
This prevents bots from running into dead ends.
Bots simulate future states using:
bot_can_escape_after_placing()
Before placing a bomb, they check if they can escape before it explodes.
If a path becomes unsafe (bomb placed mid-route), bot cancels the path and recalculates.
The settings.py file allows customization of gameplay and AI behavior.
Controls how frequently bots place bombs when chasing.
- Low = cautious bots
- High = extremely aggressive bots
How far bots can โseeโ the player (in tiles).
Controls game speed. Lower = faster gameplay.
Tune difficulty for the player.
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
- Python 3.7+
- tkinter (usually comes with Python)
# 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- Arrow Keys / WASD: Move player
- Space: Place bomb
- Q / ESC: Quit game
- 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
- Adjustable game speed
- Configurable bot count and aggression
- Variable player power and bomb capacity
- Selectable pathfinding algorithm and heuristic
- Modular code organization
- Separation of concerns (game logic, AI, UI, entities)
- Easy to extend and maintain
config.py: All game constants (dimensions, timing, entity properties)
utils.py: Time tracking and distance calculations
entities.py: Entity classes (Player, Bot, Bomb, Explosion)
map.py: Procedural map generation with hard/soft walls
pathfinding.py: Pathfinding algorithms with configurable heuristics
settings.py: Pre-game settings screen with algorithm selection
Main game engine handling game loop, entity management, collision detection, and rendering
