Tuesday, April 19, 2005 Torque Game Engine World (cont.)

Mission File

Copy your MIS and TER files to your game/data/missions directory. If the directory doesn't exist, create it. The mission file consists of a SimGroup object, made up of other objects. The required objects are: MissionArea, which defines the area of your map for the Mission. If the player leaves the mission area you can react to that event with messages or such. The Sky object defines our skybox. Imagine our world is fully contained within a large box, this is the skybox. The sky color and cloud textures are mapped to the skybox. And of course, our TerrainBlock, which is the world we stand on.

Here's a simple mission file example:

tank.mis
//--- OBJECT WRITE BEGIN ---
new simGroup(MissionGroup) {
   new missionArea(MissionArea) {
      area = "-1024 -1024 2048 2048";
      flightCeiling = 300;
      flightCeilingRange = 20;
      locked = true;
   };
   new sky(Sky) {
      materialList = "./skybox.dml";
      useSkyTextures = true;
      skySolidColor = "0.000 0.000 0.215 0.000";
      locked = true;
   };
   new terrainBlock(Terrain) {
      position = "-1024 -1024 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      detailTexture = "./detail1";
      terrainFile = "./tank.ter";
      squareSize = 8;
      bumpScale = 1;
      bumpOffset = 0.01;
      zeroBumpScale = 8;
      locked = true;
   };
};
//--- OBJECT WRITE END ---

You may have noticed that some values are surrouned by quotes and others are not. All values are treated as strings and can be surrounded by quotes if you desire. Values which contain multiple numbers require quotes to delimit the entire value, but stand-alone values like "8" and "true" do not require quotes, and you can just as easily leave them off if you prefer.

Most of the properties of these objects are self-descriptive, like area, position, rotation and scale. For teh sky object, the property useSkyTextures can be set to "false" to set the skybox with a solid color with a simple horizon gradient, or add the property noRenderBans set to "true" to disable the gradient. The color is set in skySolidColor. The property materialList identifies the DML text file which lists the textures for the skybox. The file sky_storm.dml is just a list of the textures in this order:

  1. sky front
  2. sky right
  3. sky back
  4. sky left
  5. sky top
  6. sky bottom
  7. cloud 1
  8. cloud 2
  9. cloud 3

The texture files are simple image files, 256x256 pixels in dimension. You can use larger files for greater fidelity, but the larger the file, the more memory required to store the images. The cloud textures are the layers of clouds, with each layer moving slower from bottom to top. It is important to note that no matter how high you fly in a game, you cannot reach the cloud layer.

A great tool for creating skybox files is Terragen, available for free (with restrictions) at http://www.planetside.co.uk/terragen/. There is also a resource site for Terragen at http://www.terrasource.net/.

The skybox is always a set distance away from the player, and the location is fixed, so if you use flat textures on the box sides, your sky will appear distorted. To prevent this, you distort the images in the opposite direction. In the demo game folder under demo\data\skies, view each of the storm and cloud files for examples, then copy them to your game/data/missions directory. If you rename cloudsotrm to cloudstorm be sure the reference to the file is correct in your DML file. Create your own material list file and save it to the same directory.

skybox.dml
storm_0001
storm_0002
storm_0003
storm_0004
storm_0005
storm_0006
storm_0007
storm_env
cloudstorm

In the terrainBlock object, the detailTexture property sets the texture you see on your terrain in the immediate vicinity. Copy the detail1.jpg file from the demo game's demo\data\terrains\details directory to your game's game\data\missions directory.

Previous | Next