Production depending on difficulty

Sunday, 2010-01-17 Michael Burschik
In trunk, we have made the starting units of European nations as well as the production of tiles (especially colony center tiles) depend on the difficulty of the game.

In the specification, the unit element of the european-nation-type element now has an optional difficulty attribute, whose value must equal the ID of a difficulty level also defined in the specification. If the attribute is missing, the element will apply to all difficulty levels. In order to distinguish the individual units, an additional id attribute is also required now:

<european-nation-type id="model.nationType.immigration">
    <modifier id="model.modifier.religiousUnrestBonus" type="percentage"
              value="-33"/>
    <unit id="pioneer" type="model.unit.freeColonist" role="pioneer"/>
    <unit id="soldier" type="model.unit.freeColonist" role="soldier"/>
    <unit id="soldier" type="model.unit.veteranSoldier" role="soldier"
          difficulty="model.difficulty.veryEasy"/>
    <unit id="soldier" type="model.unit.veteranSoldier" role="soldier"
          difficulty="model.difficulty.easy"/>
    <unit id="ship" type="model.unit.caravel"/>
    <ability id="model.ability.foundColony" value="true"/>
    <ability id="model.ability.electFoundingFather"/>
    <modifier id="model.modifier.settlementDefence"
              source="model.source.inSettlement"
              type="percentage" value="50" />
</european-nation-type>

In this example, the nation type will start with a veteran soldier, a free colonist and a caravel on easy and very easy difficulty, and with two free colonists and a caraval on other difficulties.

In a similar way, the production element of the tile-type element may now have a difficulty attribute, too, although this feature is not used at the moment. Two additional children of the tile-type element, namely the primary-production and secondary-production elements, do make use of the feature, however, since the production of the colony center tile does depend on difficulty in the original game.

<tile-type id="model.tile.scrubForest" basic-move-cost="3" basic-work-turns="4"
           is-forest="true">
    <art basic="terrain/desert/" forest="forest/scrub.png" minimap-color="#24731f"/>
    <gen humidityMin="0" humidityMax="25" temperatureMin="10" temperatureMax="40"
         altitudeMin="1" altitudeMax="2"/>
    <modifier id="model.modifier.defence" type="percentage" value="50"/>
    <primary-production goods-type="model.goods.food" value="3"
                        difficulty="model.difficulty.veryEasy"/>
    <primary-production goods-type="model.goods.food" value="2"/>
    <primary-production goods-type="model.goods.food" value="1"
                        difficulty="model.difficulty.veryHard"/>
    <secondary-production goods-type="model.goods.furs" value="2"/>
    <production goods-type="model.goods.food" value="2"/>
    <production goods-type="model.goods.cotton" value="1"/>
    <production goods-type="model.goods.furs" value="2"/>
    <production goods-type="model.goods.lumber" value="2"/>
    <production goods-type="model.goods.ore" value="1"/>
    <resource type="model.resource.Oasis" probability="100"/>
</tile-type>

In this example, a scrub forest as colony center tile will produce three units of food on very easy, one unit of food on very hard, and two units of food otherwise. It will also produce two units of fur, independent of difficulty.

At this point, we need the input of players, so that we can copy all difficulty-dependent production values of the original game.