Manufacturing Processes

Image

 

Click image to return to Home

Image

 

Manufacturing Processes

Using the principles learnt in the Creating Old World Mods tutorial, this tutorial will take you through the requirements of setting up manufacturing processes. Manufacturing processes are where you take collected resources, and process them into more complex materials. EG: steel from iron.

Tutorial

As with all mods, create the mod folder, modinfos.xml and Infos folder. This is the basis for all mods.

First up, an explanation of what we want to do. We want to add steel as a manufactured resource. This resource is made from processing 10 iron into 5 steel at a smith (an urban building). We then want a city project to upgrade the forge in the smith, which for each step processes an additional 10 iron into 5 steel. Finally, we want to enable the Smith with the discovery of Steel tech card, and then add steel as a requirement to build Dromon, Longbowman, Swordsman, Crossbowman, Cataphract and Pikeman.

First up we need to add steel as a yield.

    <Entry>
        <zType>YIELD_STEEL</zType>
        <Name>TEXT_YIELD_STEEL</Name>
        <Color>COLOR_YIELD_STEEL</Color>
        <zIconName>YIELD_STEEL</zIconName>
        <iValueAI>40</iValueAI>
        <iPrice>8</iPrice>
        <iMinPrice>4</iMinPrice>
        <iMaxPrice>200</iMaxPrice>
        <iDemand>100</iDemand>
        <bGlobal>1</bGlobal>
        <bStockpile>1</bStockpile>
        <bCanSell>1</bCanSell>
        <bCanBuy>1</bCanBuy>
        <bCanGift>1</bCanGift>
        <bSellDebt>1</bSellDebt>
    </Entry>
                                

We set the starting market price, the min-max price, and the other yield trading settings. You also set the text name, color and even some ambitions for steel.

When we run the game, load the Mod, and now we have Steel in the game!

Now we need a way to create steel in this Manufacturing Processes mod. We need an urban improvement that converts 10 iron into 5 steel automatically. Here is the xml for our Smith improvement.

    <Entry>
        <zType>IMPROVEMENT_SMITH</zType>
        <Name>TEXT_IMPROVEMENT_SMITH</Name>
        <Class>IMPROVEMENTCLASS_SMITH</Class>
        <AssetVariation>ASSET_VARIATION_IMPROVEMENT_SMITH</AssetVariation>
        <zIconName>IMPROVEMENT_SMITH</zIconName>
        <iBuildTurns>5</iBuildTurns>
        <iBuildCost>1</iBuildCost>
        <iPillageTurns>10</iPillageTurns>
        <iMaxCityCount>2</iMaxCityCount>
        <bBuild>1</bBuild>
        <bTerritoryOnly>1</bTerritoryOnly>
        <bUrban>1</bUrban>
        <bRequiresUrban>1</bRequiresUrban>
        <bNoVegetation>1</bNoVegetation>
        <EffectCity>EFFECTCITY_IMPROVEMENT_SMITH</EffectCity>
        <aiYieldCost>
            <Pair>
                <zIndex>YIELD_WOOD</zIndex>
                <iValue>20</iValue>
            </Pair>
            <Pair>
                <zIndex>YIELD_STONE</zIndex>
                <iValue>20</iValue>
            </Pair>
        </aiYieldCost>
        <aiYieldOutput>
            <Pair>
                <zIndex>YIELD_IRON</zIndex>
                <iValue>-100</iValue>
            </Pair>
            <Pair>
                <zIndex>YIELD_STEEL</zIndex>
                <iValue>50</iValue>
            </Pair>
        </aiYieldOutput>
        <aiYieldPillage>
            <Pair>
                <zIndex>YIELD_STONE</zIndex>
                <iValue>10</iValue>
            </Pair>
            <Pair>
                <zIndex>YIELD_WOOD</zIndex>
                <iValue>10</iValue>
            </Pair>
        </aiYieldPillage>
        <abTerrainValid>
            <Pair>
                <zIndex>TERRAIN_URBAN</zIndex>
                <bValue>1</bValue>
            </Pair>
            <Pair>
                <zIndex>TERRAIN_LUSH</zIndex>
                <bValue>1</bValue>
            </Pair>
            <Pair>
                <zIndex>TERRAIN_TEMPERATE</zIndex>
                <bValue>1</bValue>
            </Pair>
            <Pair>
                <zIndex>TERRAIN_ARID</zIndex>
                <bValue>1</bValue>
            </Pair>
        </abTerrainValid>
    </Entry>
                                

I have based this on a barracks building, which is similar in that it is a singular urban building (isn't upgradable), similar cost, as well as converted a resource (training) into something. Since we can't add assets yet, I've also borrowed the Barracks graphics for the improvement.

After creating all the requisite entries in texts, effectcity, and even adding in an apprentice level specialist the Blacksmith (increases output by 50%), here is our Smith in the game!

The next part of the Manufacturing Processes mod is the city project to upgrade the forge. We could do this two way:

  • A repeatable project that just adds another 5 steel for another 10 iron; or
  • Forge 1, 2, 3 similar to how Forum upgrades, to a maximum number.

For this tutorial, we are going to do Forge 1, 2 & 3, similar to how the Forum upgrades. However, I will tell you how to make a project repeatable.

Here is the xml for our Forge 1 project.

    <Entry>
        <zType>PROJECT_FORGE_1</zType>
        <Name>TEXT_PROJECT_FORGE_1</Name>
        <zIcon>PROJECT_FORGE_1</zIcon>
        <iCivics>40</iCivics>
        <iMaxCount>1</iMaxCount>
        <CityProject>PROJECT_FORGE_1</CityProject>
        <EffectCity>EFFECTCITY_PROJECT_FORGE_1</EffectCity>
        <EffectCityExtra>EFFECTCITY_PROJECT_FORGE</EffectCityExtra>
        <MinimumCulture>CULTURE_WEAK</MinimumCulture>
        <TechPrereq>TECH_STEEL</TechPrereq>
        <EffectCityPrereq>EFFECTCITY_IMPROVEMENT_SMITH</EffectCityPrereq>
        <aiYieldCost>
            <Pair>
                <zIndex>YIELD_STONE</zIndex>
                <iValue>20</iValue>
            </Pair>
        </aiYieldCost>
        <abInvalidBy>
            <Pair>
                <zIndex>PROJECT_FORGE_2</zIndex>
                <bValue>1</bValue>
            </Pair>
            <Pair>
                <zIndex>PROJECT_FORGE_3</zIndex>
                <bValue>1</bValue>
            </Pair>
        </abInvalidBy>
    </Entry>
                                

For Forge 2 & 3 you just need to alter the prerequiste project, and invalid by project. Take special note of how the project and the effectCity work. There are many options in these two files, so take the time to read and understand the options available to you.

To make it a repeatable project, you add the bRepeat tag and remove the abInvalidBy tag.

Our Smith, with fully upgraded Forge III, and a Blacksmith specialist. Making steel.

The breakdown of the stats are as follows:

  • Smith takes 10 iron.
  • Forge III takes 30 iron (10 for each level).
  • Smith process 40 iron into 20 steel.
  • Blacksmith gives a 50% bonus to steel production, thus makes 10 steel himself.

Result is that a fully upgraded and staffed Smith will process 40 iron into 30 steel.

The final part of the Manufacturing Processes mod is to make certain units require steel to build. Adding the steel requirement is as simple as copying the units required into a change xml file and adding the steel yield cost element.

Here is the Cataphract that now requires some steel for the plate armor.

That concludes this tutorial. You should now be able to add new yields, improvements, projects, unit requirements, ambitions and all the connectors between these items.

Manufacturing Processes source files - 5 June 2020