Assignment for 05-830, User Interface Software, Spring, 1997.


Animation and Interaction Benchmark Description

Neal Altman, Khalil Amiri, Herb Derby, Zhenyu Wang

February 2, 1997

Introduction

This benchmark explores how user interface elements and animation interact in a real-time war game setting. In a typical game, the user creates and orders troops around the battlefield, and he observes the consequences in real-time. Also, games have a limited resource which constrains the player's options for creation and manipulation (ie no gold, too little hit-points or no food.) The computer simulates the interactions with the battlefield and the opponent's troops. The richness of the war games is governed by the sophistication of the simulation. To focus the benchmark on interaction with animation, we use a simplified simulation. This benchmark encompasses many aspects of a selection-action manipulation paradigm like a drawing package but with moving objects.

Specification

We divide the specification into two parts to facilitate the discussion: the simulation of the troops and battlefield, and the elements of the user interface and how they map to the simulation. The discussion below does not describe an implementation; it is a device to discuss the simulation separately from the interface. You should feel free to implement this benchmark in any way which captures the same effect as the specification.

Simulation
In the simulation for the benchmark, troops have the properties of position, velocity, velocity maximum, food, food maximum, name, type, and a list of orders. The battlefield has width, height, a main food storage, and a list of troops. A turn of the simulation updates all the dynamic properties of the objects in the simulation according to wall clock time.

Troops
There are three types of troops ‹ artillery, cavalry and infantry. They have the following creation characteristics.

Artillery start out with 50 food and have a maximum of 60 food. They have a maximum movement of 3 units/second. It takes 40 food to create them.

Cavalry start out with 20 food and have a maximum of 50 food. They have a maximum movement of 10 units/second. It takes 50 food to create them.

Infantry start out with 30 food and have a maximum of 30 food. They have a maximum movement of 5 units/second. It takes 30 food to create them.

During each turn, the individual troop's orders are used to update the troop's properties.

The orders for the troops are

Change Name is the order to change the troop's name property to new-name
Adjust Velocity adds xDelta and yDelta to the troop's velocity up to the troop's velocity maximum.
Adjust Food adds foodDelta to the troop's food up to the troop's food maximum.

Then, the simulation uses the troop's velocities to update the troop's position. To simplify the simulation, the troop's positions wrap around the borders of the battlefield; if a troops moves off the right edge of the map, it will reappear on the left edge, and the same with the top and bottom borders. Each turn, the simulation updates the positions in real-time, using the following equation:

position.x := deltaTime * velocity.x
position.y := deltaTime * velocity.y

Where deltaTime is the time of this turn minus the time of last turn. The troop's position is wrapped in the battlefield simulation.

Finally, the simulation updates the troop's food. To update the troops food, delta time is subtracted from the troop's current food. If a troop runs out of food then it is removed from the simulation, but this is done by the battlefield simulation.

Battlefield
The battlefield is created to be the width and height of the viewing area. After the troops have been updated for the turn, the simulation updates the battlefield. To update the battlefield, the simulation traverses the list of troops in the battlefield wraps any troops which are out of bounds and removes any troop with no food left.

The battlefield also increases the main food storage at the rate of 5 food per second to a maximum of 500 food.

The User Interface Elements
The user interface elements abstract the current state of the battlefield and the troops in the simulation, and allows changes to the simulation.

Troops
The troops are displayed as a solid color rectangle decorated with information about the troop. In the center of the rectangle, is a diagram representing the standard military icon for the kinds of troops. In the benchmark there are artillery, infantry, and cavalry. The food and food maximum are displayed in the upper left corner of the rectangle. The name is displayed centered in the lower portion of the rectangle.


Battlefield
The battle field is a solid color. The battlefield should display all the troops in its troop list. Also, it is responsible for displaying the selection which is a rectangle surrounding the troop. If you click on a troop, that troop becomes selected and the previously selected troop becomes unselected. If you click on the battlefield where there are no troops, then the selection is removed.


Command Palette
The command palette has controls for creating new troops, changing troop's velocity, displaying the main food storage, displaying a troop's status changing a troops name and giving a troop food. There should also be an exit or quit button.

Creation - This is a group of three buttons for each of the troop types. Creation can only happen if there is enough food in the main food storage for the type selected. If creation can not happen because of a lack of food, then the creation button should be disabled. When a troop is created, it is added to the battlefield's troop list and the Main Food Storage is adjusted to remove amount of food required for creation.

Velocity Change - This is a group of four buttons which change the selected troop's velocity. If no troop is selected, the buttons should be in the disabled state. If the troop is moving at a maximum velocity in a given direction, then the arrow should be disabled. Pressing these buttons adds the appropriate Adjust Velocity command to the troop's orders, which increases the speed in the appropriate direction by 1 unit.

Main Food Storage - The main food storage display is a horizontal bar graph. It reflects the amount of food in the main food storage.

Status Display - This display reflects the state of the currently selected troop. It displays the icon of the troop type, the amount, and maximum of food as a vertical bar graph, and the troop's name as an editable string on the bottom of the status display. If no troop is selected there should be no status.

Troop's Name - The troop's name is an editable text field, which should change the troop's name. The appropriate Change Name command should be added to the troop's orders. It should be disabled if no troop is selected.

Food Increase - The food increase button is to the right of the status display. Every time it is pressed it adds an Adjust Food <10> to the troop's orders and reduces the Main Food Storage by ten units if there are ten units of food in the Main Food Storage. If no troops are selected this button should be disabled.