Skip to content

kavin553/AI_ENEMY_ATTACK_GAME

Repository files navigation

<title>🧠 AI Enemy Dungeon Game</title>

🧠 AI Enemy Dungeon Game 🎮

A 2D dungeon game built from scratch in Python where enemies learn using Reinforcement Learning.
Not just a game — an AI experiment you can play.


🚀 Project Overview

AI Enemy Dungeon Game is a 2D top-down dungeon game developed using Python + Pygame, where enemies are powered by Reinforcement Learning (Q-Learning).

Unlike traditional games with fixed enemy behavior, enemies in this game learn from player actions, adapt strategies, and become smarter over time.

🎯 This project is designed for:

  • 🧑‍🎓 Students & beginners in AI
  • 🎮 Game development learners
  • 🤖 Understanding Reinforcement Learning visually
  • 📂 Portfolio & GitHub showcase
🔗 **ENJOY😍TO🥰PLAY🎮GAME:** https://ai-enemy-attack-game-cs15.vercel.app/

🎬 Game Start Screen

The game begins with a clean and minimal start menu.

Start Screen

  • ▶️ Press ENTER to start the game
  • 🎨 Simple UI for instant understanding

🕹️ Gameplay & HUD

During gameplay, the player sees a real-time HUD showing:

  • ❤️ Player Health
  • ⭐ Score
  • 📈 Level Progression
  • 🧠 Enemy Learning Status

Gameplay HUD


🧍 Player Character

You control the player using keyboard controls.

Player Character

  • ⌨️ Controls: W A S D
  • 🚶 Smooth movement
  • 🧱 Boundary-restricted inside the dungeon

👾 AI Enemy (Reinforcement Learning)

Enemies are not scripted — they learn using Q-Learning.

Enemy Character

Enemy behavior includes:

  • 🔁 Observing player position
  • 🎯 Choosing actions (CHASE / RUN / ATTACK)
  • 📊 Receiving rewards & penalties
  • 🧠 Improving decisions over time

The enemy’s learning is saved and loaded automatically using pickle.


🗺️ Dungeon Floor & Environment

The dungeon world is created using a tile-based map system.

Game Map

  • 🟩 Repeating floor tiles
  • 📐 Grid-based movement
  • 🎨 Pixel-art style environment

📈 Level Progression

As the score increases:

  • ⬆️ Level increases
  • 👾 New enemies spawn
  • ⚡ Difficulty increases

This ensures replayability and challenge.


🔊 Sound Effects

  • 💥 Collision sound using pygame.mixer
  • 🎧 Improves game feel and feedback

⌨️ Controls

KeyAction
ENTERStart Game
W A S DMove Player
RRestart Game
Close WindowExit Game

🛠️ Technologies Used

  • 🐍 Python
  • 🎮 Pygame
  • 🧠 Reinforcement Learning (Q-Learning)
  • 💾 Pickle (AI memory)

🏁 Final Note

This project demonstrates that:

  • ✅ Games can teach AI concepts
  • ✅ Reinforcement Learning can be visual
  • ✅ Python is powerful for game + AI projects

⭐ If you like this project, consider giving it a star!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors