0% found this document useful (0 votes)
8 views

Mini Project -report format

The document is a mini project report on the development of a 'Ping Pong Game' using QT Creator and C++. It outlines the project's objectives, scope, outcomes, and the educational value of learning game development concepts like event handling and AI integration. The report also includes acknowledgments, software and hardware specifications, and references used during the project.

Uploaded by

amkslade101
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Mini Project -report format

The document is a mini project report on the development of a 'Ping Pong Game' using QT Creator and C++. It outlines the project's objectives, scope, outcomes, and the educational value of learning game development concepts like event handling and AI integration. The report also includes acknowledgments, software and hardware specifications, and references used during the project.

Uploaded by

amkslade101
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Page | 1

A MINI PROJECT REPORT ON

“Ping Pong Game”


SUBMITTED TO THE SAVITRIBAI PHULE PUNE
UNIVERSITY, PUNE IN THE PARTIAL FULFILLMENT OF
THE REQUIREMENTS FOR THE AWARD OF THE DEGREE
OF
Computer Engineering.
SUBMITTED BY
(DIVISION : SE-A, BATCH – S2)
Aditya Kulkarni

UNDER THE GUIDANCE OF


Mrs. Suchi Sharma

COMPUTER ENGINEERING
P.E.S MODERN COLLEGE OF ENGINEERING PUNE - 411005.

SAVITRIBAI PHULE PUNE UNIVERSITY


[2024 - 25]

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 2

Progressive Education Society’s Modern College of Engineering


Shivajinagar, Pune - 411005.

CERTIFICATE

This is to certify that the following students of Computer Engineering of PES’s, Modern College of
Engineering have successfully completed their mini project and design of project entitled “Ping Pong
Game” under the guidance of the course instructor.

The Group Members are:

Sr No. Group Members Roll Number


1) Aditya Kulkarni 21029
2)
3)
4)

This is in partial fulfillment of the award of the degree Computer Engineering of Savitribai Phule Pune
University.

Date:

Mrs. Suchi Sharma Dr. S. A. Itkar


Course Instructor H.O.D.
. Dept. of Computer Engineering

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 3

Acknowledgment

It gives us pleasure in presenting the partial project report on “Ping Pong Game”.
Firstly, we would like to express our gratitude to our course instructor. Her constant guidance
and advice played very important role in making the execution of the re- port. She always gave
us her suggestions that were crucial in making this report as flawless as possible.
We would like to express our gratitude towards Dr. S. A. Itkar Head of Department of
Computer Engineering Department, PES Modern College of Engineering for kind co-operation
and encouragement which helped us during the completion of this report.
Also we wish to thank our Principal, Prof. Dr. Mrs. K. R. Joshi and all faculty members for
their whole hearted co-operation for completion of this report. We also thank our laboratory
assistants for their valuable help in laboratory.
Last but not the least, the backbone of our success and confidence lies solely on blessings of
dear parents and lovely friends.

Sr Group Members Roll Number


No.
1) Aditya Kulkarni 21029
2)
3)
4)

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 4

Index
Contents Page No.
Abstract 5
Introduction 7
Scope 9
Need 11
Outcomes 13
Software and Hardware Specifications 15
Conclusion 17
References 19
Source Code 21
Output 24

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 5

Abstract
The project “Pong Game in QT Creator” focuses on recreating the classic two-player Pong game using
the QT Creator development environment and C++. The primary goal of this project is to build an
engaging, interactive game that involves a player-controlled paddle and an AI-controlled paddle. The
player moves their paddle using the UP and DOWN arrow keys to deflect a ball, while the computer
paddle uses a basic AI algorithm to follow the ball. The player scores points by successfully sending the
ball past the computer paddle, while the computer gains points when the ball gets past the player’s
paddle.

This project demonstrates key concepts in game development, including event handling, collision
detection, and the creation of simple AI mechanics. The graphical interface and game logic are
implemented using QT’s framework, with real-time updates ensuring fluid gameplay. Through this
project, we explore the intersection of user interaction and AI, providing an immersive gaming
experience.

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 6

1.
Introduction

1.1 Introduction

In recent years, computer graphics have become an essential component of various applications, from
video games to simulations.The “Pong Game in QT Creator” is a revival of one of the earliest arcade
games, Pong, using modern development tools. Pong is a simple game that involves two paddles and a
ball. The objective is to keep the ball in play by bouncing it back and forth between the paddles. This
project simulates the traditional Pong game but implements it with QT Creator and C++, enabling us to
explore event-driven programming and basic artificial intelligence.

