Samarth College of Engineering and Management, Belhe: Second Year (IV Sem.)
Samarth College of Engineering and Management, Belhe: Second Year (IV Sem.)
MANAGEMENT, BELHE
“REPORT WRITING”
UNDER THE SUBJECT
SEMESTER – IV
1
SAMARTH COLLEGE OF ENGINEERING AND
MANAGEMENT, BELHE
2
ACKNOWLEDGEMENT
I would like to thank my Computer Graphics subject teacher Prof. Varhadi V.S.
for their guidance and continual encouragement throughout. I am heartily
thankful for their time-to-time suggestion and guidance which helped me a lot
during this works. I would like to thank Principal Samarth College of Engineering
and Management, for their cooperation and suggestions throughout the works.
I am giving gratitude to all the staff of the Data Science department for their
help and guidance. I would like to thank my all classmates to motivate me
throughout the work
Yours faithfully,
Katkar Om
3
INDEX
1 Title 5
2 Objective 5
3 Introduction 5
4 Future Scope 6
5 Implementation 7-9
6 Output 10
7 Conclusion 10
4
THEORY
1. Title:
2. Objective:
The objective of this project is to develop a simple 2D Ping Pong game and a 2D
Platformer game using SFML (Simple and Fast Multimedia Library) in C++.
Both games feature basic game mechanics and involve:
For the 2D Ping Pong Game:
• Player-controlled paddles moving vertically and horizontally using
keyboard controls.
• A bouncing ball that reacts to player input and the game boundaries.
• Scoring system based on ball passing the opponent's paddle.
For the 2D Platformer Game:
• Player movement where the character can move left and right using
keyboard controls (A, D keys).
• Jumping and gravity mechanics that simulate realistic physics (W key for
jump).
• Collision detection with platforms and boundaries to prevent falling off the
screen.
3. Introduction:
• Ping Pong Game: A two-player game where players control paddles to
bounce a ball back and forth across a screen, aiming to score points by
getting the ball past the opponent’s paddle. This project demonstrates the
creation of a simple 2D game using basic physics for ball movement,
paddle controls, and scoring.
• Platformer Game: A classic genre where the player controls a character that
navigates through a level by jumping and avoiding obstacles. The project
5
uses SFML for managing graphics and input. The player can move left and
right, jump, and interact with static platforms. Gravity affects the player’s
movement, and collision detection ensures the player cannot fall through
the ground or platforms.
4. Future Scope:
• For the Ping Pong Game:
o Power-ups: Add special power-ups that temporarily enhance the
paddles or speed of the ball.
o AI Opponent: Implement an AI opponent that can challenge the
player.
o Sound Effects and Music: Include sound effects for ball bounce and
scoring to enhance the gameplay.
• For the Platformer Game:
o Multiple Platforms: Add different platforms at varying heights and
positions to make the game more challenging.
o Enhanced Controls: Introduce double jumps, wall jumps, or
crouching for more dynamic gameplay.
o Enemies and Obstacles: Add moving obstacles or enemies to
increase difficulty.
o Scoring System: Implement a point system based on how long the
player survives or how many levels they complete.
o Sound Effects and Music: Add background music and sound effects
for jumps, collisions, and other game actions.
o Mobile Version: Create a version for mobile devices with touch
controls.
6
5. Implementation:
• Technologies Used:
o Programming Language: C++
o Library Used: SFML (Simple and Fast Multimedia Library)
o Concepts Applied: Game physics (gravity, collision detection),
player input handling, scoring systems.
• Code Implementation (C++ Using SFML/Graphics.h): The core mechanics
of the games are developed using SFML, which handles window creation,
event management, graphics rendering, and input processing. The games
involve the manipulation of rectangles for paddles, circles for the ball, and
a series of basic logic checks for collisions and scoring.
#include <GL/glut.h>
void drawBall() {
glBegin(GL_QUADS);
glVertex2f(ballX - 0.05, ballY - 0.05);
glVertex2f(ballX + 0.05, ballY - 0.05);
glVertex2f(ballX + 0.05, ballY + 0.05);
7
glVertex2f(ballX - 0.05, ballY + 0.05);
glEnd();
}
void display() {
glClear(GL_COLOR_BUFFER_BIT);
8
glutSwapBuffers();
}
void init() {
glClearColor(0.0, 0.0, 0.0, 1.0);
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
}
9
6. Output:-
7. Conclusion:-
The 2D Ping Pong game project represents a successful implementation of the
classic arcade game using SFML (Simple and Fast Multimedia Library). This
project showcases smooth, responsive graphics, realistic physics for ball
movement and paddle interaction, and intuitive gameplay. The game incorporates
essential elements such as player control, score tracking, and collision detection,
providing a highly engaging experience. The use of SFML allows for efficient
handling of graphics, sound, and input, enhancing the overall performance and
user experience. This project not only highlights the fundamental aspects of game
development, including game loop mechanics, event handling, and real-time
rendering, but also provides a solid foundation for further development of more
complex games and interactive multimedia applications.
10
11