Chocolate Bunny Escape
w - Move player forward a - Move player left s - Move player backward d - Move player right ESC - Exit gameMouse:
Move to orient view Left-click to fire
Flocking behavior is achieved throuhg a mix of three other behaviors:
Figure 1: Components for successful AI
In addition to this flocking behavior, Obstacle avoidance is used to enable bunnies to maneuver around each other in order to attack the player. This works by creating a rectangle in front of each bunny. If anything intersects the rectangle, a lateral force is applied away from the nearest object, equal to the lateral distance to that object (Figure 4).
If the swarm is within a specified attack range from the player:
The bunny melting effect is handled through use of a vertex shader. Vertex shaders operate on all vertices passed down the graphics pipeline and take over the job of transformations and lighting. By returning a modified vertex position, a melting effect can be obtained. For a more realistic effect, the position is modified using the sine function operating on the x and z coordinates of the vertices. Combining this value with the inverse of the bunnies' health creates a smooth melt which reflects overall damage to the bunny. In addition, a sine function modifies the x and z coordinates of the vertices once the y coordinate is below a lower threshold to create a 'pooling' effect.
Figure 2: Various stages of bunny melt
Figure 3: Description of Flamethrower effect
There's no reason to make the computer perform lighting calculations on objects that
the player can't see. View Frustum Culling (VFC) is the process of removing objects
outside the camera's field of vision from the rendering path, to speed up performance.
In the "Original Scene", there are objects that are out of the player's view.
Each object is checked against the four planes that define the viewing volume. If
it's on the opposite side of every plane, we know for sure that it's hidden from the
player's view. In the "Frustum Plane Test", green objects are objects that are within
the view frustum and should therefore be drawn. Red objects are not drawn, as they
are out of the player's view.
Once all of these hidden objects are removed, the scene can be rendered more efficiently
without impacting what the player sees. This is shown in the final picture, "Scene
after VFC".
Figure 4: Description of View Frustrum Culling
Level of detail for the terrain is handled through recursive comparison of
quad-tree nodes against a distance metric. If the node of the quad-tree is
greater than a certain distance from the player, it is labeled as a leaf. All
terrain located within a leaf of the quad-tree is rendered using a level
dependent resolution. Thus, if a leaf is located one-level deep in the
quad-tree, the associated terrain is far from the player and can be rendered
at a lower resolution, whereas leaves at max depth are closest to the player
and should be rendered at maximum detail. This implementation increases the
frame rate by reducing the amount of quad-tree traversal required as well as the
resolution of terrain objects far away.
Figure 5: Wireframe box showing level of detail
Sounds are handled through the audio API, OpenAL which
provides a simple buffer allocation scheme for storing sound sources as well as
functions for playing and stopping those sources. Sound effects currently in
the game are the following:
- Flamethrower
- Player footsteps
- Bunny attack sounds
- Player and Bunny defeat sounds
Wikipedia Neon Helium Tutorial
World Wind Wiki Patent Storm
Examples from Cg Toolkit
Flocking as a Concurrency Problem Steering Behaviors For Autonomous Characters Siggraph 97 Potential Fields
Duke's MD2 Loader