0% found this document useful (0 votes)
189 views21 pages

Ai Dungeon Master

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
189 views21 pages

Ai Dungeon Master

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

AI DUNGEON MASTER

This report is submitted in partial fulfilment for the project-work of Computer


Science.

ALL INDIA SENIOR SECONDARY SCHOOL EXAMINATION


CBSE :2024-25
COMPUTER SCIENCE (083)

Submitted By

SIBARANJAN DASH
Class: XII-A

Under the Guidance of


Dr. CHANDRALEKHA
PGT (COMPUTER SCIENCE)

PM SHRI KENDRIYA VIDYALAYA NO 1, CDA,CUTTACK


ODISHA, INDIA
2024-2025
PM SHRI KENDRIYA VIDYALAYA NO. 1 CUTTACK

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.

Internal Examiner External Examiner


Name: Name:
Designation: Designation:

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.

By combining Python's AI capabilities with MySQL's data handling, AI Dungeon


Master showcases the potential of AI and database integration in creating next-
generation entertainment, setting new standards for interactive
gaming experiences.
ACKNOWLEDGEMENT

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

▪ Introduction and objective ........................................................... 1-2

▪ Feasibility study........................................................................... 3-4

▪ System requirement specification ................................................ 5

▪ System Design ..............................................................................6-7

▪ FLOW CHART ............................................................................. 8

▪ DFD .............................................................................................. 9

▪ E-R DIAGRAM............................................................................ 10

▪ Database Design ...........................................................................11

▪ CODE ..................................................................................... 12-15


INTRODUCTION AND OBJECTIVES

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:

Respond to player commands: The game should respond to player commands,


such as moving to a new location, interacting with non-player characters (NPCs),
and solving puzzles.
Use AI to generate responses: The game should use AI to generate responses to
player input, making the game more dynamic and engaging. This includes
generating NPC dialogue, combat outcomes, and puzzle solutions.
Provide a fun and interactive experience: The game should provide a fun and
interactive experience for players, with an engaging storyline and
challengingpuzzles to solve.
Be easy to play: The game should be easy to play, with a user-friendly interface
that allows players to input commands and receive feedback from the game.
Key Features
The AI Dungeon Master game will have the following key features:

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'
)

def execute_query(self, query, params=None):


result = None
try:
with self.cnx.cursor() as cursor:
cursor.execute(query, params)
if query.strip().upper().startswith("SELECT"):
result = cursor.fetchall()
else:
self.cnx.commit()
except mysql.connector.Error as err:
print(f"Error: {err}")
return result

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 update_position(self, position):


self.position = position
query = "UPDATE game_data SET player_position = %s WHERE player_id = %s"
db.execute_query(query, (self.position, self.player_id))

def update_inventory(self, item):


self.inventory.append(item)
query = "UPDATE game_data SET player_inventory = %s WHERE player_id = %s"
db.execute_query(query, (",".join(self.inventory), self.player_id))

def generate_response(player_id):
query = "SELECT player_position FROM game_data WHERE player_id = %s"
data = db.execute_query(query, (player_id,))

# Simulate a basic response without machine learning


response = "Hello, adventurer! Your current position is {}.".format(data[0][0]) if data else
"No data found."
return response

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?")

# Sample player creation and game session for demonstration


player = Player("John Doe", "john.doe@example.com")
player.save_to_db()

game = Game("Adventure in Eldoria", "A quest for glory.")


game.save_to_db()

game_data = GameData(1)
game_data.update_position("entrance")

while True:
input_str = input("> ")
process_input(1, input_str)

# Start the game


start_game()

# Close the database connection


db.cnx.close()

14
From MySQL:
for my sql

CREATE DATABASE ai_dungeon_master;

USE ai_dungeon_master;

CREATE TABLE players (


player_id INT AUTO_INCREMENT,
player_name VARCHAR(255),
player_email VARCHAR(255),
PRIMARY KEY (player_id)
);

CREATE TABLE games (


game_id INT AUTO_INCREMENT,
game_name VARCHAR(255),
game_description TEXT,
PRIMARY KEY (game_id)
);

CREATE TABLE game_data (


game_data_id INT AUTO_INCREMENT,
game_id INT,
player_id INT,
player_position VARCHAR(255),
player_inventory TEXT,
PRIMARY KEY (game_data_id),
FOREIGN KEY (game_id) REFERENCES games(game_id),
FOREIGN KEY (player_id) REFERENCES players(player_id)
);

15

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy