CSCE 4013 - Homework 6
Due Date - April 28, 2014 at 11:59 PM

1. Problem Statement:

The goal of this programming assignment is to implement a minion movement AI for a simple video game framework. There are five phases to this process.

  • Reading the game environment. You will be given an ascii file that describes the game environment with X's and O's marking where there are obstacles and free space. The first line of this file will contain two integers R and C that represent the number of rows and the number of columns in the environment file. The rest of the ascii file will be a sequence of R lines with C characters per line. Once you have read and stored the game environment, you will use this information to control where minions are allowed to travel and where minions are not allowed to go. For example, if you read in a 10 by 10 game environment, then each X or O will represent 10% of the height and width of your game display.

  • Display the game environment. In a real video game, the display of the game environment gets a lot of attention to make the game visually entertaining. In this assignment, we simply want to show where there are obstacles, and where there is free space for the minions to travel. You can do this by displaying a grid of polygons with different colors (e.g. black=obstacle, green=open) or different texture map images (e.g. rocks=obstacle, grass=open).

  • Create and display initial minions. Your program must then create a collection of M minion characters at a random location in the game environment. Since we do not the minions to be piled on top of each other, you must spread them out in a random looking cluster around the random starting location. Just be sure that the minions are all at least distance D from each other, and none are positioned on top of an X region. Since our goal is to animate the movement of minions, you can use a simple geometric shape like a sphere or a cube to represent each minion, and use OpenGL or Unity to display the minions.

  • Get minion destination from user. In order for the minions to move, they must have a target destination. Use the mouse callback function in OpenGL or similar function in Unity to get the (x,y) screen location you would like the minions to go towards. Use your game environment to decide if this location is in free space, and if so display something on the screen to show that the location was selected. For example, a green cube. If the user clicks on an obstacle, you should ignore the user input, and wait for them to click on a location in free space.

  • Animate the motion of minions. Once you have the starting location and destination of the minions, your next task is to calculate a path for the minions to follow to the destination, and display the motion of each of the minions as they move across the game environment. Remember, minions are not allowed to move over obstacles, and they can not go through each other as they move. You should move the minions at a moderate pace across the screen - slow enough that we can watch the minions move, and fast enough that we do not fall asleep before the minions reach their destination. If the user clicks on a new minion destination while your minions are moving, you should calculate a new path to follow, and start the minions moving in this new direction.

    2. Design:

    For this project, you can use either OpenGL or Unity to create your minion motion animation. There are several sample OpenGL programs in our source code directory you can use to create and display spheres and cubes and a planar game environment. If you want to use Unity to implement this project, you will need to download and install Unity on your own machine. In this case, you may want to use the the Unity "roll-a-ball" project to display your minion animation. Whatever you choose, remember it is the motion of minions that is the primary goal, and not wonderful graphics.

    3. Implementation:

    You can implement this program using either a bottom-up approach or a top-down approach. If you go for a bottom-up approach, start by creating basic methods and classes, and test theses methods using a simple main program that calls each method. When this is working, you can create the main program that uses these methods to solve the problem above.

    If you go for a top-down approach, start by creating your main program that reads user input, and calls empty methods to pretend to solve the problem. Then add in the code for these methods one at a time. This way, you will get an idea of how the whole program will work before you dive into the details of implementing each method and class.

    Regardless of which technique you choose to use, you should always develop your code incrementally adding code, compiling, debugging, a little bit at a time. This way, you always have a program that "does something" even if it is not complete. Also, remember to keep backup versions of your code, so you always have a version to fall back on if you accidentally delete your code or your changes do not work out.

    4. Testing:

    Test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. You are required to include your testing results in your project report to demonstrate that your program works correctly. To do this use the "script" command to save all program input/output in a "typescript" file, and cut and paste from this ascii file into your program documentation.

    5. Documentation:

    When you have completed your C++ program, use the "Programming Report Template" on the class website to document your programming project. This report has separate sections to describe the problem statement, your design decisions, your implementation process, and your testing results. Each of these sections should be 1-2 paragraphs long, so your completed report will be 2-3 pages long once you have included your testing output.

    6. Project Submission:

    In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic analysis of all programs that are submitted. When you have completed the tasks above go to the class web site to "Upload" your documentation (a single docx file), and your C++ program (a single ascii text file).

    The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit:

    You will receive partial credit for all programs that compile even if they do not meet all program requirements, so handing projects in on time is highly recommended.