Monday, May 21, 2012 05:40

DirectX Volleyball

Note: Development on this project has ceased, as the game simply was not fun.

This started off as my first dabbling in DirectX programming. I started with a few tutorials to learn the basics, then went on to develop a simple and easy to manage game engine from that.

However, as things always seem to when dabbling, it grew and grew. As I went, I refined and refactored clunky pieces of code and decided to make a goal of creating a 3 dimensional version of Arcade Volleyball

The prime purpose of the game was to provide a showcase of skills that I have developed, and also my capacity for learning – most of the techniques employed here have been gleaned from reading journal papers, and going through tutorials – reworking them to work properly within the game engine.

Techniques

A variety of common techniques were used for DirectX Volleyball

  • Scene Graph

    A scene graph is used to organise the objects in the scene. It is completely heirarchical, and objects can be added and removed from the graph quickly and easily.

  • File Input

    The scene graph is capable of loading in models in both .x format (using DirectX native functions) and .3ds format (using a custom developed file parser). These readers preserve material properties and groups. The skeleton and the walls are both in .3ds format. The Monkey head representing the light is in .x format.

  • Per-Pixel Lighting (Blinn-Phong)

    All lighting in the scene is per-pixel, using the Blinn-Phong model. This takes material properties, lighting and camera/model/light positions to calculate the ambient, diffuse and specular light values for the surface. The ball in this demo uses Blinn-Phong lighting.

  • Normal Mapping

    Objects can have normal maps applied to them, which replaces the supplied normals of the mesh, allowing higher detail for objects with little extra calculations, and less polygons. The walls, ceiling and floor in this demo uses normal mapping techniques.

  • Anisotropic Lighting

    Anisotropic lighting has also been implemented. This uses a diffuse and specular map to give the model a wider range of views, while simultaneously cutting down on calculations (although a texture lookup is required). For this version, material properties are still taken into consideration, so a red brushed metal ball can use the same map as a blue ball. The head of the skeleton (the big ball) uses anisotropic lighting.

  • Omnidirectional Shadow Map

    Shadow mapping is a widely known technique for displaying shadows on the screen. A general limitation is that the standard technique only allows for spotlights in 1 direction, not point light sources (omni-directional). Omnidirectional Shadow Mapping has been employed on some of the objects in the scene.

  • Collision Detection and Response

    Collision detection and response has been implemented for planes and spheres, and there has been beginning steps made for ellipsoid collision detection.

    All objects (except the monkey head) in the game implement this collision system. The ellipsoid collision on the skeleton is slightly buggy, and can cause the player to get stuck in the wall.

Yet to be implemented

Several effects are planned to be implemented still

  • Full working ellipsoid collision
  • Improvement on the anisotropic map
  • Multiplayer
  • HUD (including a scoreboard)
  • Dynamic Scene Loader (possibly scripted)
  • …and much more!

Download Demo

If the videos do not capture your attention enough, latest snapshots can be found here.

Controls

WASD+mouse - move the skeleton around
Space - jump
Q - encourage the ball to go up
1 - turn shadow mapping on or off (this will probably double your performance)
LMB + WASD/space/c/mouse - move light around (monkey head is the light)
MMB + WASD/space/c/mouse - move camera around
RMB - throw a ball
B - release a crazy stream of balls
ESC - quit