ECE4893A/CS4803MPG: Multicore and GPU Programming for Video Games
Homework #7: Aperture Science Xbox Multicorification Center
7A checkpoint due: Saturday, Nov. 21 at 23:59:59 (via T-square)
7B boss battle due: Wednesday, Nov. 25 at 17:00:00 (via T-square)
Late policy: The “7A checkpoint” will be graded out of 20 points;
the “7B boss battle” will be graded out of 100 points. We will
accept late submissions; however,
for every day that a submission is overdue (including weekend days),
we will subtract 10 points (for 7A) or 20 points from
the total (for 7B). For puposes of calculating a late penalty on 7B,
Thanksgiving break will count as one day, i.e. turn it in Monday by 5 and
it’s 20 points off, Tuesday by 5 and it’s 40 points off, etc.
(We understand that 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 due date was chosen so that
the assignment will not be hanging over your
head over Thanksgiving break, so you really want to have it done before
you leave for Thanksgiving.
<!–[I’ve gotten some good questions on this homework; I’ve included some
clarifications and modifications in the writeup below in boldface.] –>
Hello and again
welcome to the Aperture Science Xbox Multicorification Center.
Your application for employment has been reviewed, and
on the basis of your participation in the Georgia Tech
class “Multicore and GPU Programming for Video Games,” we have elected to
detain you for further testing to determine your suitibility for
employment as a Multicorifier.
Multicorifiers at the Aperture Science Xbox Multicorification Center
are responsible for transforming legacy single-threaded game
code into multi-threaded game code in preparation for the incorporation
of enhanced features that would overwhelm a single-threaded
To demonstrate your 1337 multithreading skills, please find an
interesting single-threaded XNA game that you would like
to work on. Be sure to select a game with a design that
emphasizes the real-time nature of the medium, such as an arcade
game, a first-person or third-person shooter, a martial arts game, a
real-time strategy game, sports game, flight simulator, etc., and
not something like a Bejeweled or chess. If you choose something off the
web, we recommend finding a program that works in XNA 3.1 and the Xbox 360
“out of the box.” If you want to try to use game that was created using
an older version of XNA, and/or one
that is only claimed
to work under Windows, realize that you may need to make
some tweaks to get it to work in XNA 3.1 and on the Xbox 360, and these tweaks
may be easy or difficult.
Instead of finding a new game off the web, you are welcome to try using
either your Homework #4 or your Homework #6; however, note that neither has
been tested on the Xbox 360, so some tweaking might be required there.
Or, if you are already working on your own original XNA game
(either for another class, to enter in a competition, to try to sell on
Community Games, or just for fun), you should feel free to use it.
are welcome to use the various Starter Kits such as Spacewar, or one off the
website, but avoid games that are already extensively
multithreaded (such as
Rocket Commander and Racing Game).
Ideally, each applicant
would be working on a diferent game, although we realize that the same
game may be independenly chosen by multiple applicants.
Here are some links of places to start looking. Google may turn up more.
click on “Source Code” on the far lower left
- Riemer’s XNA
code from “Beginning XNA 3.0 Game Programming”
- MechCommander 2 source code
(we are not actually recommending you use this one, since it involves
around a gigabyte of assets, but it is interesting that Microsoft has
chosen to release this)
- Other odds and ends may be found
(Aperture Science in no way warrants the usefulness of the code available
at any of the above
links. Any particular piece of code may be full of bugs, poorly written,
may not run on the PC, may not run on the Xbox 360, or may not compile
Spend some time looking at a different
games and poking at a lot of source code before you commit to one, since
you will be spending a lot of time with the source code of whatever game
you pick. You do not need to pick something complicated; simpler games
will be easier to multicorify.
You will probably wish to do most of your development and debugging on the PC,
and then use appropriate compiler directives to set thread affinities
for your Xbox 360 version. Your code must successfully run on the Xbox 360.
The four Xbox 360s in Klaus 1446 are available for your use. Note that over
30 other subjects are being tested for suitability
as Multicorifiers. Please be courteous
about sharing the limited resources available. In particular, do not
expect to monopolize one of the 360s the day the project is due; we
recommend trying to finish ahead of the due date. (If necessary, we
some sort of “signup” system where you may reserve a block of time on
a 360, although this didn’t seem to be a problem in the last two years). If
you have your own Xbox 360, we encourage you to use it to alleviate
contention on the ones in Klaus 1446.
Modify your single-threaded example program to use multiple threads
running on at least two cores by splitting the update logic and the
rendering logic into separate threads running on separate cores. Modify
the game state structures as needed to create a “double buffer” scheme
so that the rendering thread and go about its rendering business on one
buffer while the updating thread is writing to another buffer.
Designing code that is
intended to be multithreaded from the beginning is tricky; taking
code that was never intended to be multithreaded and making it
multithreaded, as we are doing here,
can be even trickier. Simplicity is key.
We will not be worried if your multithreaded implementation
does not run any faster, since making it work at all without
unpredicable bugs will likely prove sufficiently challenging. However,
it should not run significantly slower. Please put a few comments
in your code to make it easy for us to find the main places that you needed
to modify and we can follow what you did; in particular, we want to be
able to figure out your double-buffering strategy.
You should feel free to make whatever other tweaks to the art assets or
gameplay that you would like, although such tweaks are not required for
Warning: As discussed in lecture,
most peripheral I/O, such as loading and saving games or reading
from the controller, seems to want to take place on the main thread.
Peripherals such as those
seem to be less accessible from spawned threads.
Remember, the Xbox 360s contain no user servicable parts. Do not
submerge the Xbox 360s in liquid, even partially.
For the “7A checkpoint,” please describe 1) what game you are modifying,
including a URL pointer to the game (or a description of the game if you
are working on your own original game),
2) a brief description of the most
game state structures, and 3)
a brief discussion of which game state structures you will
need to double buffer and which ones you won’t.
photo (a cheap camera cell phone or camera PDA photo will do) to T-square
of an Xbox 360 running the game (showing it running in its original
unmodified state is OK), with you next to it, smiling
proudly, to prove that you can run the code on the Xbox 360.
If you do not have access to a digital
camera, try to drag along a friend who does. If all else fails, you can
show it running to Prof. Lanterman, Prof. Lee, or Zach Day
in person, but we would rather not
make tons of appointments to meet in Klaus 1446, so surely you know
someone with a camera? The purpose of this checkpoint is to make sure
that you’ve picked a game, are able to deploy it on the Xbox 360, and
have given some thought to multicorifying it.
For the “7B boss battle,” upload a zip file with all the assets needed
to compile and deploy your game on the Xbox 360. Include a README file
of some sort that describes what changes you made to the code, why
you made the choices you did, and what difficulties you
encountered. Note that some of this may wind up being copied from your
responses to (2) and (3) for the “7A checkpoint,” or it may be entirely
Note that we are not requiring that your final “7B boss battle”
submission actually use the multicorifying strategy or even the same
game that you described
in the “7A checkpoint” submission. As you dig into your game while
working on 7B, you may run into apparently insurmountable obstacles and
choose to ditch it in favor of another game. We expect very few students
will need to do this, however.
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 try e-mailomg your compressed
file to firstname.lastname@example.org,
with “MPG HW #7A” or “MPG HW #7B” and your full
name in the header line;
use this e-mail submission as a last resort if T-square isn’t working.
If e-mail doesn’t work, put it on your webspace and e-mail Prof.
Lanterman a link.
Discussion board: We will set up a “HW #7” discussion board where
students can discuss the homework and in particular ask questions that
the professors and other students can help answer.
The ground rules on this assignment differ from the others.
Since most people will be working on different code, you should feel
free to look at one another’s code in detail, ask others for help with
debugging your code, brainstorm strategies for your paricular game with
your friends, etc. The only exception to this rule is if you find that
someone else happened to pick the same game as you; in this case, you
should not be looking at each other’s code, but you can discuss high-level
issues. In your README file, be sure to give proper credit to people
who helped you, i.e. “Thanks to such-and-such for helping me find the
infinite recursion in blahblah.cs.”
Also, if you use adapt code from other sources, be
sure to credit the source both in your README and
in the code itself.