Subfactions is a mechanism that allows a single faction to have multiple overlapping definitions that allow the rules of what commands, units, buildings, skills, upgrades, morphs, etc. are available to change. Subfactions generally progress from the "base" subfaction (i.e., no "sub" in the faction) on to more advanced subfactions. This progression may be linear, or it may branch allowing multiple paths of progression. Some examples of similar mechanism in other RTS games are the progression to different "ages" in Age of Empires or Empire Earth.
Limitations[]
- There is currently a hard limit of 32 subfactions per faction.
- The AI cannot yet play subfactions at all.
How they work[]
When not defined, each faction has only the "base" subfaction (which is to say none). To use subfactions, you must first add them to the faction XML. For example, to give a faction two subfactions, you could use the following code.
<subfactions>
<subfaction name="subfaction1"/>
<subfaction name="subfaction2"/>
</subfactions>
This will cause thefaction to posses the subfactions "base" (the default), "subfaction1" and "subfaction2".
Subfaction restrictions[]
Subfaction restrictions can be applied to any command, unit (including buildings) or upgrade by specifying a list of subfactions that the item is allowed in with a <subfaction-restrictions> tag. If <subfaction-restrictions> tag is not present, then all subfactions are allowed (eg, no restrictions). For units, the <subfaction-restrictions> tag is added to the <parameters> node; for commands, they go directly under the <command> node; and for upgrades, they go directly under the <upgrade> node.
Advancing into a subfaction[]
Anything that is produced, such as producing a unit, constructing a building, or performing an upgrade, can be used to advance into a subfaction. This is done with the <advances-to-subfaction> tag. This is either found in the parameters if a unit, or in the upgrade element if an upgrade, and looks like this:
<advances-to-subfaction name="subfaction_name" is-immediate="false"/>
The name is the name of the subfaction to advance into. Is-immediate determines if the faction should be advancing into the subfaction when the upgrade/production is complete ("false") or when it starts ("true").
Example[]
In Four Path Magitech, players are allowed to choose an advanced subfaction once a basic infrastructure is built. When the game starts, the the Mage Tower can produce initiates, but there are also two upgrades, "Path of Corruption" and Path of Nature" which are greyed out until the summoner's guild and library are built, where upon they both become available. Once either of these upgrades complete, the subfaction advances and the option to upgrade the other disappears. In fact, all producible commands will disappear if they are not available in the new subfaction.
<upgrade>
<image path="images/corruption.bmp"/>
<image-cancel path="images/magic_upgrade_cancel.bmp"/>
<time value="450"/>
<unit-requirements>
<unit name="library"/>
</unit-requirements>
<resource-requirements>
<resource name="gold" amount="200"/>
<resource name="wood" amount="200"/>
<resource name="stone" amount="200"/>
</resource-requirements>
<subfaction-restrictions>
<subfaction name="base"/>
</subfaction-restrictions>
<advances-to-subfaction name="path_of_corruption" is-immediate="false"/>
</upgrade>
The first thing you may notice is that this upgrade is only available in the "base" subfaction. It exists solely for the purpose of allowing path of corruption units to be built, this is done with the <advances-to-subfaction> the is-immediate attribute is set to true, the advancement will occur as soon as the building, upgrading, morphing or producing begins. Otherwise, the advancement will occur once it is completed.
In FPM, some of the original units were around to better fit the story line. The creators didn't feel it would be normal for magicians who later embraced nature, life and all things good to be summoning giant daemons and researching hell gates, we moved these to the path of corruption. This means that when you first build your library, you will not see the ability to research Hell Gate at all until (and unless) you research the path_of_corruption upgrade (which causes the advancement). This behavior is again caused by adding the <subfaction-restrictions> tag.
<upgrade>
<image path="images/hell_gate.bmp"/>
<image-cancel path="images/magic_upgrade_cancel.bmp"/>
<time value="350"/>
<unit-requirements/>
<resource-requirements>
<resource name="wood" amount="200"/>
<resource name="gold" amount="200"/>
</resource-requirements>
<subfaction-restrictions>
<subfaction name="path_of_corruption"/>
</subfaction-restrictions>
</upgrade>