Interactive Media & Game Development
Worcester Polytechnic Institute

IMGD


IMGD 3100: Novel Interfaces for Interactive Environments
Project 3: Gravity Base
Due: Friday, September 27, 2013 at 6pm

Objective: THIS PROJECT SHOULD BE DONE IN GROUPS OF TWO!

In this project, you will implement a simple tilt-and-tap game on the Android platform. The game will use built-in sensing and actuation on the Android to produce a fun experience.


Game Design: The project objectives are for you to:
  1. familiarize yourself with programming on the Android platform,
  2. learn how to read Android sensors, and
  3. learn how to build a simple game.
The goal of Gravity Base is to stay alive for as long as possible under a constant barrage of falling debris.

Gravity Base is made up of a single, never-ending level.

There are two main parts to the game: a "Base" with a Protection Ray, and falling debris.

At the start of the game, the player sees a small circle (the "Base") in the center of the screen, and a line (the "Ray") drawn from the center to the edge of the screen. As the player tilts the phone, the Ray moves to align with the "up" direction of the phone. For example, if the phone is tilted so that the top is up, the Ray will intersect with the top of the phone display. Think of a radar display, with the "sweep line" being controlled by phone tilt.

When the game starts, small circles (representing debris) will appear near the display edge at randomly determined locations, and move towards the Base. To destroy a peice of debris, the player needs to tilt the phone so that the Ray intersects the debris, and then tap the phone screen. Each tap of the screen will trigger a single pulse Beam from the Base along the Ray.

The game ends when three pieces of debris hit the Base. Each hit on the Base should be accompanied by visual, sound, and vibration feedback.

To implement this game, you will need to provide several types of information to the player. These include:

  • visual filled colored circles for the Base and debris (different colors),
  • a visual line representing the Ray controlled by phone tilt,
  • visual, auditory, and vibrotactile cues representing the Beam when the screen is tapped, and
  • visual, auditory, and vibrotactile "explosion" media.

Attacking
the Problem:
Start early! I am a firm believer in front-loading as much work as possible on projects. The more you get done now, the fewer unknowns you will have about the project, and the sooner you'll start making significant progress.

As stated earlier, there is very good support on the Android Developer Site, including numerous tutorials. If you are new to Android development, I strongly suggest you work through the tutorials first, starting with the material on the "Dev Guide" tab.

Remember to start small. As described below, break down the individual parts into smaller, more-manageable pieces; don't try to solve the whole problem from the start.

For this project, you are going to build three subprojects, described below.

  1. Part 1: Touch Input
    In this part, you will make a simple application that detects touches on the Android screen.
    The program should:
    1. clear the screen and draw a filled rectangle representing the touch surface,
    2. display a filled circle in the center,
    3. detect when the user touches the screen, and
    4. play a sound and give brief vibrotactile feedback.

    The application should continue indefinitely.

    Try to build this part of the program knowing that you will be growing it into your final application. There is a good introduction to programming on Android on the Android Developer Site on the "Developer" tab, under "Develop"->"Training"->"Getting Started". There is also some good sample code at "Developer"->"Develop"->"Tools"->"Samples". Also, on the "Reference" tab, under "android.view", the "MotionEvent" class will be of interest for getting touches.

  2. Part 2: Accelerometer Input
    In this part, you will make a simple application to read from the Android accelerometer and update a line on the screen. This should be added to Part 1.
    The program should:

    1. display everything from Part 1,
    2. continuously read the values from the accelerometer, and update the Ray based on the readings,

    Movement of the circle should be absolute, meaning if we assume a level Android to be zero degrees, then the circle would be in the middle of the screen. If we assume a 90-degree tilt as maximum for a given axis, then the circle would be displayed at the edge of the screen. An angle of 45 degrees would place the circle half way between the center and the corresponding edge. This should work for both axes.

    There are several related sample apps on the Android Developer Site on the "Developer"->"Develop"->"Tools"->"Samples". Also, on the "Reference" tab, under "android.hardware", the "Sensor," "SensorEvent," "SensorEventListener," and "SensorManager" classes will be of interest for getting accelerometer values.

  3. Part 3: Putting It All Together
    In this part, you will finish up the game, adding the falling debris and determine if the Ray is intersecting a peice of debris when a user tap occurs.
    The program should:

    1. display everything from Parts 1 & 2,
    2. continuously generate random debris on the periphery of the screen,
    3. move the debris towards the Base over time, and
    4. make the Base take damage with each hit.

    The "tricky" parts are probably going to be getting the game logic in place, workng with timers, and testing.



What to Submit: All documents are to be submitted electronically via turnin by 6:00 pm on the day the assignment is due. Also, you will demonstrate your projects in class as well, so come prepared!

The following items should be submitted for this project:

  1. the code for the project.
  2. a brief description of your project. How do I run it? How do I play?
  3. a brief listing of what each teammember contributed to the project, and
  4. an apk for the final version.
Name each file something that makes sense.

When you are ready to submit, zip up all your files into a single archive file.
Name the file Lastname1_Lastname2_proj3.zip, with the Lastnames being those of the teammembers.

You will use the Web-based "Turnin" facility to submit your work. Information about submitting can be found here:

http://web.cs.wpi.edu/~kfisler/turnin.html.

Your WPI user ID should be used to login, and you will be emailed a password.
The Turnin assignment ID is proj3.


Academic
Honesty:
Remember the policy on Academic Honesty: You may discuss the project with others, but you are to do your own work. The official WPI statement for Academic Honesty can be accessed HERE.


Back to course page.