Archive/Glest Advanced Engine

Effects & Upgrades is a tentative name for a code patch that extends upon the existing framework for upgrades and adds the the ability to cause temporary effects on a unit. The code is currently in pre-alpha state. =Upgrades= The upgrade xml format is extended while retaining legacy support for existing upgrades. This is in the file /factions//upgrades//.xml. The new format cleans up the xml file somewhat by not requiring you to have nodes present for attributes your upgrade does not effect, while extending upon the number of attributes you can modify with an upgrade. In addition, attributes can be modified using a multiplier as well as a static value, allowing you to scale the effect across units of varying power.

The following is a sample upgrade.xml file which does the exact same thing as the existing "Energy Sharpening" upgrade.

           

Note that nodes under &lt;static-modifiers&gt; and &lt;multipliers&gt; are optional and default to 0 and 1.0, respectively. If you wanted to increase the attack strength by 30% instead, you could use the following code for the static-modifiers and multipliers tags.

 <attack-range value="1"/> </static-modifiers> <attack-strength value="1.3"/>

Common Attribute List
The following is a complete list of attributes that can be modified by either a static amount or a multiplier in either the upgrade or effects XML structures and each should have a "value" attribute. Static values take a positive or negative number and default to zero (no modification). Multipliers take a floating point number, the default to 1.0 (multiply by one, or no modification). Note that this is not notated as a percentage. If you enter 100.0 for a multiplier, it means that the value increases 100 times. These are also covered in the reference section.

<max-hp> <hp-regen> <max-ep> <ep-regen> <attack-strength> <attack-range> <attack-speed>    &lt;-- increases or decreases rate of attack --&gt; <move-speed> <production-speed> <repair-speed> <harvest-speed>

=Effects=

Intro with examples
Effects are embedded in the &lt;skill&gt; tag of the &lt;unit&gt;. At this time, only attack skills and emanations (described in the next section) are supported, but a new "cast spell" skill type will be later added to allow effects to be put on friendly units or. The below is an example of an extended attack of the archer adding a poison to the arrows which causes blindness and 50 damage per second for 8 seconds. Note that the only part of this snippet that is modified from the original is the addition of the &lt;effects&gt; tag.

Example Skill With Effects <name value="attack_skill"/> <ep-cost value="0"/> <anim-speed value="50"/> <animation path="models/archer_attacking.g3d"/> <sound enabled="true" start-time="0.5"> <sound-file path="sounds/archer_attack1.wav"/> <sound-file path="sounds/archer_attack2.wav"/> <sound-file path="sounds/archer_attack3.wav"/> <sound-file path="sounds/archer_attack4.wav"/> <attack-strenght value="100"/> <attack-var value="50"/> <attack-range value="10"/> <attack-type value="piercing"/> <attack-start-time value="0.5"/> <attack-fields> </attack-fields> <particle value="true" path="particle_proj.xml"/> <sound-file path="sounds/arrow_hit1.wav"/> <sound-file path="sounds/arrow_hit2.wav"/> <sound-file path="sounds/arrow_hit3.wav"/> <sound-file path="sounds/arrow_hit4.wav"/> <sound-file path="sounds/arrow_hit5.wav"/> <effect name="blinding_poison" bias="detrimental" stacking="overwrite" target="any" chance="100.0" duration="8" image="../../../../placeholders/icon.bmp">  <hp-regeneration value="-50"/> </static-modifiers> <sight value="0.2"/> <fields-added/> <fields-removed/> <recourse-effects/>

By using the multiplier of 0.2 for sight, their sight is reduced to 20% of normal. Reducing it further may result in a sight of zero, which would make them incapable of attacking even targets directly adjacent to them, and that probably wouldn't be a very balanced attack, but it would be funny. :)

