Battle Ground (Game)

The three main objectives for this project were to implement a demonstrable A* pathfinding algorithm, implement variance shadow mapping and to create a game that could be played against an AI opponent.

The AI player moves by considering each valid neighbouring map node and for each valid node performs the following:

  • Calculates the shortest path to the human player using A*
  • Calculates the number of bullets that will pass over the node within a specified time frame (dependant on difficulty level), which is then multiplied by a “bullet factor” (dependant on difficulty level) to produce a “danger score”
  • Add the path distance returned by A* to the previously calculated “danger score”

The node with the lowest total score is the node that the AI player next moves to.

When shooting at the human player, the AI player first considers whether the human player is within a specified distance or if it is stationary, if either is true then the shot direction vector is calculated taking the centre point of the AI player and the centre point of the human player. Else, the direction in which a shot should be fired in order to hit the human player is calculated taking the human player’s current direction and velocity into account in addition to the time it would take for a single bullet to reach the predicted future position of the human player. Once the shot direction has been calculated a test is then performed to ensure the shot will reach the human player without colliding with other objects. If the shot is “clean” random error is added to the shot direction (up to a maximum value specified by the difficulty level) and a bullet is fired.

Features and Techniques

AI:

  • Navigates the map and seeks the shortest path to the human player using A*
  • Avoids bullets through adding an additional cost (to that returned by A*) of the considered node
  • Calculates where to aim in order to hit the human player based on the players movement direction and speed
  • Checks that a shot is "clean" before shooting (will reach the target without hitting scenery)
  • Random error (up to a maximum error value specified by the difficulty level) is added to the shots

General:

  • A* Pathfinding
  • Basic menu system
  • Difficulty levels
  • Variable time step

Graphics:

  • Basic material system
  • Normal mapping
  • Shader Model 3.0 Geometry Instancing
  • Specular highlights
  • Variance Shadow Mapping with blur
  • Z pre-pass

Screenshots

Click an image to enlarge (opens a new window).

image image image image

Video

Download

Please download the game here. Controls are included in a text file within the download. Source code available upon request.

Requirements

  • Shader Model 3.0 or greater capable graphics card.
  • June 2010 or later version of DirectX 9.0 re-distributable. Download the latest version here.
  • Built using Microsoft Visual C++ 2008 SP1 and requires the latest Microsoft Visual C++ Library Runtimes. The latest runtimes for the x86 platform can be downloaded here.