Homework 9: Make Your Own Game

xkcd game pointers
Component Due Date
Project proposal document Tuesday, November 28
Project code and README document Monday, December 11
Game demo to your TA Reading days (December 12-14)

No late submissions will be accepted for this assignment!

Assignment Overview

In this assignment, you will create your own game using the Java Swing GUI framework. Though you will choose the game and implement it from scratch, your implementation must be well designed and must integrate several programming concepts from this course. Use this project as a chance to show off everything you’ve learned and to build a large-scale application of your own design. You will demo your game and explain your design to one of your TAs in a one-on-one session during reading days.

Have fun doing this assignment! This has historically been students’ favorite project of CIS 120, and you are more than welcome to go a little overboard if you choose. :-) Many students invent a totally new game as part of this project, and these are always a ton of fun to show off.

Project Requirements

You are completely free to either choose to implement an existing game or to come up with your own, unique, super-awesome game.

No matter what kind of game you build, it must meet the following criteria:

NOTE: Your code must compile for you to recieve more than 12% on this assignment! Do not wait until the last minute to make huge changes to your code, and make sure you save working versions as you progress through your implementation.

Part 1: Project Proposal

A component of your grade for this assignment will come from a project proposal which you will submit in advance of the project deadline. This is the only (required) way to get feedback on your proposal before you start implementing your game. It is due on November 28th and you will be uploading it on Gradescope. You can view the skeleton proposal document here. Please copy the document from that link, fill it in, and save it as a pdf. You must use this skeleton proposal document (do not adjust the formatting). Overall, you will use the proposal to document your initial design process and plan your implementation.

Your proposal will include a brief description of how you will use four distinct design concepts in your game.

Your game should demonstrate that you have a practical understanding of the core concepts you learned this semester. To do this, think about a few of games you might want to implement, and break each of them down into the concepts they demonstrate.

If you can’t think of four, or at least three, don’t give up! Ask on Piazza or in office hours how you might extract more concepts from the original game you’ve chosen, or what features you might be able to add.

It’s important to choose the game that you feel would allow you to focus on demonstrating your knowledge. A poorly designed implementation of a complex game is worse than than a well-done implementation of a simpler game.

Example Proposal

Here is an example game proposal for the game Tetris. Note that because we have used it as an example; you are not allowed to choose Tetris for your game. Notice that we did not edit the formatting and we only picked four design concepts!

Submission instructions for the Project proposal

NOTE: Your project proposal is due on November 28.
  1. Make a copy of the game proposal in Google Docs. (Choose "File > Make a copy".)
  2. Edit the document to reflect your plan. Do not change the sizes of the text boxes when editing of the document.
  3. Download the proposal as a PDF file. (Choose "File > Download as > PDF Document")
  4. Upload the PDF to the CIS 120 course on the Gradescope site.

Design Concepts

Decompose your game design so that it makes use of four of the following concepts. Justify your choices in the game proposal document.

At most one of your concepts can be chosen from the list of advanced topics.

Your four design concepts must be used for different aspects of the game (i.e. if you are using I/O for high scores and use a collection while reading a file; you cannot count Collections as a concept)

Core Concepts from CIS 120

These concepts have been covered in class or in past homework assignments. You should feel comfortable using any of them in your game design.

Advanced Topics (you may choose only one)

If you have an idea for a more advanced topic, please consult with your TA. You may only be approved for up to 1 advanced topic. Examples of possible advanced topics are as follows:

If you believe one of these topics is simpler than the core topics listed, your TA will likely not approve of the advanced topic you have chosen because it is not complex enough. The purpose of allowing credit for these advanced topics is to allow students to go above and beyond in the course and learn on their own. Please note that there will be very little TA assistance available with these topics due to their advanced nature and the expectations are high, so please take the time to fully consider tackling these topics.

Choosing which Design Concepts to Implement

When choosing which concepts to implement, we advise you not to get too ambitious. Again, it is much better to implement a simpler game well than to attempt a more complex game and execute it poorly. The point of this assignment is to demonstrate your understanding of the concepts taught in this course, not just to show the most difficult, complex thing you can make.

