Food Fight :: FOOOOOD FIIIGGHHHTT


Team Members
Christopher Gilson (W 2011)
Eric Fong (W & S 2011)
Annabel Hung (W & S 2011)
Advisor: Zoe Wood
Cal Poly, San Luis Obispo

Story:

You are a child at school. It's lunch time, and you're not really hungry. What are you going to do with your food? Hey, did that kid just throw something at you? Throw something back.

Goal:

Score as many points as you can before your food supply or time runs out.

How To Play:

Right click on a spot on the ground to move to that spot.
Left click on a spot on the ground to throw food to that spot.
Press 1, 2, or 3 to toggle which food to throw.
Avoid getting hit by an enemy's food, or you'll lose points!



Technologies:


Collision Detection:

Uniform spatial subdivision was implemented to improve collision detection. Specifically, a 2D grid of equally sized sections parallel to the ground plane was used. If two objects are located within the same section, their bounding boxes will be compared for overlap. Each section maintains a list of objects located within it, so that only sections containing more than one object need to be checked for colliding objects.

Cell Shading:

Cell Shading was implemented using a pixel shader. The shading incorporates texturing, and essentially is implemented by putting thresholds on lighting intensity. This produces an effect where portions of the model with light intensity values within a certain range all appear the same color, creating "bands" of increasingly darker shades of color.

Shadows:

Shadows are implemented in FoodFight as simple planar projection shadows. Because our ground plane is the X-Z plane, we use preset normals and a generic light source to draw planar shadows of the player, the obstacles, and the enemies.

LUA Scripting:

Lua scripting was introduced into the game for future design. Currently, it is used to store information about how big the world is, how many enemies to spawn, and the time limit. These values can be changed after compile time without rebuilding the code.

View Frustum Culling:

VFC is done in an alternate way here, by keeping a model of the view volume at all times, and treating it as an object which objects are either inside or outside of. For the purpose of culling, all objects have a spherical bounding volume (as opposed to object-to-object collisions).

Particle Systems:

Particles systems are represented internally as a group of particles. Each particle has a position and a velocity, while each system has a gravity, and decay. Particles in a system all decay (fade out) at the same rate. Each particle is drawn as a textured point-sprite. Point sprites are, by default, billboarded (aligned to always face the camera).

Non-rigid deformation:

Food is deformed when it reaches the ground through a vertex shader. The shader currently uses a fairly simplistic method of decreasing the y value of all vertexes, while proportionally increasing the x and z values, according to a constant which is incremented smoothly.

Animation:

Animation was produced by producing a simplistic skeleton for animated models. The animations contain "keyframes", which contain the skeleton's current position in the animation. The skeleton's position is then interpolated between keyframes, in order to produce the appearance of smooth movement. The model's actual mesh is then attached to the skeleton, causing the entire mesh to animate.

Artificial Intelligence:

Simple AI was implemented to enhance gameplay. When the player comes within a certain distance of an enemy, the enemy will throw food at the player. If the food collides with the player, the player's score is decremented. The distance check simply uses the distance formula. Each enemy can only attack every three seconds, and it will not attack if it has fallen down.

High Score:

Basic file input and output was used to maintain the latest high score. When the game is first loaded, the high score is read from a file. If the file doesn't exist, it is created. At the end of each round, the player's score is compared with the high score. The player's score becomes the new high score if it is greater than the old one.

Resources:

Image Loader Base Code : Zoe Wood
MD2 Model Loader : Video Tutorials Rock
Text File Loader: Lighthouse 3D
VFC Base Code : Lighthouse 3D
Audio : Irrklang
Planar Shadow Projection Base Code
Background Music: Fat Princess Forest Theme
Food impact sound: Freesound
Enemy impact sound: Super Mario 64


Models and Texturing:

All models (including simplified meshes) were created by the team, using Blender, exported to MD2 format. Texturing for the enemies, the player, the soda, the cake, and some parts of the HUD were produced by the team. Resources for other textures are listed below.

Objects

Banana
Floor
Walls
Tables

Particle System

Splat
Pow
Bubble

HUD

Soda
Banana
Cake


Screenshots

The main menu for Food Fight.


------


The food selection screen is where the player gets to purchase what foods to use. The allowance prevents players from buying anything they want, so they have to plan carefully.


------


Here is our collision detection system. The uniform spatial subdivision grid as well as each object's bounding box has been drawn in white. (Note: this image was taken from the first quarter, hence the difference in the score display. However, the collision system has not been changed.)


------


Here is an example of the particle system. "Pow" sprouts from the cake to simulate an explosion.


------


Another example of the particle system. Here, soda fizzes out of the can.


------


This screenshot demonstrates how the enemies are "inactive" upon getting up after being hit by food, indicated by their transparency. Enemies that are inactive will not collide with food and are thus worth no points.


------


Here is Food Fight in all its messiness! Even though five enemies fell down, the player was also hit by food, so the net score is only 2. Note the current high score, 7, is displayed below the player's score.


------


At the end of each round, a score screen is displayed. The player is also given the choice to play again, or go to the main menu.