Ai Dungeon Master
Ai Dungeon Master
Submitted By
SIBARANJAN DASH
Class: XII-A
CERTIFICATE OF RECOMMENDATION
This is to certify that the project entitled “AI DUNGEON MASTER” submitted
by SIBARANJAN DASH (Redg. ) to PM SHRI Kendriya
Vidyalaya No 1 Cuttack, Odisha, in partial fulfilment of requirements for the
project-work of AISSE CBSE– 2024-25 Computer Science (083) in PM SHRI
Kendriya Vidyalaya No 1 Cuttack is a bonafide record of work carried out by
him under our supervision and guidance during the academic year 2024-2025.
Date:
Principal
PM SHRI Kendriya Vidyalaya No. 1 Cuttack
CDA, Odisha, India
PM SHRI KENDRIYA VIDYALAYA NO. 1 CUTTACK
CERTIFICATE OF APPROVAL
This is to certify that we have examined the project entitled “AI DUNGEON
MASTER” submitted by SIBARANJAN DASH and hereby accord our
approval of it as a study carried out and presented in a manner required for its
acceptance in partial fulfilment of requirements for the project-work of AISSE
CBSE– 2024-25 Computer Science (083) in PM SHRI Kendriya Vidyalaya
No 1 Cuttack for which it has been submitted. It is to be understood that by
this approval that the undersigned do not necessarily endorse or approve any
statement made, opinion expressed or conclusion drawn therein but approve the
project only for the purpose for which it is submitted.
Signature: Signature:
ABSTRACT
AI Dungeon Master: An Intelligent Interactive Gaming Experience
The "AI Dungeon Master" project aims to revolutionize role-playing games by
integrating Python and MySQL to deliver a dynamic and immersive experience.
Using advanced AI-driven narratives and decision-making algorithms, the game
adapts in real-time to player choices, ensuring each session is unique.
Python's libraries drive the development of core game mechanics like natural
language processing, procedural content generation, and interactive storytelling.
This allows the AI Dungeon Master to understand player inputs, generate
responsive scenarios, and maintain an evolving narrative. Machine learning
models enhance the game's adaptability to player behaviours and preferences.
MySQL efficiently manages and stores essential data, including player progress,
game states, and narrative branches, ensuring smooth performance.
For the experience, I got and the things I have learned by doing this project, I am
very much thankful to the Department of Computer Science. The experience I got
by gathering requirements, designing the software and implementing it and the
problems I faced and the new things I learned by solving them are valuable for
the next steps of our live.
I have to acknowledge our supervisor Dr. Chandralekha who helped us in many
ways providing advices and showing the weaknesses of our system time to time.
She also helps me very much provided us the valuable comments and
feedbacks to improve our project.
Finally, I am very much thankful to the persons who supported us to make this
project a success.
SIBARANJAN DASH
Regd No:
PM SHRI Kendriya Vidyalaya No. 1 , Cuttack
TABLE OF CONTENTS PAGE NO
▪ DFD .............................................................................................. 9
▪ E-R DIAGRAM............................................................................ 10
In traditional tabletop RPGs, the Dungeon Master plays a pivotal role in guiding
the story, controlling non-player characters (NPCs), and creating immersive
environments. With advancements in artificial intelligence, we can leverage Python
to develop an AI Dungeon Master that can generate compelling narratives,adapt to
player choices, and simulate complex interactions.
This project will involve using natural language processing libraries and game
mechanics to create a responsive, interactive storytelling experience. You can craft
an AI that understands player inputs and generates contextually relevant
responses, enhancing the gameplay
OBJECTIVES: -
The objective of the AI Dungeon Master game project is to create a fun and
interactive text-based adventure game that uses AI to respond to player input.
The game should:
1
Text-based interface: The game will have a text-based interface, where players
input commands and receive feedback from the game.
AI-powered responses: The game will use AI to generate responses to player
input, making the game more dynamic and engaging.
Engaging storyline: The game will have an engaging storyline, with challenging
puzzles to solve and a rich game world to explore.
Non-player characters (NPCs): The game will have NPCs that players can interact
with, including shopkeepers, guards, and other characters.
Deliverables
The deliverables for the AI Dungeon Master game project are:
A working game: A working game that responds to player input and uses AI to
generate responses.
A user-friendly interface: A user-friendly interface that allows players to input
commands and receive feedback from the game.
A game design document: A game design document that outlines the game's
mechanics, storyline, and features.
A test plan: A test plan that outlines how the game will be tested and evaluated.
2
FEASIBILITY STUDY
Introduction
The AI Dungeon Master game is a text-based adventure game that uses Python
and MySQL. The game is designed to be played on a command-line interface.
Technical Feasibility
The technical feasibility of the AI Dungeon Master game is high. We are using
Python and MySQL, which are easy to learn and use.
Technical Requirements
The technical requirements for the AI Dungeon Master game are as follows:
Hardware: A computer with Python and MySQL installed.
Software: Python 3.x and MySQL 8.x.
Technical Risks
The technical risks associated with the AI Dungeon Master game are as
follows:
Database Errors: The database may not work properly, which could result in
errors.
Code Errors: The code may have errors, which could result in unexpected
behavior.
Operational Feasibility
The operational feasibility of the AI Dungeon Master game is high. The game is
designed to be easy to use and understand.
3
Operational Requirements
The operational requirements for the AI Dungeon Master game are as
follows:
User Support: The game requires user support, including documentation and
troubleshooting.
Maintenance: The game requires regular maintenance, including updates and
bug fixes.
Financial Feasibility
The financial feasibility of the AI Dungeon Master game is high. The game is
designed to be low-cost, with minimal development and maintenance costs.
Conclusion
The AI Dungeon Master game is a technically feasible, operationally feasible, and
financially feasible project. However, there are risks associated with the project,
including technical risks and operational risks.
Recommendations
Based on the feasibility study, the following recommendations are made:
Test the game regularly: Test the game regularly to ensure that it is working
properly.
Fix errors: Fix errors as soon as they are found.
Keep the game simple: Keep the game simple and easy to use.
By following these recommendations, the AI Dungeon Master game can be
successfully developed and launched.
4
SYSTEM REQUIREMENT SPECIFICATION
To run an AI Dungeon Master application using Python and MySQL, you'll need
the following system requirements:
Hardware Requirements
1. Processor: Dual-core processor or better.
2. RAM: Minimum 8 GB (16 GB recommended for better performance).
3. Storage: At least 500 MB of free disk space for the application and MySQL
database.
Software Requirements
1. Operating System:
- Windows (10 or later)
- macOS (10.14 or later)
- Linux (Ubuntu 20.04 or later)
2. Python:
- Version 3.6 or higher.
- Install required libraries (e.g., MySQL-connector-python, `pandas).
3. MySQL:
- MySQL Server version 5.7 or higher.
- MySQL Workbench or another management tool for database administration
5
SYSTEM DESIGN
Overview
The AI Dungeon Master game is a text-based adventure game that uses Python and
MySQL. The game is designed to be played on a command-line interface.
System Components
The system consists of the following components:
User Interface: The user interface is a command-line interface that allows players to
input commands and receive feedback from the game.
Game Engine: The game engine is a Python script that processes player input and
generates responses based on the game state.
Database: The database is a MySQL database that stores game data, including player
information and game state.
Game Engine
The game engine is responsible for processing player input and generating
responses based on the game state. The game engine consists of the following
components:
Input Processor: The input processor is responsible for parsing player input and
determining the player's intent.
Game State Manager: The game state manager is responsible for managing the game
state, including player position and inventory.
Database
The database is responsible for storing game data, including player information and
game state. The database consists of the following tables:
Players: The players table stores player information, including player name and player
ID.
6
Game State: The game state table stores game state, including player position and
inventory.
System Flow
The system flow is as follows:
The user inputs a command through the user interface.
The game engine processes the input and determines the player's intent.
The game engine retrieves the game state from the database.
The game engine generates a response to the player's input based on the game state.
The game engine updates the game state in the database.
The game engine displays the response to the user through the user interface.
Advantages
The system design has the following advantages:
Easy to Implement: The system is easy to implement, as it uses simple Python and
MySQL.
Easy to Understand: The system is easy to understand, as it uses simple concepts and
architecture.
Disadvantages
The system design has the following disadvantage:
Limited Features: The system has limited features, as it is a simple text-based
adventure game.
7
FLOW CHART
8
DATAFLOW DESIGN
9
ER-DIAGRAM
10
DATABASE DESIGN
11
CODE
From Python:
import mysql.connector
class Database:
def __init__(self):
self.cnx = mysql.connector.connect(
user='username',
password='password',
host='localhost',
database='database'
)
db = Database()
class Player:
def __init__(self, player_name, player_email):
self.player_name = player_name
self.player_email = player_email
def save_to_db(self):
query = "INSERT INTO players (player_name, player_email) VALUES (%s, %s)"
12
db.execute_query(query, (self.player_name, self.player_email))
class Game:
def __init__(self, game_name, game_description):
self.game_name = game_name
self.game_description = game_description
def save_to_db(self):
query = "INSERT INTO games (game_name, game_description) VALUES (%s, %s)"
db.execute_query(query, (self.game_name, self.game_description))
class GameData:
def __init__(self, player_id):
self.player_id = player_id
self.position = "start"
self.inventory = []
def generate_response(player_id):
query = "SELECT player_position FROM game_data WHERE player_id = %s"
data = db.execute_query(query, (player_id,))
13
def process_input(player_id, input_str):
response = generate_response(player_id)
print(response)
def start_game():
print("Welcome to the AI Dungeon Master game!")
print("You are an adventurer seeking fortune and glory in the land of Eldoria.")
print("You are standing at the entrance of a dark cave.")
print("What do you want to do?")
game_data = GameData(1)
game_data.update_position("entrance")
while True:
input_str = input("> ")
process_input(1, input_str)
14
From MySQL:
for my sql
USE ai_dungeon_master;
15