0% found this document useful (0 votes)
22 views4 pages

Programming Assignment 2

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

Programming Assignment 2

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

MSIM 508 & ECE 407/507

Introduction to Game Development

Programming Assignment Two


Pong Game
Assigned February 5, Due 12:00 PM February 19

1. Overview
The Ping Pong game was one of the earliest video games. It is a 2D sports game that
simulates 2-player table tennis games. In the class, we discussed one implementation of
the Ping Pong game using MonoGame. This implementation is simple, and it uses sprites
to simulate the ball, paddles, and scores. Although this implementation is entertaining
and is good for teaching purposes, it does have some drawbacks, a few of which are listed
below.
 The scores are limited to 9. Once one player has more than 9 goals, the game will
reset.
 The ball is square. It would be more realistic if it is round.
 The scores are displayed using textures, which limit the maximum score to 9.
 The game does not have sound.
In this programming assignment, you will enhance the Ping Pong game covered in the
class. The following is just a partial list of then enhancements you will implement. See
the Task Section for a complete list of features you are required to implement.
 Increase the maximum score to 100.
 Change the ball's shape so that it is round.
 Generate sound effects when the ball hits the paddle or the left or right border.
 Add the option to play background music.
The screen capture of one possible enhancement is shown in Figure 1.

Figure 1 One possible enhancement of the Ping Pong game

1
2. Objectives
Upon successful completion of this programming assignment, you shall possess the
following skills.
 Add assets (images and sounds) to the Content Pipeline.
 Use 2D textures and sprites.
 Use image processing software to convert image formats.
 Generate sprite fonts and use sprites to draw texts.
 Use the SoundEffect and Song classes to represent sound effects and music and
use related classes and methods to play sound effects and music.
 Handle keyboard inputs.
 Use the Random class to generate random numbers.
 Understand some basic problems in collision detection.

3. Tasks
The original implementation of the Ping Pong game is provided as the base code for this
assignment. The base code contains classes representing the ball, the paddles, and the
game and it implements the basic game logic, including user input handling, collision
detection, game object update, etc. You need at least to extend the base program as
specified below.
1. Read the base code and understand the code architecture, user control, execution
flow, and game logic.
2. Generate a sprite font for the scores and add it to the Content Pipeline. The
recommended font size is 70, but you can certainly use other font sizes. Use Bold
style. Set the maximum score to be 100.
3. Replace the ball texture with a ball image created by yourself or downloaded from
Internet. You may need to convert the image format from .gif to .png, since .gif is not
supported by XNA.
4. Add a background image (texture) to the game. The background can simulate the
table tennis table or other things.
5. Add sound effects when the ball is bounced by the paddle or when the ball hits the
left or right border. Some sound effects can be found at this website:
http://www.pacdv.com/sounds/interface_sounds.html. Use the SoundEffect class for
this task.
6. Add background music (using .wma or .mp3 formats) to the game. Set the play mode
to repeat so that the background music is continuously played. Use the MediaPlayer
and Song classes for this task.
7. Handle the following keyboard inputs.
a. Reset the game using "R".
b. Exit the game using "Q" or "ESC".
c. Toggle (pause and resume) the background music using "P".

2
8. Randomize the initial speed of the ball in the Game1. ResetGame() method so that the
x component of the speed is in the intervals [4, 6] or [-6, -4] and the y component is
in the intervals [3, 5] or [-5, -3]. Use the Random class for this task.
9. Display a text that displays your name. You need to generate a new sprite font.
10. In the Game1.MoveBall() method, the method CollisionOccurred() is called at the
end of MoveBall(). Is this a problem? Why?
11. When the ball moves at a high speed, it is possible for it to penetrate the paddle. This
certainly makes the game less realistic. Discuss at least one approach to address this
problem and make the game more realistic. To better address this problem, more
accurate collision detection method is desired. You can earn 5 extra points if you
implement accurate collision detection (Optional).
12. Discuss other possible implementations or improvements.

4. Code (70 points)


Exercise good coding practices, such as naming variables meaningfully and properly,
including comments of key classes, variables, functions, and code segments, and using
proper indentations and spacing between tokens (e.g., variables, operators). Points will
be deducted for lack of comments or bad formatting (e.g., no indentation or large blank
spaces in the code). The following is the grade allocation for different tasks or
functionalities of your program.
 Visual representations: 30 points
 Music and sound effects: 20 points
 Physics: 20 points

5. Report (30 points)


The report should contain at least the following sections and use the same formatting in
this assignment description or other professional formats. Points will be deducted for
improper formatting.
 Introduction (2 points): overview of the assignment, such as background,
objectives, and brief summary of what you have done for this assignment. Don’t
repeat the assignment description verbatim.
 Program Design (10 points)
o Code: You will use Doxygen to generate the documentation (help) file for
your code. You need to generate documentation for all classes, class
variables, class methods, and internal implementations of critical methods,
for all types of access modifiers (public, protected, and private). Your
documentation should include source code, class diagrams, call graphs,
and caller graphs. Your documentation should be contained in a
single .chm file.
o Instructions to run your code if its execution is different from the
instructor’s sample program, e.g., command line arguments, keyboard and
mouse controls.

3
 Results (15 points): Describe what you have done for each task specified in
Section 3: Tasks. Include results and necessary screen captures for each task.
Answer the questions in the task if any.
 Conclusion and Discussion (3 points): Discuss your accomplishments, learning
outcomes, and difficulties and how you can do better for this assignment. Feel
free to discuss other relevant topics (e.g., the numbers of hours you have spent on
this assignment).

6. Deliverables
You need to submit your entire C# project, report, and screen recording videos. You are
asked to compress all your files into one single file and name it following the requirement
specified in the lecture "Course Introduction", Slide 42. Submit the compressed file to
Blackboard.

You might also like