6.2 MapObj

Next comes the MapObj. This is where the attributes are defined for the unit's placement on the map.


MapObj()
{
 GodFile("JDA_GUARDIAN.god");
 PhysicsModel("Walker");
 ArmourClass("armor_infantry");
 TypeDisplay()
 {
   Image("jda_units_1.tga", 0, 0, 64, 64);
 }
 TractionType("traction_walker");
 ApplyTerrainDamage(1);
 HitPoints(63);
 Armour(62);
 ArmourRegenInterval(20);
 GenericFX()
 {
   Add("MapObj::Death", "common.class.infantrydeath");
   Add("MapObj::Armour::Damaged", "jda.armor.hit-small");
   Add("MapObj::Armour::Lost", "jda.armor.lose-small");
   Add("Restore::Target::Process", "common.class.RestoreTargetProcesssmall");
   Add("Weapon::Fire", "jda.fx.guardian.fire");
   Add("UnitObj::Blind", "common.class.BerzerkProcesssmall");
 }
}

Let's go through each section one at a time.

GodFile - The all-important .god file is defined here. The .god contains the geometry for the object as well as all textures and animation. Creating .god files is a very complicated business that I'll only touch on here. The art asset can be made in either SoftImage or 3DSMax and exported as a .xsi. The .xsi then gets brought into the proprietary MeshViewer tool and converted into the .god format.

PhysicsModel - The physics model affects how the unit will move on the map. It defines whether or not it tilts when it moves on slopes, how fast its speed is affected by slopes, whether it moves on the surface of water, under the water, or if it flies over the water. The Guardian is a "Walker", so it moves on the ground plain, does not tilt when going up a hill, and has its speed diminished 25% by slopes. To find a list of all physics types, look in \packs\base\configs\game\types_phycis.cfg.

ArmourClass - The Armour Class field is yet another blaring hint that this game was programmed by foreigners. This is where a unit's susceptibility to weapon damage is defined. You will notice later on that each weapon has an explicit entry for its damage effect to each of the six "armor" classes: infantry, vehicle, structure, flyer, naval, and mines. If one of these classes isn't specified in the MapObj, the unit cannot take damage.

TypeDisplay - This is where you specify the art asset that will be used to represent the unit on the build menu. This is called the unit icon. It is only needed if the unit you are making can be created by the player. The four numbers after the file name explain where on the image the icon can be found. This is needed because several icons can be fit onto a single image. The first two numbers give the X and Y coordinates for the upper left corner of the icon. The next two numbers give the length and height of the icon in pixels.

TractionType - This entry goes hand-in-hand with the PhysicsModel in defining on-map behavior. It explains how fast a unit moves over each type of terrain. As explained elsewhere, each terrain texture has an affect on how units pass over it. The basics are fast, slow, base, and impassable. Placing water on the map automatically overrides whatever texture is on the ground beneath it, and the cell becomes one of the six types of water terrain, depending on its depth and distance from the shore. To view all the traction types, look in \packs\base\configs\game\types_traction.cfg. Here is a brief explanation of each type of terrain:

Base - Default setting used by the base texture in each world.

BaseNoAir - Same as base, but blocking air units (used only by footprinted objects).

Fast - Same as base, but with a slight speed boost to infantry and hover vehicles.

Slow - Same as base, but slower for infantry, tracked, and hover.

Impassable - Ground units cannot pass over it, but air can.

ImpassableAir - Neither ground nor air can pass.

ShallowShoreline - Cell is partially above ground, partially underwater, and submerged portion is no more than 1 meter in depth.

MediumShoreline - Cell is partially above ground, partially underwater, and submerged portion is no more than 2.5 meters in depth.

DeepShoreline - Cell is partially above ground, partially underwater, and submerged portion is greater than 2.5 meters at its deepest point.

ShallowWater - Cell is completely submerged and no more than 1 meter in depth.

MediumWater - Cell is completely submerged and no more than 2.5 meters in depth.

DeepWater - Cell is completely submerged and more than 2.5 meters at its deepest point.

ApplyTerrainDamage - This flag sets whether the unit can be hurt by terrain effects. It isn't currently used for anything.

HitPoints - Fairly self-explanatory and very important. This sets the strength of each unit. It is displayed as the green HP.

Armour - This is the amount of regen armor that a unit has. It shows up as blue HP in the game.

ArmourRegenInterval - This sets how fast the armor regenerates. The number tells how many tenths of a second it takes to recuperate 1 hit point. A setting of 20 means it takes 2 seconds to get 1 point.

GenericFX - The effects that can be run on a unit must all be listed here. Things such as armor damage, death, recycling, power down, restore, and others all need to be entered. The best thing to do is to just copy these effects over from a similar unit.

ResourceObj

The resource crystals have their own Obj that is built off the MapObj. It is very simple, with only two entries.


ResourceObj()
{
 ResourceMax(3000);
 ResourceRate(3);
}

ResourceMax - This specifies how much resource the crystal starts with.

ResourceRate - How many units of resource are regenerated per second.

PropObj

The PropObj is not needed in the actual config. It is created automatically for ambient objects like rocks and trees and does not have any sub-references. In fact, you don't even need to know it exists. Let's move on.