Robot Game

This topic contains the following sections.

Introduction to Robot Game

The Robot Game Kit is a complete mini game for XNA Game Studio. The project comes ready to compile and run, and it's easy to customize with a little bit of C# programming. You are also free to use the source code as the basis for your own XNA Game Studio game projects, and to share your work with others.

Robot Game is a three-dimensional robot combat game that demonstrates the following components:

  • Advanced graphics using shaders and post-processing effects
  • Advanced particle system
  • Collision detection, 3D positional sound, input, and screens management
  • Single-player mode and split-screen two-player versus mode
  • Customizable game elements, such as robots, weapons, and items

System Requirements

Minimum Shader Profile

Vertex Shader Model 2.0
Pixel Shader Model 2.0

Getting Started

Building and Running a Robot Game Project

To build and run the Robot Game project

  • Either press F5 or, on the Debug menu, click Start Debugging.

    The project will build and then run within the debugger.

To build the project without running it

  • Either press F6 or, on the Build menu, click Build Solution.

    The project will build without running.

Game Controls

You can use a keyboard or Xbox 360 controller to play Robot Game. The controls are as follows:

Action Gamepad Control Keyboard P1 Control Keyboard P2 Control
Select a menu entry. Left thumb stick W, A, S, and D UP ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW
Accept the menu selection. A SPACEBAR, ENTER None
Cancel the menu. B ESC None
Exit the current screen. START, BACK ESC None
Move the robot. Left thumb stick W, A, S, and D UP ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW
Turn the robot. Right thumb stick F, H Num Pad 4, 6
Fire the current weapon. Right trigger G Num Pad 5
Reload the current weapon. Right bumper T Num Pad 8
Ignite boosters. Left trigger SPACEBAR Num Pad 0
Switch the current weapon. Left bumper V Num Pad 1
Toggle camera mode (Debug configuration only) Left thumb stick button ENTER None

Implementation Notes

Customizable Assets

  • Gameplay data, such as level specifications, robot specifications, and item specifications, are implemented as XML files. These files require no processing, and they are loaded at run time via the XML serialization system. They are included directly in the game project rather than the content project, and the files must be set to copy to the output directory for the game to function.
  • Animations (.Animation files) and particle systems (.Particle files) are internally implemented as XML data, but this implementation detail is abstracted by the XNA Content Pipeline importer, processor, and writer types specified in the RobotGameProcessors project. All content of these types must use their respective importers and processors, and the custom file extensions instruct Visual Studio to make those assignments by default.
  • Normal map and specular map textures are stored as user string properties of the models in Maya.

Debugging Assistance

  • To enable invulnerability for the player's robots, set the initialization value of the debugMode field in the GamePlayer class, found in the game project.
  • The framerate of the game is shown only in debug mode. This functionality is implemented in the FpsCounter class in the data project, in the Helper subdirectory.

Extending Robot Game

There are many possible ways to modify or improve Robot Game:

  • Create or modify 3D models and animations: The 3D models for RobotGame are in the Autodesk FBX format (.fbx). Most 3D design tools will export to this format. The specification of each robot’s model is within each robot’s .spec file, in the ModelFilePath section. However, note that if the model’s bones do not match the associated animation files, then the game will not function properly.
  • Change gameplay data: The data for each level (.level), all items (.spec), weapons (.spec), and robots (.spec) are stored as XML. This makes it easy to open each file and change the values, including power, speed, position, etc.
  • Change particle systems: The data for particle systems (.Particle) is stored as XML. This makes it easy to customize the particle systems used in the game.