1.2 Purpose and Vision

The purpose of this project is to simulate a game where players compete against an AI-
controlled paddle. This gives us an opportunity to apply concepts of object-oriented
programming, real-time event handling, and simple AI. The vision is to create a seamless
gaming experience where the player engages in a fast-paced challenge that enhances their
reaction time and strategic thinking.

The project also aims to improve the understanding of core game development concepts,
particularly in rendering graphics and managing user input through the QT framework. By
integrating AI for the computer paddle, we explore basic logic-based movement and game
mechanics.

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 7

2.
Scope

2.1 Scope
The purpose of this project is to simulate a game where players compete against an AI-controlled
paddle. This gives us an opportunity to apply concepts of object-oriented programming, real-time event
handling, and simple AI. The vision is to create a seamless gaming experience where the player engages
in a fast-paced challenge that enhances their reaction time and strategic thinking.

1. Game Logic: Developing a continuous loop where the ball bounces between two paddles,
ensuring that it reacts correctly when it hits the boundaries or paddles.
2. Player Interaction: The player controls their paddle using the UP and DOWN arrow keys,
offering a direct, real-time interaction with the game.
3. AI-Controlled Paddle: The computer paddle is controlled using a basic AI that follows the ball’s
movement along the y-axis, creating a dynamic challenge for the player.
4. Collision Detection: Implementing accurate collision detection between the ball and paddles to
ensure realistic gameplay.
5. Score System: A scoring system where the player earns a point when the ball passes the computer
paddle, and loses a point when it passes the player’s paddle.
6. Graphics and Rendering: Utilizing QT’s QGraphicsScene to create the game’s graphical
elements, including the paddles, ball, and game area.
7. Future Extensions: The groundwork has been laid for potential enhancements such as
multiplayer modes, difficulty levels for the AI, or adding sound effects and animations..

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 8

3.
Need

3.1 Need
1. Educational Value: This project offers students an excellent opportunity to gain hands-on
experience with game development concepts, including collision detection, event handling, and
basic AI. It reinforces theoretical knowledge through practical application.
2. Skill Development: Developing the Pong game requires understanding the QT framework, as
well as improving proficiency in C++. These skills are valuable in various fields of software
development, including game programming and real-time application development.
3. Understanding of Game Mechanics: By developing a simple game like Pong, we gain insights
into how real-time applications work, from handling user input to managing physics-based
collisions.
4. Engagement and Fun: The project adds an element of fun and creativity to the learning process,
motivating further exploration into game design and development.
5. Foundation for Future Projects: By working on this project, we gain a solid foundation for more
complex game development projects or other real-time applications such as simulations and
graphical interfaces.

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 9

4.
Outcomes

4.1 Outcomes

The following outcomes were achieved through the development of the “Pong Game in QT Creator”:

1. Completed Pong Game: A fully functional Pong game was successfully developed, demonstrating the
application of core game development principles.

2. Improved Programming Skills: The project enhanced my understanding of C++ programming,


particularly in event-driven programming, and helped me become more proficient in using QT Creator
for graphical user interfaces.

3. AI Integration: A simple AI was implemented to control the movement of the computer paddle,
providing a dynamic challenge for the player.

4. Collision Detection and Game Physics: Accurate collision detection was implemented, ensuring the
ball reacts correctly when it hits the paddles or the boundaries of the game area.

5. Scoring System: A scoring system was added to track the player’s and the computer’s scores, with a
point awarded when the ball successfully passes the computer’s paddle and lost when it passes the
player’s paddle.

6. Foundation for Advanced Projects: This project has laid the groundwork for more advanced game
development, including multiplayer modes, advanced AI, and more sophisticated graphical elements.

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 10

5.
Software and Hardware Specifications

5.1Software Requirements
1. Development Environment: QT Creator, an integrated development environment for building
graphical applications using C++ and the QT framework.

2. Graphics Library: QT’s QGraphicsScene and QGraphicsView classes were used to handle
rendering of the game’s graphical elements.

3. Operating System: The game was developed and tested on Windows and Linux operating
systems, both of which are compatible with QT Creator.

5.2 Hardware Requirements


1. Processor: A modern multi-core processor (Intel i5 or equivalent) was used to ensure smooth
execution and rendering of the game.
2. RAM: A minimum of 4 GB RAM is required for efficient development and execution, while 8 GB is
recommended for better performance.
3. Graphics: A standard integrated or dedicated graphics card was used to render the game’s graphical
elements.
4. Storage: At least 500 MB of free disk space is required to store project files and QT libraries.
5. Display: The game was developed for display on a monitor with a resolution of at least 1280x720
pixels, ensuring clear visibility of the game elements.

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 11

