Homework 9: Make Your Own Game

Component Due Date
Project proposal document Tuesday, December 1st at 11:59 PM EST
Project code and README document Thursday, December 10th at 11:59 PM EST
Game demo to your TA Reading Days / Final Exam Period (December 11 - 17)

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.

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-duper awesome game.

Note: Check out the rubric the TAs will use to grade the game homework here.

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

Your code must compile for you to receive 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.

You must use Java Swing for this assignment. Submissions without Java Swing will only get points for the game proposal (8%). You may not use the PennDraw library from CIS 110.

Part 1: Project Proposal

If you took CIS 110 and made a game, you cannot use that same game for the CIS 120 game project. Additionally, you cannot reuse code from past homework assignments if that code is instrumental to the concepts that your game implements. For example, you cannot simply copy and paste hw07 code to implement a user registration system in your game and receive credit for implementing collections concept.

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 mandatory way to get feedback on your proposal before you start implementing your game. It is due early in the process - you will submit it as a form on Gradescope. You can see an example of the questions you’ll answer here: here. Log on to Gradescope (the same website you used to get feedback on Midterm 1) to fill out the proposal. As you start writing your game, 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, 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.

You can definitely include more than four concepts in your proposal (and will get feedback on all of them!), but you will only be graded for four concepts when you submit your completed game.

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 Tic Tac Toe. Note that, because we have used it as an example, you are not allowed to choose Tic Tac Toe for your game. Feel free to put as many concepts as you want feedback for.

Additional Proposal Guidelines

Here are some tips/suggestions put together by some of the TAs on what we may be looking for in your proposal. It may also help you identify what game you want to use. For some of the concepts, we’ve also put some common use cases/games and common mistakes.

Submission instructions for the Project proposal

Your project proposal is due on December 1st at 11:59 PM EDT.

Submitting your proposal late will result in no points for the proposal, but you will still get feedback.

  1. Take the time to plan out a few games you’d like to make.
  2. Look at the required design concepts and see if you can come up with uses for each of them in your potential games.
  3. Choose one game, and fill out the form 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.

Your four design concepts must be used for different aspects of the game! For example, if you are using a 2-D array to hold game pieces and then use a collection later to hold the same pieces, you cannot count both Collections and 2-D arrays as concepts.

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 only count one advanced topic toward your four concepts. An advanced topic must be approved by a TA.

If you have an idea for a more advanced topic, please consult with your TA. Examples of possible advanced topics are as follows:

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 four of the design concepts you use must be core concepts from CIS 120; there are no exceptions to this.

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

It would be cruel to ask you to write a game completely from scratch. Experienced programmers generally start a new program by modifying existing code or using a tool to automatically generate starter code. So, we provide you with two very simple example games that you can use as a starting point. Your game will outgrow our starting structure, so you should create new files, delete old files, and reorganize as necessary. You are not required to use any of this code in your own game.

The Mushroom of Doom: a timer-based game

Our sample timer-based 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 these starter files and running the Game class. Make sure the image file poison.png is in the files subdirectory before you play the game.

Here’s an overview of the files:

Mushroom of Doom is not what every game looks like! It is a continuous, timer-based game rather than a turn-based game. This means that the game state changes over time (for example, every 100 milliseconds) regardless of whether the player interacts with the game. Use the Tic-tac-toe starter code if you are creating a turn-based game.

Tic-tac-toe: a turn-based game

Our other sample game, Tic-tac-toe, is also super cool. Try it out by downloading the same starter files and running the Game class or the TicTacToe class.

This game is turn-based and adheres to a Model-View-Controller design framework. This design framework is very effective for turn-based games. We STRONGLY recommend you review these lecture slides, starting at slide 8, to learn about the Model-View-Controller framework.

Here’s an overview of the files:

Tic-tac-toe is not what every game looks like! It is a turn-based game, rather than a continuous, timer-based game. The game state changes only when a player interacts with the game. Use the Mushroom of Doom starter code if you are creating a timer-based game.

Note: Turn-based and timer-based functionalities are not mutually exclusive. You are welcome to implement games that involve both. For example, chess is turn-based, but players often have limited time in which to take their turns.

Implementing Your Game

From here on out, 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 make backups of your project by saving your code under a new file name.

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

Note: Double-check that your implementation fits the rubric the TAs will use to grade the game homework here.

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 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.

If you are using Eclipse

Alternative 1 - Zip your files from Eclipse using the instructions below.

Follow these instructions to create and upload hw09-submit.zip:

Alternative 2 - Copy-Paste your code in Codio and zip from there.

          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
                              (or src/*/*.java if you use packages)
          test/*.java      // any test code you create
          files/*          // any image, data, or other files you need
                              (or files/*/*)

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 include the 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 main method in your game class with the below command. If your code does not compile you will not receive any 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 (they will send you an email to arrange a demo time). Each demo slot will about 15 minutes long. Not showing up for your Game demo will result in a -20pt deduction!

Your TA will email you with more information about how to schedule your demo session closer to the due date.