ECE4893A/CS4803MPG: Multicore and GPU Programming for Video Games
Homework #2: Adding a Dimension
Due: Thursday, Oct. 27 at 23:59:59 (via T-square)
Late policy: The homework will be graded out of 100 points. We will
accept late submissions up to Sunday, Oct. 30 at 23:59:59; however,
for every day that is it is overdue,
we will subtract 20 points from the total.
We understand thst sometimes multiple assignments hit at once, or other
life events intervene, and hence you have to make some tough choices. We’d
rather let you turn something in
late, with some points off, than have a “no late assignments
accepted at all”
policy, since the former encourages you to still do the assignment
and learn something from it, while the latter just grinds down your soul. The
somewhat aggressive late penalty is not
intended to be harsh – it’s intended to
encourage you to get things in relatively on time (or just punt if you have
to and not leave it hanging over you all semester) so that you can move on to
assignments for your other classes.
Some of the machines in Klaus 1446 have fancy NVIDIA or ATI graphics cards;
small labels on them should indicate which ones have such cards. (The other
machines in the lab will still typically run most XNA programs).
should have Visual Studio 2010 and XNA Game Studio 4.0 Refresh
installed on them. You can also do
work on your own machine, and in fact are encouraged to do so
to lighten the contention on the lab machines. In theory, you should be able
to get Visual Studio from 2010 from
Be sure to download
Game Studio 4.0 Refresh
Visual Studio 2010 (and its latest updates) installed. (You could also do
it with the free Visual Studio 2010 Express, but as a student registered for
an ECE or CS class you are entitled to get the full Visual Studio 2010, so
you might as well get the complete version.)
Even if your graphics
card is insufficient to run XNA games, you can still edit and compile.
(Different versions of Visual Studio and XNA Game Studio can happily coexist
on the same machine, so if you’d like to experiment with Visual Studio
2010 and XNA Game Studio 4.0 Refresh,
you can do that. However, all of the code
examples we show in lecture and post on the class website will be for XNA
If you haven’t used Visual Studio before, you should spend a little bit
of time exploring its features.
Download the content and source files for
Prof. Lee’s 2D game that I
showed in lecture.
Make sure you can compile and run the game.
Do this early to make
sure you have it out of the way – don’t e-mail me the day before the
assignment is due and tell me you can’t get it to compile.
Once you are sure you have it running OK, make the following three changes:
1) Add some minor innovation to the gameplay that involves an additional
possibility for user input, such as a hyperspace command
(which teleports the player to a random place on the screen), a smart
bomb command (which destroys all enemies on the screen, but you have a limited
number of smart bombs), a shield that the player can toggle on and off
(which makes the player invulnerable, but can only be used for a limited
time before it needs recharged), or a time warping feature that slows down
the enemies (again, you would want to limit this somehow so the player
couldn’t use it all the time). Feel free to be creative. Do something
interesting but relatively simple to implement. (This part is intended
to make you play with the game input code.)
2) Some modern games employ 2D gameplay conventions but render the scene
elements as 3D assets. Examples include
Smash Brothers Brawl,
Fighter IV, and the XNA Spacewar starter kit.
pictures of Prof. Lee, Prof. Lee’s dog, and
the missile with 3D objects that
you render in 3D using BasicEffect.
Note that we will keep the game mechanics
(motion of the enemies and the ship, etc.)
entirely 2D – gameplay is still taking place on a plane. Essentially you
will set your camera to look down onto this plane. To make things interesting,
make the enemies spin in 3D. However you want to set up the lighting is up
to you. In terms of what 3D objects to use, you may want to use some of the
assets in one
of the starter kits, some objects from
some other XNA games you find on the web,
and/or .x or .fbx files from Turbo
Squid (be sure not to pay for any models — there are plenty of free
ones out there). Note you will very likely need to scale your
models to get them to be a reasonable size in your game.
As far as collision detection goes, try to
come up with
something that plays reasonably, but we will not be picky about this.
We recommend using BoundingSphere structures. Do not try to implement any
complex collision detection routines.
3) Right now, there’s no cool explosion effect when a bad guy hits the
player’s ship. Add one using a single triangle that starts small, centered on
the player’s spaceship and then spreads out over a few seconds.
The three vertices should be different colors, but
pick appropriately awesome colors for an
explosion like red, orange, yellow,
and white. (OK, this won’t be the worlds most realistic explosion effect.)
Render this triangle using an appropriate
“DrawPrimitive” XNA call. You may need to set up some additional game state
variables so that things act appropriately while the explosion is going on.
Be creative! (The purpose of this part is to give you a little bit of
practice using primitive drawing commands, instead of just
using the Draw() method
on 3-D objects, as you probably did for Change 2.)
Philosophy: Have fun!
Package everything needed to compile and run your upgraded game and upload
it to T-square as a zip file (basically zip up your whole folder, including
whatever executables you create.)
Include “HW2” and as much as possible of your full name
in the filename, e.g., HW2_Aaron_Lanterman.zip.
(The upload procedure should
be reasonably self explanatory once you log in to T-square.)
Be sure to finish
sufficiently in advance of the deadline that you will be able to work around
any troubles T-square gives you to successfully submit before the deadline.
If you have trouble getting T-square to work, please e-mail your
compressed file to email@example.com, with “MPG HW #2” and your
full name in the subject line; please only use this e-mail submission as a
last resort if T-square isn’t working.
The midnight due date is intended to discourage people from pulling
all-nighters, which are not healthy.
Note that you do not need to try
running anything on the Xbox 360 at this point.
A fairly complex procedure is involved;
we will cover that on a later homework.
Ground rules: You are welcome to discuss high-level implementation
issues with your fellow students – in particular, feel free to point one
another to appropriate examples online –
but you should avoid actually looking
at one another student’s code as whole,
and under no circumstances should you be
copying any portion of another student’s code.
However, asking another student to focus
on a few lines of your code discuss why a you running into trouble
is reasonable. Basically, these “ground rules” are
intended to prevent
a student from “freeloading” off another student, even accidentally, since
they won’t get the full yummy nutritional educational goodness out of the
assignment if they do.
Looking at code from homeworks done in previous years is strictly