Feel free to post on Piazza if you have an idea for an advanced topic that no one else has suggested before. It is especially important that you get feedback on these (an idea that sounds like an advanced topic doesn't necessarily have to be advanced).

If you do post to Piazza, please make such posts public so that we do not have to field repeat suggestions.

If you plan on posting to Piazza to ask about your own idea for an advanced topic, you must do so before the proposal is due, and you cannot choose to use an advanced topic that has not been approved.

Keep in mind that at least three of the design concepts you use must be core concepts from CIS 120; there are no exceptions to this.

NOTE: Only a maximum of 100% may be earned for this project. Even if you implement more concepts than necessary, they cannot bring your total to over 100%, nor can they compensate for other missing criteria. For example, if you fail to provide instructions, the highest score you can get is 95%, even if you implement twelve different core concepts.

Part 2: Game Implementation

A Note about External Resources

For this project it is not necessary to use any external resources, such as images or third-party code libraries. However, you are welcome to use them, subject to the following conditions:

Starter Code: The Mushroom of Doom

It would be cruel to ask you to write a game completely from scratch; even experienced Swing programmers start new programs by starting with existing code, or by using a tool to automatically generate some starter code. So, we’ve provided you with a very simple example game that you can use as a starting point if you like. (Note that your game might quickly outgrow the provided structure, so you should create new files and reorganize your code as necessary.)

mushroom of doom

Our sample game is rather silly, really super cool. You can move the black square using the arrow keys. Then, there is this mushroom. If your black square touches it you die. Of course, you win the game by catching the golden snitch. Try it out by downloading the starter files and running the Game class. You’ll need to make sure that the image file poison.png is in the top-level project directory before you play the game.

The game doesn’t do anything fancy like allow multiple players or keep score, but even such a simple program already demonstrates a lot of the key concepts you will need to make your own game. You should read all of the code provided before beginning to write your own game, though you are not required to use any of this code in your own game.

Here’s an overview of each of the provided files:

NOTE: The intersect code in GameObj.java is only accurate for squares. Something a little more clever is required to accurately detect collisions between more interesting shapes.

Implementing Your Game

You’re on your own! Your game project will be graded partly on a set of implementation criteria and partly on your explanation of the implementation during the demo session (see grading).

Backing Up Your Code

For this assignment, we strongly recommend that you make snapshots of your code periodically. You might want to consider learning and using a source control system such as Git.

At the very least, periodically use the "Zip Project" feature to create a backup zip archive of your progress. You can download it from Codio in case you run into problems.

Using Libraries

You can use all of the standard Java libraries without any doing anything special. However, you are welcome to use external (3rd-party) libraries packaged as .jar files. To use such libraries in the files foo.jar and bar.jar:

  1. place foo.jar and bar.jar in the project folder at the top level (i.e. at the same level as Makefile
  2. edit the makefile so that the JARS definition includes a (colon-separated) list of the jar files you need, e.g. JARS := foo.jar:bar.jar

Now, compiling your code should include the jar files as libraries.

Submitting Your Game

You must submit a single archive called hw09-submit(time).zip. The most important requirement is that it must include a Game class (it has to actually be named Game) with a main method:

public static void main(String[] args) 

This Game class must be in the default package so that we know where to look for it.

Your hw09-submit(time).zip must also include a text file called README.txt that gives an overview of your game implementation. It should briefly describe all of the classes that make up your game as well as give any special instructions (like additional libraries, etc.). We will look at this file first when grading your assignment.

The archive must contain all your sources. If your project uses additional libraries, the archive must also contain the requisite .jar files at the top level folder. If your project needs data to run—game level information, images, sounds, etc.—the archive must contain these as well: put them in the files directory.

The zip file you submit should have the structure shown below. If you are using Codio, the "Zip Project" menu item we provide should do create it:

    README.txt
    Makefile         // this is just copied from Codio
    *.jar            // any library jar files your game needs
    src/Game.java    // the Game class containing the main method
    src/*.java       // any other source code you create
    test/*.java      // any test code you create
    files/*          // any image, data, or other files you need
    

Note: If you are using JUnit testing in your code, you will need to include a .jar file for the JUnit libraries. (We installed one for you in the codio account.)

The submission page attempts to compile your code and checks for the main method. It will tell you if this compilation fails. The most common cause is forgetting to include a file.

For some projects that depend on external libraries, the submission tool might still complain, even if you are sure you included every file and they all compile. If this happens, it’s probably because the submission server isn’t able to includee th external libraries. Please email your recitation TAs so they are aware your submission may not have compiled on the server.

There is no penalty for extra submissions on this assignment, so get started early and submit often!

To run your game, we will execute the following command sequence from a Codio terminal.


    unzip hw09-submit(time).zip
    make run
    

If your code doesn’t compile, then the second command will never run your game… no compile, no credit!

Demonstrating your Game

Your game will be graded during a demo session with a TA. We will play the game so you can show us all of your features and we can look for bugs. We will expect you to walk us through your Java classes and explain how everything works during the demo session. Be prepared for questions about your implementation.

You must schedule a demo session with a TA. Sessions will be available throughout the final exam period. Each demo slot will be 15 minutes long.

Note: We will post more information about how to schedule your demo session to Piazza closer to the due date.