Deployables

From Mod Wiki
Revision as of 15:30, 21 November 2007 by Ducks (talk | contribs) (Batch update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page describes how to configure your map so players can place deployables, as well as how to limit the areas in which deployables can be placed.

All input maps must be compiled before using these tools.

Creating your Heightmap and Masks

The heightmap will be output by the MaskGen tool, along with creating masks for deployables.

The syntax for this command is "MaskGen %datablockname%" where datablockname is the name of a stringMap decl, which contains parameter info for the tools. Examples of these can be found in "pathfinder.def".

The following list contains the possible parameters that can be supplied for MaskGen.

 "map"		   // The map you wish to generate the mask/heightmap for
 "mg_max_slope"   // Any surface at a greater angle than this will be written as black to the mask
 "mg_resolution"  // Resolution of the tga to output
 "mg_heightmap"   // Location to write the heightmap to

The mask will be written out into the "base/imagedump/MaskGen/" folder, with the name of the map, and a timestamp as part of the file name. You should copy the ones you want to a more appropriate location. These masks can be edited in photoshop, with anything completely black being counted as non-valid, and anything else counted as valid.

  • Mark's note ... run this command from the console to create the heightmap and masks:
    • maskgen pathfinder_MAPNAME

Specifying the Heightmap and Masks for your map

Both of these are supplied in the mapInfoDef for your map. An example follows:

 mapInfoDef "valley" {
 	commandmap	"commandmaps/valley"
 	heightMap	"heightmaps/valley.tga"	
 
 	areaOfRelevance {
 		...
 	}
 
 	masks {
 		"mask_default"			"imagedump/deploytest.tga"
 		"mask_mcp"			"imagedump/deploytest.tga"
 	}
 }

"mask_mcp" Specifies the mask where MCPs may be deployed in the map, mask_default specifies the mask for all the deployables. Currently all the deployables are set up to just use the "mask_default" section, if a deployable needs a different mask, it should have its "mask" parameter in its deployableObject decl changed to something else, and entries added to the masks section for each map.

Creating the path finding nodes for the Magog

Using the same stringMap you have created for maskGen, you should fill in the parameters for the pathFinder tool. The following parameters are supported:

 "def_vehicle"      // vehicle to be used, should be "vehicle_magog"
 "map"              // map being used
 "heightmap"        // debugging command, should be left at 1
 "tris"             // debugging command, should be left at 0
 "output"           // temp map to write the nodes out to
 "sample_rate"      // rate to sample into the working image, should be 32
 "ground_offset"    //	distance to offset the points from the ground, should be 512
 "resolution"       // resolution of working image, shoudl be 1024

Once the map is done, remove any nodes currently in your map, and copy the new ones from the output map.

  • Mark's note ... run this command from the console to create the nodes:
    • pathfinder pathfinder_MAPNAME

Level Designer Notes

  • Deployables Masks:
    • These black & white greyscale images should be committed to SVN:
      • base/masks/yourMapName/default.tga
        • this mask is in world space, not UV space
        • this file needs to be 130x130 ... a 128x128 image with a 1 pixel black border
        • the caulk hull in the map needs to be 256 units thick ... this is what is represented by the 1 pixel border
        • each pixel of default.tga represents a 256x256 unit square on the terrain
      • base/masks/yourMapName/mcp.tga
        • This is the area where the MCP is allowed to deploy.
    • Be sure to enter the correct mask decls in this file: base/mapinfo/maps.txt.
    • The masks can be refined using Maya's 3D paint tool or Photoshop. Before testing in game, be sure to use Photoshop's Image > Adjustments > Brightness/Contrast to crank the contrast up all the way to ensure that all pixels are either pure black or pure white. Only pure white pixels are checked for deployment validity.
    • In game debug tool: g_debugMask "mask_default"
      • The mask name is based on the decl name found in base/mapinfo/maps.txt.
      • For example, "mask_default", "mask_mcp", etc.
      • The lines are drawn at the corners of the deployment grid squares (every 256 game units)
      • The GREEN lines show possible deployment areas and RED lines show areas that cannot be used. Set g_debugMask 0 to turn the display off again.
  • Deployment Rules (things to consider when tweaking the masks)
    • The new grid-based system uses a global grid made up of 256x256 unit squares (128 along X and 128 along Y)
    • The number of squares required by the deployable is dependant on the model's bounding box but can be modified in the def (for instance, if the gun barrel sticks out farther than the feet). Eg. "mdl_scale_factor" "0.7"
    • The deployable checks to see if it is allowed to be deployed (via the territory), then checks to see if it is on a white pixel of the mask, and then checks to see if the slope of the terrain is flat enough ("max_height_diff" default 48). Of course, possible deployment will also take into account obstructions from other geometry and deployables already in place.
  • Heightmap Mask:
    • This file should be committed to SVN:
      • base/heightmaps/yourMapName.tga
    • Since the deployment system uses this image to determine the differences in height (48 units, as mentioned above) this image needs to be updated regularly.
    • World geometry (as seen with g_showCollisionWorld) contributes to the heightmap. If you want to be able to deploy an item onto a piece of model geometry, the model needs to be placed into the map as a model_static with "mergecm" "1" set.
  • Pathfinder Nodes:
    • Once you have pasted the pathfinder nodes into your map, you can put them into an EditWorld Group and hide them. This prevents accidental deletion and reduces the amount of visual clutter in the world map.