Final Project: GUI Programming to Create a Labyrinth Game
Assigned: Monday, April 10
Due: Tuesday, May 9
Contents:
Overview
Topic(s): GUI Programming, Design Patterns, Interfaces, Inheritance, Polymorphism, Anonymous Classes, and Quality Class Design
Related Reading: GUI programming sections from Chapters 4, 5, and 6
Collaboration
For the final project, you may work in groups of up to three individuals.
One-person project: If you choose to work on the assignment individually, you may use a static maze or labyrinth (of your own design).
Two-person project: The two-person project may also use static mazes/labyrinths, but must be a little more extensive, including at least 10 points listed in the extra credit section below (those 10 points are not counted as extra credit -- only extra credit points beyond the first 10 points will count as extra credit).
Three-person project: The three-person project is similar to the two-person project, but also requires implementation of a random maze/labyrinth generator, as described in the extra credit section below (the 10 points from random maze generation and the required 10 points of extra credit are not counted as extra credit -- only extra credit points beyond the random maze generation and the first other 10 points of extra credit will count as extra credit).
Your Task
Goal: The goal of this task is to have gain some experience in GUI programming, while simultaneously implementing the using the design practices and tools learned throught the course of this class.
Note: Alternate final projects are possible, but must be discussed with and approved by the instructor
Task: Your task for this assignment is to design and implement a labyrinth game using a GUI interface (i.e. Java Swing). There are two possible types of labyrinth games you can choose to do:
- Maze -
The maze game is a game in which the purpose of the game is for the player to make their way from the start point to the end point. The layout of the maze is such that the player must follow a series of narrow winding corridors with many false turns and dead-ends until they eventually reach the finish point.
An alternate version of the Maze game involves collecting objects while avoiding computer-controlled creatures (i.e. PacMan-style games). In such games, instead of reaching a finish point, the goal is to collect all the objects.
- Dungeon Crawler -
Another type of labyrinth game, commonly called a dungeon crawler, is less of a maze and more a series of rooms and corridors (often spanned over multiple levels -- see extra credit below) that are populated by computer-controlled creatures that the player must defeat along the way. Also, the goal of the dungeon crawler is more commonly to defeat some special foe and/or collect some valuable artifact.
Game Requirements:
Note: ANY extensive use of TUTORIALS or EXTERNAL CODE must be approved by instructor before use. Failure to do so, and failure to reference it in documentation, will likely result in a zero on the project.
-
The first step in creating your game program is to define the game board. For both games, the game board must be large enough to be non-trivial. For maze games, a minimum size of 20x20 is recommended, while for dungeon crawlers, a minimum size of 20x30 is recommended.
- For three-person projects, the game board must be randomly generated each game (or level) by a random maze/labyrinth generator (implemented by one of the students in the team).
-
The game board should be displayed on the screen using appropriate widgets and layout manager(s). In the event that the full game board won't fit on the screen, scroll bars should be used as appopriate.
-
Buttons and/or other widgets should be placed in the GUI window to give the player appropriate control of the game, including movement, starting a new game, and any other options pertinent to the game (e.g. attacking monster, picking up object, searching for secret door, etc.)
- The buttons/widgets should update the state of the game accordingly.
- The game implementation should ensure that the player cannot walk through walls.
-
There should also be a text area (or a button that brings up a new window with text) describing how to play the game.
-
At the beginning of the game (or the beginning of a new game), the maze should be appropriately populated with a start point, finish point (or end creature/object), the player character, and any creatures, etc.
Design Requirements:
-
Wherever possible, the principles and practices of object-oriented design should be applied in implementing the game. In some places, this will be obvious, such as the necessity of implementing action listeners for the buttons (or other widgets). In other situations, these will be much more subtle, such as effectively using interfaces or inheritance in self-designed classes, and employing encapsulation and quality interface design principles to create good classes.
Document the Design:
- Give a UML class diagram for your design.
- Describe (in 1-2 pages) the implementation of your design.
Extra Credit
There are many options for extra credit on this assignment. You may combine any of the extra credit options below, up to a maximum of 10 points of extra credit.
Note: Two-person projects require at least 10 points of extra credit be implemented, with only additional points beyond those first 10 points actually counting as extra credit. Likewise, three-person projects must also implement a random maze/labryinth generator, so only those extra credit points beyond the random maze generator and the first 10 additional extra credit points will count towards extra credit.
Extra Credit options:
-
Random Maze/Labyrinth Generation (up to 10 points) - There are a number of algorithms that exist for random generation of mazes or labyrinths. If you are doing a three-person project, you must implement one of these algorithms, and use it, so that each level of the game is randomly generated.
-
Images for Game Board, Character, Creature(s), and/or Objects (up to 6 points) - Images can be used to significantly improve the look and feel of the game by using images for the squares in the game board, the player's character, the computer-controlled creatures, and/or objects to be collected. You are welcome to use any images you can find for this extra credit (i.e. you can, but don't have to, create the images yourself). Amount of extra credit dependent upon the overall improvement to the look and feel of the game.
-
Collecting Objects (up to 5 points) - Collecting objects can be an effective game challenge for improving the quality of play. Some objects collected may be simply for points or for reaching the end of a level, while others can have some impact on the player's abilities or computer-controlled creatures. Amount of extra credit dependent upon the variety and effects of objects collected.
-
AI for Computer-Controlled Creatures (up to 8 points) - Computer-controlled creatures can greatly improve the quality of a game. However, controlling such creatures usually entails some type of AI (artificial intelligence) algorithm that decides their actions. There are numerous AI algorithms, but one simple example involves having the creature move towards (or away) from the player character some percentage of the time (based on a random number). Amount of extra credit dependent upon the effectiveness of the AI (not on the complexity of the algorithm).
-
Variety of Creatures (up to 5 points) - Adding in multiple different types of creatures with different AIs, strengths, abilities, etc. Amount of extra credit dependent upon number and variety of additional creatures. Note: This extra credit may also entail doing the AI extra credit (though not necessarily).
-
Multiple Levels (up to 5 points) - Having a game board with stairs (up and down) that allows the player to traverse mazes or labyrinths over multiple levels. Amount of extra credit dependent upon number and variety of additional levels.
-
Player Skills and Levels (up to 5 points) - Providing support for player abilities and levels, which should progressively enable them to defeat more difficulty enemies and obstacles. Amount of extra credit dependent complexity and effectiveness of the system.
-
Keyboard Shortcuts (up to 3 points) - Adding in keyboard shortcuts so that the player can enter their movement and/or other commands through the keyboard as well as the GUI window. Amount of extra credit dependent upon number/effectiveness of keyboard shortcuts.
-
Secret Doors (up to 3 points) - Having secret doors (and providing a game mechanism allowing the player to search for secret doors) is a common mechanism for spicing up labyrinth-style games. Amount of extra credit dependent upon effectiveness.
-
Others? (? points) - If you have other ideas for extra credit options, the instructor is open to ideas -- discuss your ideas with him.
Submission Instructions
When you turn in your assignment, you must include a signed cover sheet (PDF version) with your assignment (you're assignment will not be graded without a completed cover sheet).
You should submit your assignment via email, but you must also bring a hardcopy of your assignment, along with a completed cover sheet, to the instructor at the next class. (Note: SLU's email sometimes does not deliver .zip file attachments, so if you do not receive a response from the instructor within 12 hours saying that he received your email, please re-send the assignment files in an alternate form -- e.g. send separate .java files instead of a single .zip file.)
Grading
The grading scheme for this homework is as follows:
- (70 points) -- Implementation
- (15 points) -- Design (detailed above)
- (15 points) -- Documentation (detailed above)
Note: The code must compile and run without any significant errors or there will be an immediate 10% penalty to the grade.