Assignment 1: uEngine Game Engine

In this assignment, you will complete the code for a very simple game engine called uEngine. This will increase your practical understanding of:

  • the integration of different components in a game engine, including components for rendering, sound, input and physics
  • the design of the split between a game engine and the code for an actual game
  • the implementation of the frame loop.

Overview

The uEngine provides a framework for the implementation of very simple 2D games. While the engine provides functions associated with advanced engines such as physics simulation, sound, an graphical rendering, these features are provided in a very simple way only. Specifically, the features of uEngine are:

  • Input Engine: reads keyboard input, and when queried, delivers all keyboard events that have occurred in the current frame.
  • Render Engine: performs z-ordered 2D rendering of game objects. Each game object is a coloured rectangle.
  • Audio Engine: maintains a list of sound clips (in wav format), and plays clips on demand.
  • Physics Engine: reports collisions between game objects.

This class diagram shows the structure of uEngine.

Getting uEngine

uEngine was programmed in Java using the Eclipse IDE. You can download your own copy of Eclipse, or use it in the CASLab. I have tested the sample code using Eclipse Mars Release (4.5.0).

To get your own copy of uEngine:

  • Dowload it (it is provided as an attachment to the assignment in OnQ)
  • Uncompress it
  • In Eclipse, select File | Import
  • Select General | Existing Projects into Workspace and hit "Next"
  • Under "Select root directory", click the "Browse" button, and navigate to the uEngine-stripped folder, and click "Open"
  • Click "Finish"

You will find that this project has errors and will not compile. Your first task in this assignment is to fix these errors.

Part 1: Fixing uEngine

The version of uEngine that I have given you has critical lines removed, or critical parts of lines not provided. Read through the code for uEngine to find and repair these problems. I recommend that you carefully read through all of the code and study the class diagram to understand how uEngine works before you undertake these changes.

I have provided two test programs that you can use to help determine whether you have correctly repaired uEngine. Note, though, that successfully running the test programs is not proof that all issues have been correctly fixed.

Part 2: Questions

Provide brief answers to the following questions. Your answers should be concise, but should provide sufficient detail to fully answer the question.

  1. Create a class diagram of the Pong game provided with uEngine. Include all classes in the Pong game itself, and all important attributes and public operations in those classes. If any of these classes reference or derive from classes in the uEngine itself, include those classes in your diagram (but you do not need to include their attributes or operations.) Use the UMLet UML diagram editor to create your class diagrams.
  2. Which part of the code implements the scene graph? Is this actually a graph?
  3. What design pattern does the Input engine use? Why is this design pattern used?
  4. The Component class is not used in the provided code. Give a concrete example of how the Component class might be useful.
  5. Explain why use of Java’s paintComponent method is not a true implementation of the frame loop concept. How should this really be done?

To Hand In

Using OnQ, provide a handin consisting of two parts: (1) Your modified code for uEngine, and (2) a report answering the questions from part 2.

Your modified code should be a zip file containing a folder called uEngine-yourLastName. That folder should contain your full running solution to part 1. If your project doesn't work, include a description in your report specifying what does and does not work.

Your report for part 2 should be in PDF format. It should include your name and a title (e.g., Assignment 1, Part 2 Report). Use 11 pt type with at least 1" margins. UML diagrams should be integrated into the report, not submitted separately as raw UMLet files.

Evaluation

The assignment will be graded with the rubric provided in OnQ. Please review this rubric while completing the assignment.

© 2019 Nicholas Graham