Game Ing Cafe Report
Game Ing Cafe Report
Submitted by
2018-2019
Department of Computer Science and Engineering,
DAYANANDA SAGAR COLLEGE OF ENGINEERING
BANGALORE – 560078
Abstract
The Problem
o There are lot of gaming Cafes, but not many have an efficient way to manage
its Gamers using a single Software.
The Solution
o A software application which helps in storing all the information of the gamers
playing in the café.
o The café manager can store all its gamers profile in the Database management
system built into the Gaming café application.
Implementation
o Application – tkinter (python)
o Database – sqlite3
Table of Contents
Introduction..................................................................................................................................4
Features....................................................................................................................................................4
Design...........................................................................................................................................5
Implementation (source Code)......................................................................................................6
DataBase.py..............................................................................................................................................6
LOGIN.PY.................................................................................................................................................10
Results (Screen shots of the Program).........................................................................................13
Sign Up window(owner):.........................................................................................................................13
Login Screen(owner):..............................................................................................................................14
Main window:.........................................................................................................................................14
Gamer Signup:.........................................................................................................................................15
View Gamer Window:.............................................................................................................................15
Add Game window:.................................................................................................................................16
Conclusions and Future enhancements........................................................................................17
References..................................................................................................................................18
Introduction
The Mini-Project aims to create a Database Management System for a Gaming Café
to efficiently manage their gamers.
Features
The application for the gaming café helps the manager to store its gamers data
like, name, email, time spent, password etc.
The application is connected to other client computers the gamer can login to
his/her PC using the ‘gamer_tag’ and ‘password’ which is - managed from the
application.
The manager can keep track of the gamers time spent on the machine to
charge accordingly.
The manager can also keep track of the games being played by individual
gamers
Design
o The database has tables for Gamer, Games and Inventory.
o The relations for the tables are:
o Gamer play Games
o Gamer has this Inventory
Implementation (source Code)
Link to GitHub: https://github.com/Ataago/Gaming-Cafe-DBMS
DataBase.py
Import sqlite3
data_base_name = "MyGameCafe_V2.db"
def view_owner(username):
"""returns the tuple with username and password"""
conn = sqlite3.connect(data_base_name)
cur = conn.cursor()
cur.execute("SELECT * FROM owner WHERE username = '%s' " % (username))
rows = cur.fetchall()
conn.close()
return rows
def view_gamer(gamer_ID):
"""returns the tuple based on gamer 'id'"""
conn = sqlite3.connect(data_base_name)
cur = conn.cursor()
cur.execute("SELECT * FROM gamer WHERE id = %s" % (gamer_ID))
rows = cur.fetchall()
conn.close()
return rows
def view_inventory(gamer_ID):
"""Returns all the tuples in inventory(table) based on gamer_ID """
conn = sqlite3.connect(data_base_name)
cur = conn.cursor()
cur.execute("SELECT * FROM inventory WHERE gamer_ID = %s" % (gamer_ID))
rows = cur.fetchall()
conn.close()
return rows
def view_games(game_ID):
"""Returns the tuple based on the game_id"""
conn = sqlite3.connect(data_base_name)
cur = conn.cursor()
cur.execute("SELECT * FROM games WHERE game_id = %s" % (game_ID))
rows = cur.fetchall()
conn.close()
return rows
def insert_owner(username, password):
conn = sqlite3.connect(data_base_name)
cur = conn.cursor()
cur.execute("INSERT or REPLACE INTO owner VALUES (?,?)", (username, password))
print('inserted')
conn.commit()
conn.close()
def delete(id):
connection = sqlite3.connect(data_base_name)
cur = connection.cursor()
cur.execute("DELETE FROM gamer WHERE id = ?", (id, ))
print('Deleted: ', id)
connection.commit()
connection.close()
def delete_game(game_ID):
'''Deletes a game form inventory table'''
conn = sqlite3.connect(data_base_name)
cur = conn.cursor()
cur.execute("DELETE FROM inventory WHERE game_ID = ?", (game_ID, ))
print('Deleted "%d" game from "games"',id)
conn.commit()
conn.close()
#database commands
connect()
LOGIN.PY
import
tkinter
from tkinter import *
from tkinter import messagebox
import database
import gui
def test():
print('Clicked')
def createAccount():
username = n_usernameEntry.get()
password = n_passwordEntry.get()
#dont create a empty username
if username == '':
messagebox.showwarning('Error','Enter username')
return
rows = database.view_owner(username)
if rows:
messagebox.showerror("Oops!",'Username Aldready Exists')
else:
database.insert_owner(username,password)
messagebox.showinfo('Registered','Sucessfully Signed Up')
gotoLogin()
def gotoLogin():
username.set('')
password.set('')
createAccFrame.pack_forget()
Header['text'] = 'LOGIN'
loginFrame.pack()
def gotoLogin_from_passreset():
username.set('')
password.set('')
passResetFrame.pack_forget()
Header['text'] = "LOGIN"
loginFrame.pack()
def passResetSubmit():
username = usernameEntry1.get()
new_password_1 = passresetEntry1.get()
new_password_2 = passresetEntry2.get()
rows = database.view_owner(username)
if not rows:
messagebox.showerror("Oops!",'Invalid Username')
else:
if new_password_1 != new_password_2:
messagebox.showwarning('Error','Passwords do not match.')
else:
database.update_owner(username,new_password_1)
messagebox.showinfo('Sucess','Password Changed')
gotoLogin_from_passreset()
#main window login
loginWindow = Tk()
loginWindow.title("ROG Login(owner)")
def on_closing():
if messagebox.askokcancel('Quit', 'Are you sure you want to quit?'):
loginWindow.destroy()
loginWindow.protocol("WM_DELETE_WINDOW", on_closing)
username = StringVar()
password = StringVar()
new_username = StringVar()
new_password = StringVar()
new_password2 = StringVar()
#login Frame
loginFrame = Frame(loginWindow, padx = 100, pady = 10)
signUpButton = Button(loginFrame, text = 'Sign Up', font = ('',10), padx = 5, pady = 5, fg = 'red', command = signUp)
signUpButton.grid(row = 3, column = 0, sticky = W)
loginButton = Button(loginFrame, text = 'Login', font = ('',15), padx = 5, pady = 5, bg = 'blue', command = login)
loginButton.grid(row = 3, column = 1)
forgotPassButton = Button(loginFrame, text = 'Forgot password', font = ('',8), fg = 'blue', command = passReset)
loginFrame.pack()
gotoLoginButton = Button(createAccFrame, text = 'Go to Login', font = ('',10), padx = 5, pady = 5, fg = 'red', command = gotoLogin)
gotoLoginButton.grid(row = 2, column = 0, sticky = W)
createAccButton = Button(createAccFrame, text = 'Create Account', font = ('',15), padx = 5, pady = 5, bg = 'blue', command =
createAccount)
createAccButton.grid(row = 2, column = 1)
#Reset Password
passResetFrame = Frame(loginWindow, padx = 100, pady = 10)
gotoLoginButton = Button(passResetFrame, text = 'Go to Login', font = ('',10), padx = 5, pady = 5, fg = 'red', command =
gotoLogin_from_passreset)
gotoLoginButton.grid(row = 3, column = 0, sticky = W)
submitButton = Button(passResetFrame, text = 'Submit', font = ('',15), padx = 5, pady = 5, bg = 'blue', command = passResetSubmit )
submitButton.grid(row = 3, column = 1)
loginWindow.mainloop()
Sign Up window(owner):
Login Screen(owner):
Main window:
Gamer Signup:
Managing these kind of setups is kind of tough job. For this very purpose we
have made a Database Management Software which makes easier to manage all the
Gamers in our Café with many features, to mention one, knowing the time played by
an individual to charge accordingly.
In the future we are planning to actually implement the Database
Management system using networking concepts and the LAN Local network to
establish this software for every user(gamer) to login into his system having accounts
made by this software. Futher we will be looking forward to log game play time from
the user clients directly to the Gaming software.
References
https://www.tutorialspoint.com/python/
https://www.tutorialspoint.com/dbms/
https://www.w3schools.com/sql/