GAE/Skill XML

From MegaGlest
Revision as of 15:02, 13 September 2010 by Silnarm (talk) (build and repair)
Jump to: navigation, search

Common Skill Parameters

Type

This tells the engine what sort of skill this is, and must by one of 'stop', 'move', 'attack', 'build', 'harvest', 'repair', 'be_built', 'produce', 'upgrade', 'morph', 'load', 'unload' or 'die'

<type value="stop"/>

Name

This is a name you give to identify the skill, and is used in command XML elements to identify the skills the command uses.

<name value="idle_skill"/>

Ep Cost

How many energy points used for each use of skill

<ep-cost value="0" />

Speed

This important parameter controls how fast each skill cycle is executed, the effect of this parameter is discussed separately for each skill type.

<speed value="50" />

Anim Speed

This value controls the animation speed of the model.

<anim-speed value="200" />

Animation

Identifies the G3D file to use for the unit while this skill is being executed.

<animation path="path/to/g3d/file" />

Sound

Control if the skill has a sound, and if so an offset into the skill cycle to begin playing it.

<sound enabled="true" start-time="0.3">
   <sound-file path="path/to/sound/file"/>
</sound>


Skills By Type

be-built

If any other unit in a faction has a build command that can build this unit, then this unit must provide a be-built skill. The skill speed of the be-built skill is largely irrelevant.

<skill>
  <type value="be_built"/>
  <name value="be_built_skill"/>
  <ep-cost value="0" />
  <speed value="50" />
  <anim-speed value="300" />
  <animation path="path/to/g3d/file" />
  <sound enabled="false"/>
</skill>

die

Specific Elements:

<fade value="true" />

All units without exception must have a die skill. No commands reference the die skill, it is set when the unit is killed, and plays exactly one cycle, if the fade parameter is false the unit then completely disappears, if fade is true the animation will 'stick' at end, and after a while the corpse will fade and sink into the ground.

<skill>
   <type value="die"/>
   <name value="die_skill"/>
   <ep-cost value="0"/>
   <speed value="300"/>
   <anim-speed value="300"/>
   <animation path="path/to/animation.g3d"/>
   <sound enabled="true" start-time="0">
      <sound-file path="path/to/sound.wav"/>
   </sound>
   <fade value="false"/>
</skill>

stop

A stop skill is an idle (do nothing) skill, all units must have at least one stop skill. The speed of a stop skill effectively defines a 'reaction time', if a unit is idling and has a very low stop skill speed, it may noticeably lag in reacting to new orders. Conversely, an excessively high stop skill speed stresses the engine (faster cycle leads to more command updates). A suggested range for 'troops' would be 200-300 (command updates every 1/2 - 1/3 of a second).

There are at least two situations in which you may wish to deliberately specify a slow stop skill speed, the harvest command uses two stop skills, the second of which, stop-loaded, is played (for one cycle only) when the unit has finished loading a resource, before it goes back to the store. In this case, the speed effectively controls how long the unit will wait, and will be largely dictated by the anim-speed.

The other case is the patrol command, where a stop skill with a low speed might be used to have the unit pause slightly at either end of the patrol route.

<skill>
   <type value="stop"/>
   <name value="stop_skill"/>
   <ep-cost value="0" />
   <speed value="300" />
   <anim-speed value="300" />
   <animation path="path/to/model.g3d" />
   <sound enabled="false"/>
</skill>

move

Move skills are fairly straight forward, the skill speed controls the speed the unit moves at.

<skill>
   <type value="move"/>
   <name value="move_skill"/>
   <ep-cost value="0"/>
   <speed value="250"/>
   <anim-speed value="100"/>
   <animation path="path/to/model.g3d"/>
   <sound enabled="false"/>
</skill>

harvest

Harvest skills are required to collect resources, the skill speed controls the rate at which the resources are collected, but this is controlled in conjunction with parameters of the command that uses it, see the <insert link here> Harvest command for more details.

<skill>
   <type value="harvest"/>
   <name value="harvest_skill"/>
   <ep-cost value="0"/>
   <speed value="200"/>
   <anim-speed value="80"/>
   <animation path="models/harvesting.g3d"/>
   <sound enabled="true" start-time="0">
      <sound-file path="sounds/file1.wav"/>
      <sound-file path="sounds/file2.wav"/>
   </sound>
</skill>

build

Build skills are used to build other units, the skill speed is used to control the rate at which hp are added to the unit being built. Each skill cycle will add (max_hp / time)[from the built unit's parameters] hp to the unit under construction.

<skill>
   <type value="build"/>
   <name value="build_skill"/>
   <ep-cost value="0"/>
   <speed value="150"/>
   <anim-speed value="80"/>
   <animation path="path/to/model.g3d"/>
   <sound enabled="true" start-time="0">
      <sound-file path="sounds/buildsound1.wav"/>
      <sound-file path="sounds/buildsound2.wav"/>
      <sound-file path="sounds/buildsound3.wav"/>
   </sound>
</skill>

repair

Specific Elements: [all optional]

<amount value="20" />         <!-- default value: the same formulae as used in build (see above) -->
<multiplier value="1.5" />    <!-- default value:  1.0 -->
<pet-only value="false" />    <!-- default value: false -->
<self-allowed value="true" /> <!-- default value: true -->
<self-only value="false" />   <!-- default value: false -->

Repair skills are used to restore hp to other units, similar to the build command, but with more options to override the default amount of hp to restore each skill cycle. If amount is not specified the same formulae as is used in the build skill is taken as the base value, which can then be modified by the multiplier.

If pet-only is true, the skill can only be used to heal pets of this unit. likewise, if self-only is true it can only be used to self-heal, setting both is an error. Setting self-allowed to false and self-only to true is also erroneous.

<skill>
   <type value="repair"/>
   <name value="repair_skill"/>
   <ep-cost value="0"/>
   <speed value="150"/>
   <anim-speed value="60"/>
   <animation path="path/to/model.g3d"/>
   <sound enabled="true" start-time="0">
      <sound-file path="sounds/repairsound.wav"/>
   </sound>
   <multiplier value="1.2" />
   <self-allowed="false" />
</skill>