Netbeans Eclipse Qt Java
College of Engineering Aeronautics and Astronautics Agricultural and Biological Engineering Biomedical Engineering Chemical Engineering Civil Engineering Construction Engineering and Management Electrical and Computer Engineering Engineering Education Engineering Professional Education Environmental and Ecological Engineering Industrial Engineering Materials Engineering Mechanical Engineering Nuclear Engineering
EPICS (Engineering Projects In Community Service) First-Year Engineering Program First-Year Engineering Honors Program Global Engineering Program Minority Engineering Program Professional Practice (Co-Op) Program Women in Engineering Program
College Administration Schools Programs All Groups All People ECN Webmail
Purdue Home

ECE 462 Assignment 5

Interactive 2-Player Network Game using Java or C++

In this assignment, you are going to design a computer game using Java, or C++, or both. The game must be played through a computer network.

Programming Guidelines

  1. Keep "PIE" in mind:  In this assignment, you are expected to demonstrate your comprehensive capability of designing, coding and analyzing software using object-oriented concepts and techniques.  You must keep yourself aware of three key concepts, PIE: Polymorphism, Inheritance and Encapsulation, throughout this project.  This will benefit your understanding and skills in OO programming.
  2. Design before coding: Don't haste to type your code.  If you are not clear with the structure of the whole project, the codes may become more and more messy as you add functions to your program.  Please employ the UML diagrams to help you build a general idea of your software structure.  After completing your UML draft, "run" the program in your mind, simulate it on the paper and check for any deficiencies in your design.  Program extensibility is a crucial issue to be considered in this phase, so that you wouldn't feel regretful when 99% of the program is completed before you find it practically impossible to plug in the last 1% functionality (and this kind of disasters are fairly common).
  3. Set up the framework:  After you finish designing and simulating on paper, you can code.  However, don't code class by class; instead, build all the classes with empty contents, fill in declarations for public members and leave their implementation empty.  It is similar to the process of building an architecture: people decorate the rooms after the whole building is completed.
  4. Fill in crucial codes: Recall your state diagram for your main flow of the game.  Fill in related codes along the state diagram to build up a minimal set of functionality.
  5. Decorate your program: Complete all the extra stuff to meet the requirements, or even to amaze your customer.
  6. Debug and fix:  Test thoroughly and find as many bugs as you can before you submit.  Try fixing the bugs and if you can't, include them in the "known bugs" section in your documentation.

Grading Rules

Documentation (20pt)

  1. (2pt) How to play: Describe with sufficient details how the game goes and what player should do to win the game.  This is a manual of how to play.
  2. (5pt) UML diagrams: You must submit a class diagram for all the classes and interfaces in the program.  A state diagram describing the main flow of the game is also required.
  3. (5pt) Architecture documentation: In this documentation, you should give sufficient reasons for classes, inheritance and polymorphism, public and static members.  You must demonstrate your understanding and ability to analyze inheritance, polymorphism and encapsulation in the documentation.
  4. (2pt) Explain the extensibility of your program, i.e., what functionality you can imagine to be added to your program, and how they can be achieved by inheriting from your existing class(es) and exploiting the feature of polymorphism.
  5. (4pt) Technical details in networking: Describe with sufficient details the data structure employed to transmit message over the network, how these messages are generated, sent, received and parsed, what networking protocol you choose and your reason for your choice.  At last, please analyze the performance of the mechanism under poor networking conditions, e.g., loss of packet, high latency, etc.
  6. (2pt) Give an overall evaluation of your project: do you think the quality of your project is comparable to commercial products?  In which aspects would you say yes and which would you say no?
  7. List the location of source codes relevant to the requirements.  Do not miss this part, otherwise you may lose considerable points for program functionality.

Basic Program Functionality (55pt)

  1. (10pt) The game is playable in the way that is described in your documentation.
  2. (10pt) Two instances of the game can connect to each other over a computer network using either TCP or UDP.  After connected, they can send message to and receive from each other.  The messages can be correctly parsed to its original meaning.  The connection process must be aynschronous, i.e., your program should respond to user inputs, for example to press the "Stop Connecting" button, while network connection is in progress. Explain how you maintain interactivity while handling network traffic.
  3. (5pt) The program can take appropriate actions and give proper messages in a networking failure situation.  Crashing is unacceptable when the other end disconnects.
  4. (5pt) The program can run in both Local mode and Network mode.  In Local mode the game does not need any network connections.  The functionality is allowed to be slightly different in the two modes.
  5. (10pt) The game must have a playfield where game objects are drawn/painted.  In other words, you may lose considerable amount of points if you only have widgets/controls/componenets on the window without using any graphics.
  6. (5pt) You must use a Timer to achieve some dynamic effect, for example, animation, countdown, etc.
  7. (5pt) File operation is required.  The game must be able to both read and write.  This file can be the game state, a sound file, picture, whatever.
  8. (5pt) The game is responsive to either keyboard or mouse input, but not necessarily both.

Object-oriented Architecture (15pt)

  1. (5pt) Inheritance and Polymorphism: You must have at least one class inheriting from another base class.  Somewhere in the program, the base class is used instead of the derived classes to exploit polymorphism.  Describe the implementation in your documentation.
  2. (5pt) Networking layer: You must separate the codes related to networking from main window and playfield.  A local player and a network player should share some common interfaces.
  3. (5pt) Encapsulation: You should expose a minimal set of member functions/methods/fields.  If you use static classes/members/objects, you must state the reason for it to be static/global.  In Java, constants can be static yet they must also be final.

Overall Evaluation (10pt)

  1. (3pt) Project Complexity: Judged from the number of classes and interfaces in your project.  1 point for 1-5 classes/interfaces, 2 points for 6-10 c/i, 3 points for over 10 classes/interfaces.  Classes/interfaces not involved in the functionality of the project do not count (judged by your documentation and class diagram).
  2. (3pt) Creativity in Game: Higher score for more originality in game design and lower score for more common game.  (Particularly, Breakout, Tetris and Pac-man games are worth 1 point for this criterion.)
  3. (4pt) Source Code Readability: Higher score for good commenting and proper naming and lower score for messy code.  You can refer to corresponding rules in PA01 or PA02.

Design Pattern Bonus (15pt)

Design pattern is an advanced topic based on object-oriented programming concepts.  You can earn bonus point by employing the following design patterns into your program.  However, these are not necessary applicable to your game design, so choose the patterns wisely.  You must explain in your documentation the definitions of the design patterns you've employed and their benefits to your design, along with necessary UML diagrams to clarify your design.  Improper use of the patterns cannot earn you bonus points.

  1. (3pt) Singleton: Ensure a class only has one instance, and provide a global point of access to it.  (Example: FileManager for your program.)
  2. (5pt) Abstract factory: Provide an interface for creating families of related or dependent objects without specifying their concrete classes.  (Example: plug-in mechanism for your game.)
  3. (7pt) Model-view-controller: In MVC, the model represents the information (the data) of the application and the business rules used to manipulate the data; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages details involving the communication to the model of user actions such as keystrokes and mouse movements.  Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other.

3D Bonus (10pt)

If you use any 3D visualizations, you can get up to 10 bonus points, at the discretion of the grader.