6.
Conclusion
5.1 Conclusion:

The “Pong Game in QT Creator” mini project successfully demonstrates the principles of game
development using the QT framework. Through this project, I was able to integrate various aspects of
programming, including user input handling, AI development, and real-time collision detection, into a
cohesive gaming experience. The use of QT’s graphical capabilities allowed for the smooth rendering of
game elements, while the simple AI algorithm added a dynamic and competitive element to the game.

By completing this project, I have not only developed valuable programming skills in C++ and QT but
also gained insights into the challenges and complexities of game design. This project serves as a
foundation for future endeavours in game development and real-time graphics programming, inspiring
further exploration and innovation.

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 12

7.
References
7.1References
1. OpenGL Documentation:
OpenGL Architecture Review Board. "OpenGL Programming Guide."
https://www.khronos.org/opengl/wiki/Documentation

2. GLUT Documentation:
Mark Kilgard. "GLUT: OpenGL Utility Toolkit."
https://www.opengl.org/resources/libraries/glut/

3. C++ Programming:
Bjarne Stroustrup. "The C++ Programming Language." 4th Edition. Addison-Wesley,
2013.

4. OpenGL Mathematics:
Georg Baum, et al. "GLM - OpenGL Mathematics."
[https://glm.g-truc.net/](https://glm.g-truc.net/)

6. Computer Graphics Textbooks:


James D. Foley, et al. "Computer Graphics: Principles and Practice." 3rd Edition.
Addison-Wesley, 2013.

7. Online Tutorials:
LearnOpenGL. "Learn OpenGL: A Beginner's Guide."
https://learnopengl.com

8. Forums and Community:


Stack Overflow. "OpenGL Questions."
https://stackoverflow.com/questions/tagged/opengl
PESMCOE, Department of Computer Engineering 2024 - 25
Page | 13

These references provide foundational knowledge and resources that support the
development of the moving train animation project, covering essential topics in computer
graphics and programming.

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 14

8.
Source Code
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsRectItem>
#include "paddle.h"
#include "ball.h"
#include <QMessageBox>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// create a game scene
QGraphicsScene *scene = new QGraphicsScene(this);
scene->setSceneRect(0, 0, width(), height());

// add game objects


Paddle *player = new Paddle();
player->setPos(5, (height() / 2.0) - player->height());
player->setBrush(Qt::blue);
player->setFlag(QGraphicsItem::ItemIsFocusable);
player->setFocus();

Paddle *computer = new Paddle();


computer->setPos(width() - computer->width() - 5, (height() / 2) - computer->height());

Ball *ball = new Ball();


ball->setPaddles(player, computer);
ball->setPos(player->x() + ball->width() + 12, player->y() + player->height() / 2);

scene->addItem(player);
scene->addItem(computer);
scene->addItem(ball);

// create a game view


PESMCOE, Department of Computer Engineering 2024 - 25
Page | 15

ui->gameView->setScene(scene);
ui->gameView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->gameView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->gameView->setGeometry(0, 0, width(), height());
ui->gameView->setFixedSize(width(), height());
}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::on_actionAbout_triggered()
{
QMessageBox::information(this, "About", "This is an alpha version of a simple pong game
built with Qt.", "OK");
}

void MainWindow::on_actionHow_to_play_triggered()
{
QMessageBox *msgBox = new QMessageBox(this);
msgBox->setWindowTitle("How to play");
msgBox->setText("Use arrow keys UP and Down to move the paddle in order to hit the ball");
msgBox->setInformativeText("You win when the ball passes the computer paddle.\nHowever
score in not implemented yet");
msgBox->exec();
}

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 16

9.
Outcome

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 17

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 18

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 19

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 20

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 21

6.
Conclusion

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 22

5.2 Conclusion:

The "Moving Train Animation" project successfully demonstrates the integration of computer graphics
principles with programming skills to create an engaging and interactive animation. By leveraging Dev-
C++ and the OpenGL library, we have explored various aspects of animation, including modeling,
rendering, and user interaction. This project not only highlights the technical capabilities required for
graphics programming but also emphasizes the creative potential inherent in animation design.

Through the development process, participants have gained valuable insights into real-time graphics
rendering, performance optimization, and user experience considerations. The skills acquired will serve
as a solid foundation for future endeavors in computer graphics and related fields, empowering
developers to tackle more complex projects.

Ultimately, this project illustrates the power of computer graphics in storytelling and simulation,
inspiring further exploration and innovation within this dynamic domain. The knowledge and
experience gained will encourage participants to push the boundaries of their creativity and technical
expertise in future projects.

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 23

7.
References

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 24

7.1References
1. OpenGL Documentation:
OpenGL Architecture Review Board. "OpenGL Programming Guide."
https://www.khronos.org/opengl/wiki/Documentation

2. GLUT Documentation:
Mark Kilgard. "GLUT: OpenGL Utility Toolkit."
https://www.opengl.org/resources/libraries/glut/

3. C++ Programming:
Bjarne Stroustrup. "The C++ Programming Language." 4th Edition. Addison-Wesley,
2013.

4. OpenGL Mathematics:
Georg Baum, et al. "GLM - OpenGL Mathematics."
[https://glm.g-truc.net/](https://glm.g-truc.net/)

6. Computer Graphics Textbooks:


James D. Foley, et al. "Computer Graphics: Principles and Practice." 3rd Edition.
Addison-Wesley, 2013.

7. Online Tutorials:
LearnOpenGL. "Learn OpenGL: A Beginner's Guide."
https://learnopengl.com

8. Forums and Community:


Stack Overflow. "OpenGL Questions."
https://stackoverflow.com/questions/tagged/opengl

These references provide foundational knowledge and resources that support the
development of the moving train animation project, covering essential topics in computer
graphics and programming.

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 25

8.
Source Code
PESMCOE, Department of Computer Engineering 2024 - 25
Page | 26

Source Code
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main() {
int i;
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;
initgraph(&gdriver, &gmode, "C:\\TC\\BGI")
for (i = 0; i <= 640; i++) {
cleardevice();
// Track
setcolor(7);
line(0, 450, 640, 450);
line(0, 475, 640, 475);
line(0, 480, 640, 480);
// Back box
setcolor(11);
rectangle(30 + i, 340, 180 + i, 350);
rectangle(40 + i, 350, 170 + i, 425);
// Back wheels
setcolor(9);
circle(70 + i, 437, 12);
circle(140 + i, 437, 12);
// Back incircle
setcolor(10);
circle(70 + i, 437, 8);
circle(140 + i, 437, 8);
rectangle(70 + i, 435, 140 + i, 439);
// Back windows
setcolor(14);
rectangle(55 + i, 365, 155 + i, 400);
line(83 + i, 365, 83 + i, 400);
line(122 + i, 365, 122 + i, 400);
// Joint
setcolor(13);
rectangle(170 + i, 400, 210 + i, 390);
// Engine
setcolor(10);
rectangle(200 + i, 320, 260 + i, 330);
rectangle(210 + i, 330, 250 + i, 400);
rectangle(250 + i, 340, 345 + i, 425);
rectangle(250 + i, 340, 330 + i, 410);
// Front wheels
setcolor(9);
circle(225 + i, 425, 25);
circle(320 + i, 437, 12);
circle(280 + i, 437, 12);

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 27

// Front small incircle


setcolor(11);
circle(320 + i, 437, 8);
circle(280 + i, 437, 8);
rectangle(320 + i, 435, 280 + i, 439);
// Front big incircle
setcolor(13);
circle(225 + i, 425, 15);
// Front windows
setcolor(11);
rectangle(220 + i, 335, 240 + i, 365);
// Fire
setcolor(9);
rectangle(300 + i, 300, 330 + i, 340);
rectangle(290 + i, 290, 340 + i, 300);
// Tracker
setcolor(13);
line(332 + i, 425, 332 + i, 450);
line(345 + i, 425, 355 + i, 450);
// Light
setcolor(12);
rectangle(345 + i, 360, 355 + i, 380);
// Hills
setcolor(4);
line(0, 200, 50, 150);
line(50, 150, 150, 200);
line(150, 200, 300, 100);
line(300, 100, 450, 175);
line(450, 175, 640, 125);
// Sun
setcolor(14);
circle(475, 75, 25);
// Text
settextstyle(3, 0, 2);
setcolor(14);
outtextxy(150, 448, "CREATED BY NIPUN SOHAM VEDANT GURURAJ ");
delay(30);
}
getch();
closegraph();
return 0;
}

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 28

PESMCOE, Department of Computer Engineering 2024 - 25


Page | 29

PESMCOE, Department of Computer Engineering 2024 - 25

You might also like