Food Fight :: FOOOOOD FIIIGGHHHTT

Story:

You are a child. You have food.
Wreak havoc.

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 just uses the distance formula.

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

Here is our collision detection system. The uniform spatial subdivision grid as well as each object's bounding box has been drawn.


If an enemy is hit by a player's food, he stops walking. He falls onto the floor, then gradually fades out.


Here the player is being attacked by a nearby enemy.


This image shows off the particle system to simulate soda fizzing out of a can.


The next two images demonstrates non-rigid deformation. In the first picture, the cake is still in the air. In the second picture, the cake has hit the floor and looks flattened. This simulates cake behavior in real life.



A large "Game Over" message is displayed when either time (as shown here) or food supply runs out.