- OpenGL based 3D high speed racing game based on Nintendo's F-Zero games, features:
- 100% new code base written in ~3 weeks for final project in CS 488 that received the award for best interactive project of the Winter 2005 term.
- Written in C++ using Microsoft Visual Studio 7.1 .NET, also compiles under GNU gcc (g++) 3.4.X.
- Simple DirectMedia Layer (SDL) as base framework for cross-platform compatibility (compiles and runs on Win32, Linux, and CYGWIN platforms).
- Designed around model-view-controller (MVC) design paradigm, with heavy use of standard object oriented design patterns, including: singleton, factory, observer, composite, template, memento, etc...
- Highly optimized algebra math library with vectors (2D/3D), points (2D/3D), matrices (4x4), quaternions, and planes.
- Custom templated List (vector) and String classes to replace slow STL versions.
- Input support for keyboard, mouse, and joystick through message passing event queueing mechanism.
- Bezier patches with adaptive tessellation for dynamic LOD (level of detail).
- Support bi-quadratic (3x3) and bi-cubic (4x4) control point configurations.
- Tessellation routine generates triangles, normals (by finding tangents and binormals), and triangle strip indices (linking together rows of strips into a single strip using degenerate triangles).
- Generate unique set of geometry per LOD, together with patch specific rows of polygons to fill t-edge gaps between neighboring patches of different LODs.
- Use distance from camera position to the center of a patch (on a logarithmic scale) to select the LOD to render that patch at.
- Basic support for smoothing normals between neighboring patches.
- Collision detection is performed againsts a fixed patch geometry LOD.
- Created and edited using Q3Radiant 1.0 (Build 197).
- Use generic Parser class as base for map parsing class to read Quake3 map files, extracting patch group definitions.
- Realistic physics for vehicle movement and collision detection:
- Finds position and time of a rigid body object's earliest collision given its current position and velocity.
- Uses swept sphere/ellipsoid technique for smooth sliding along polygon surfaces.
- Implemented using simple ODE solver based on RK4 integration method.
- Handles frictional, gravitational, normal, and air resistance / drag forces.
- Hierachical scene manager:
- Maintains both DAG (directed acyclic graph) and flat representations of scene nodes.
- Scene nodes extend an interface that requires the implementation of rendering, time stepping, and collision functions.
- Acts like a data factory for scene nodes of all extended types, including: patches, meshes, octrees, particle emitters, skyboxes, etc...
- Uses Manager template for management of meshes, enabling instancing when wrapping mesh scene nodes in transformed base scene nodes.
- Uses generic Parser class to read custom text-based scene definition files that support nested node definitions.
- Octree-based spatial partitioning for fast rendering and collision detection:
- Fast runtime partitioning of hierarchical geometry by bounding boxes (e.g. patch scene nodes) or individual polygons (e.g. triangle meshes).
- Supports querying by bounding volume and ray cast, and through registerable callback functions for hierarchical rendering.
- Uses camera frustum for view culling and elliptic volumes for collision detection.
- Tracks rendered and collided nodes/triangles per frame and physics cycle.
- Ability to render octree mini-map, for debugging purposes, that highlights actively collided nodes.
- Camera system using the position/view/up orientation representation:
- Smooth camera motion for previewing tracks using spline interpolation involving the use of 2 splines; one for the position, another for the view direction.
- Splines use the Catmull-Rom method of Hermite spline interpolation, where a value ranging from 0.0 to 1.0 will provide an interpolated point from a spline of any length.
- Supports freelook mode where user can navigate scene by translating position and rotating view direction with mouse.
- Supports object following mode where camera chases an ideal view of an object while maintaining some distance, being at some angle, and being limited to some speed.
- Supports editor mode where user can navigate scene with Maya-like controls (e.g. alt + left/middle/right mouse button), and select multiple scene nodes using a draggable selection rectangular.
- Supports ability to record spline paths, where freelook mode is used for changing position and view direction, and use can store key interpolation points/directions.
- Mesh/model support with instancing:
- Supports loading from Milkshape 3D mesh files.
- Supports bounding sphere/AABB volumes and per-polygon intersection/collision testing.
- Supports multi-textured rendering for cube maps and normal/bump maps.
- Supports multiple groups per mesh, each with different materials.
- Modelled racer vehicle from scratch in Wings 3D, generated UV mapping skin template texture, and used Paint Shop Pro 7.1 to color skin. Later imported mesh into Milkshape 3D to apply material properties and export as triangle sub-divided MS3D mesh.
- Particle emitter system:
- Implemented as extension to scene node, enabling hierarchical relations (e.g. vehicle engine flames are child nodes of the vehicle mesh node).
- Each particle within a system has its own position, velocity, acceleration, color, size, rate of growth, and decay time.
- Supports registration of particle initialize and reset callback functions, enabling quick implementation of new emitter types.
- Motion blurring for enhanced illusion of very high speed motion:
- Renders lower resolution game frame to offscreen texture/buffer and alpha blends with next actual game frame.
- Alters FOV during velocity boosts to enhance illusion of high speeds.
- Video/rendering system with abstracted interface design:
- Currently provides only an OpenGL API implementation, however should provide clean framework for implementing an alternative rendering API such as Direct3D.
- Supports 2D/3D immediate mode rendering. A defferred rendering solution is coming soon.
- Supports scene object picking by casting rays into scene node hierarchy.
- Image/texture manager that creates or reuses already loaded images:
- Supports loading and saving of 16/32-bit TGA images.
- Maintains texture material properties including ambience, diffusion, emission, shininess, and specular highlight.
- Ability to draw textures in 2D orthographic mode at pixel offset relative to top/left hand corner.
- Ability to create a memory texture that can be rendered/written to and rebound to texture that can be immediately rendered within the same frame.
- Font extension to Image, creating bitmap font display lists that can quickly draw 2D text using printf(...) style function syntax.
- Vertex and pixel shader management system:
- Supports standard ARB vertex/fragment shaders and Cg/CgFX vertex/pixel shaders.
- Uses the nVidia Cg Toolkit for Cg/CgFX shaders.
- Abstracts shader parameter setting routines to enable parameterized ARB and Cg shader programs to operate the same way externally.
- File system with support for custom resource archive data files:
- Provides an abstrated representation of a file in the form of a File object that supports reading and writing of buffers and streams.
- Resource archives support directory structure and simple encryption using cypher key.
- Ability to mount/unmount multiple resource archives, where the mount order determines a file's access precedence in the case that multiple archives contain the same filename.
- Physical files, placed inside directory structure rooted at location of resouces archives, will take highest access precedence.
- Features built-in tool to create resource archives given directory names, supporting recursion into sub-directories.
- Quake-style console with simple command shell interpreter:
- Currently only supports commands that can have multiple arguments and are directly linked to in-code functions prototyped with the void function(int argc, char *argv) signature.
- Variables, aliases, actions, key bindings, and abilities to save/load configuration files are coming soon.
- Memory manager wrapping common runtime allocation routines (i.e. malloc/free):
- Overloads C++ new/delete operators enabling global memory management.
- Tracks size, filename, and line number of each allocation -- providing mechanism to query memory usage during runtime:
- Typically only enabled in debug build, however also enabled in provided release build for demonstration purposes.
- All active allocations can be viewed using the "memorymap" console command.
- Ideal for identifying memory leaks and freeing leaked memory upon shutdown.
- User interface windowing system:
- Manages multiple overlapping windows with event based messaging system for input.
- Implemented widgets include: buttons, checkboxes, sliders, and seperators.
- Widgets support absolute and best-fit positioning within a window pane, and can be linked to in-code bool, int, and float variables.
- Supports mouse click-and-drag operations on window captions and slider widgets.
- Audio system that manages sound samples and music tracks:
- Uses SDL_mixer library for sound and music.
- Supports loading and playing of WAVE, MIDI, MOD, IT, and XM samples/tracks.
- Support for Ogg Vorbis decoding using the libvorbis library.
- Uses Manager template for management of Sound and Music objects.
- Game design, graphics, and audio were inspired by Nintendo's F-Zero, F-Zero X, and F-Zero GX/AX games.
- F-Zero, F-Zero X, and F-Zero GX/AX are © 1990, 1998, and 2003 Nintendo, respectively.