Effects can be used on attacks with a splash effect as well, this will cause all units in the splash radius to be effected. By default, all units are effected equally, even if they are on the very edge of the splash radius. However, by adding the flag &lt;apply-splash-strength&gt; to the &lt;flags&gt; section of the effect, this behavior can be overridden causing the strength of the effect to be weaker on units further from the point of impact. The strength of the effect isn't exposed through the XML interface, but it effects all attribute modifications (both positive and negative). Below is an example a theoretical effect added to the ice attack of an archmage. Presuming that the ice is cold, let's say that this will temporarily reduce the movement and attack speed of the target. However, the effect will be relative to where they in the splash radius. Also in this snippet, we omit tags and attributes that are not used, as most are now optional.

<effect name="icy_chill" bias="detrimental" stacking="stack" target="any" chance="100.0" duration="8">  <attack-speed value="-25"/> <movement-speed value="-50"/> </static-modifiers> <sight value="0.0"/> <apply-splash-strength/>

You may have noticed that the "stacking" attribute of the effect tag was set to "stack" this time instead of "overwrite". This means that successive attacks which cause this effect will accumulate, increasing the total effect. Each instance of the effect has it's own timer, so they will wear off one at a time. When set to "overwrite", the previous effect is simply overwritten and the duration reset. This isn't recommended for use with apply-splash-strength however because a second effect may be weaker and overwrite a stronger one.

Now let's go overboard and improve the initiate's attack. This will cause their targets to take damage over time, encouraging them to run fast, set them on fire spewing out firey particles with a sizzling sound and causing them to glow red for the duration. In addition the initiate will get a recourse effect, which gives them some extra energy regeneration and movement speed so he can follow his victim around and watch for as long as the bastard is burning up. Unused tags are again omitted.

<effect name="burning_bastard" bias="detrimental" stacking="stack" target="any" chance="100.0" duration="8">  <hp-regeneration value="-25"/> </static-modifiers> <movement-speed value="2.0"/> <light enabled="true" red="0.8" green="0.1" blue="0.1"/> <sound enabled="true" start-time="0.0" loop="true" path="sounds/sizzle.wav"/> <particle enabled="true" path="firey_particles.xml"/> <recourse-effects> <effect name="pyromania" bias="beneficial" stacking="stack" target="any" chance="100.0" duration="8">  <ep-regeneration value="25"/> </static-modifiers> <movement-speed value="2.0"/> <sound enabled="true" start-time="1.0" loop="true" path="sounds/manic-giggling.wav"/> </recourse-effects>

=Reference / Specification= Since there is no DTD, this section section will describe the expected XML format of newly added XML structures.

For the Pluralism column in the nested elements descriptions, the following is the legend for the notation:

&lt;effects&gt;
An &lt;effects&gt; node may be embedded in a unit skill node.

Attributes
none

Attributes
none

Nested Elements
Each nested element requires a single attribute named "value". For static modifiers, the value should be an integer and for multipliers the value should be a floating point number. If an element doesn't appear, the default value for static modifiers is zero and the default value for multipliers is 1.0.

&lt;flags&gt;
Flags effect various aspects of the "effect". Most flags are for AI use and are not yet used, but are hints to tell the AI how best to use skills with the effect. Each nested element has no attributes or children.

Attributes
none

&lt;fields-added&gt; and &lt;fields-removed&gt;
Specifies fields of travel that are added to or removed from the unit. This may be adding the ability for a unit to swim, or levitate or grounding an otherwise flying unit (forcing them to walk or become immobile). The only fields currently available are air and land. However, water, forest (i.e., travel through trees) and subterainian may be added in this mod.

Attributes
none

&lt;light&gt;
Causes light to emanate from the unit or changes the light if one already exists.

Nested Elements
none

Nested Elements
none

Nested Elements
none

Attributes
none

Nested Elements
none

&lt;emanations&gt;
May be optionally nested directly within a &lt;unit&gt; node. Emanations are static condition that applies an effect to surrounding units every tick. In general, an emanation should use the  stacking value. The attributes and nested elements in an &lt;emanation&gt; node is identical to an &lt;effect&gt; node with the addition of a  attribute.

Attributes
none

Nested Elements
none

Attributes
Contains all attributes of &lt;effect&gt;, with the addition detailed below

Nested Elements
See &lt;effect&gt;.