Malloreon Malloreon

City Improvement Modding Guide

City Improvement Modding Guide

First post: Step by step instruction for a simple Improvement.

Second post: Library of relevant tags (work in progress)

 

Alright, here is a quick guide on how to get all those nifty tiles you guys created to be available as build options in your cities.

 

Basics:

  • You can use Windows Note Pad to edit .xml files - however, when you save new files, they will likely have the .txt ending - to fix this, you to go to 'Folder and Search Options' on your windows explorer, and un-selected 'Hide extensions for known file types' under the 'View' tab. Now you can rename the file and modify its extension to .xml
  • All mod files you make should go into your /Documents/My Games/Elemental/Units folder.
  • Original game files which you can use for inspiration (specifically city improvements) are found in /Program Files(x86)/Elemental/data/English/Core Improvements.
  • City Improvements you create will usually have two files associated with them.
    • The .xml file that you created in the Tile Editor (you find this in /My Game/Elemental/Tiles). This file contains information telling the game the placement of specific graphical elements you added in the Tile Editor.
    • A new .xml file that you have to create manually (The main topic of this guide). This file will contain information telling the game that your tile is actually a city improvement, what this city improvement requires, and how it affects the game.

Tile Editor:

The tile editor is pretty self explanatory, the only thing I'd like to point out is that you might want to create two actual tiles per improvement you are planning. The first one should contain the finalized graphic (save this as YourTileName_01), while the second one should contain graphics for the building process (Like some workers, building materials, scaffolding, etc.) of your improvement (save this as YourTileName_Build_01) .

 

Main:

  1. Open your Windows Notepad and add <?xml version="1.0" encoding="ISO-8859-1"?> 
  2. Add the tags <ImprovementTypes> in row 2, and </ImprovementTypes> in the last row. These lines tell the game engine that anything in between these lines pertains to City Improvements (this could be more than one city improvement - you can have all the city improvements you created for your mod in this one file).
  3. Add the tags <ImprovementType InternalName="YourTileName"> in row 3, and </ImprovementType> into the second-to-last row, where YourTileName needs to be replaced with the name you want the game engine to reference your improvement. Anything between these two tags pertains to a specific City Improvement (the one indicated by YourTileName).

Example:

As you can see, the Improvement I'm adding has the name Malloreon_Sm_Dirt_Patch. To prevent confusion I'm adding my name at the beginning of each file I'm creating (File names are unimportant to the game, so feel free to do this).

Now, let's give our City Improvement an In-game name and description, and tell it which graphics to use:

  1. Add the line <DisplayName>Name</DisplayName> where Name is the visible In-game name.
  2. Add <Description>Text</Description> where Text is the visible In-game description you see when mousing over. There is also <LongDescription>, but I didn't see a use for this In-game yet (wasn't looking hard, however).
  3. Add <TileDesign>YourTileName_01</TileDesign> You DID save your tile with that _01 added, right? This is the name of the tile you created in the Tile Editor (containing information on graphics).
  4. Also, add <ConstructionTileDesign>YourTileName_Build_01</ConstructionTileDesign> this tells the game what graphics to display for your city improvement while it is under construction.

Example:

A few more necessary tags include:

  • <RequiresCity>True</RequiresCity>
  • <ReqCityLevel>#</ReqCityLevel>
    • where # is a number between 1-5. This indicates the level your city needs to be at to build this improvement
  • <SupportedTerrainType>TYPE</SupportedTerrainType>
    • replace TYPE with City, Land, or Beach
    • Usually City is enough, sometimes I see a second tag of this type with Land or Beach (for the Harbor)
  • <DrawnIcon>FILENAME.png</DrawnIcon> and <DrawnIconConstruction>FILENAME.png</DrawnIconConstruction>
    • These tags offer graphics either for the construction menu, the construction placement cursor, or the cloth map (didn't test this yet)
  • <Thumbnail>FILENAME.png</Thumbnail>
    • I assume this is the picture you see when mousing over an improvement, however, it could also be the graphics for either the construction menu, the construction placement cursor, or the cloth map (didn't test this yet)

 

Let's get to the costs of construction:

Turns until build:

<LaborToBuild>#.#</LaborToBuild> - Replace #.# with numbers (such as 2.0 for 2 turns) the lowest number seems to be 1.0 (even putting 0.0 resulted in building requiring 1 turn to build)

 

Resource Cost:

<GameModifier>

<ModType>ConstructionResourceCost</ModType>

<Attribute>RESOURCE</Attribute>

<Value>#</Value>

</GameModifier>

  • You need all these 5 lines for each resource (so copy/paste this if you have two or more resource costs)
  • Replace RESOURCE with Materials, Gold, Rations, or Metal
  • Replace # with the amount of resources to take. NOTE: you have to add a - to the number, otherwise you will be giving your faction more of a resource, instead of taking it away. (e.g. -10)
  • You can add <PerTurn>#</PerTurn> if you want to add a maintenance cost (e.g. a lumbermill could get a -1 to wood/materials, but a +1 to gold)

 

Prerequisites:

<PreReq>

<Type>TYPE</Type>

<Attribute>Attribute</Attribute>

</PreReq>

  • Once again, you need to add all these lines once per different prerequisite
  • Replace TYPE with Allegiance, Tech (there are very likely more options that I didnt see yet)
  • Replace Attribute with:
    • Kingdom or Empire - for Type: Allegiance
    • Internal Techname (e.g. Mining_Amarian for Mining researched by a Kingdom faction, these can be found under /data/English in the file CoreTechs.xml

Further Prerequisites can include:

<RequiresCity> - can be True or False

<RequiresResource> - can be True or False

<RequiresCityImprovement>InternalImprovementName</RequiresCityImprovement> - for example 'Malloreon_Sm_Dirt_Patch' is the internal name of the tile I created in my examples. I could use the presence of that improvement as a requirement to build something else.

 

Ok, it's way past my bedtime, I'll add some more to this later.

 

 

 

 

 

100,197 views 32 replies
Reply #26 Top

The <NewCityHubType> tag works for me.

You can give fallen or kingdom center to any city (capital and others can differ). For example you can give the resoln cities kingdom centers. I maked some nation, they worked fine. You can mix the center and the wallset, but the buildings won't change. And you can make new set for citycenter or wall.

My probel, that i am not able to give the special buildings to a faction (except the total new techtree generation method, but there must be an easire way).

 

Reply #27 Top

You could try to combine a new cityhub list with RequiresCityImprovement. If your race builds a new type of cityhub, and the new buildings require that cityhub, you can limit your new buildings to that race.

Reply #28 Top

great idea, i will try it if i get home, thanks

Reply #29 Top

Quoting Heavenfall, reply 25
On the topic of interesting possibilities, I noticed in the raceconfigs these tags

    <NewCityHubType>Outpost</NewCityHubType>
    <CapitalHubType>Outpost</CapitalHubType>

which would possibly mean we can have one cityhubtype for our capital and another for our outliers. If possible, this would tie into tile design as well.

Edit: The tag appears not to be functional. Too bad.

In the Core Improvements subdirectory (within data/English), the file K_City_Hubs contains an ImprovementType with the internal name of Outpost.

Code: xml
  1.  &lt;ImprovementType InternalName="Outpost"&gt;
  2.   &lt;DisplayName&gt;Outpost&lt;/DisplayName&gt;
  3.   &lt;AIName&gt;Outpost&lt;/AIName&gt;
  4.   &lt;TileDesign&gt;K_Outpost_02&lt;/TileDesign&gt;
  5.   &lt;TileStagePopulation&gt;2&lt;/TileStagePopulation&gt;

This is likely the reference, so I'll be testing this out a bit if someone doesn't beat me to it.

Reply #30 Top

So I created two outpost types, First Outpost and Second Outpost:

Code: xml
  1. &lt;ImprovementType InternalName="Outpost"&gt;
  2.   &lt;DisplayName&gt;First Outpost&lt;/DisplayName&gt;
  3.  &lt;/ImprovementType&gt;
  4.  &lt;ImprovementType InternalName="Outpost_Test"&gt;
  5.   &lt;DisplayName&gt;Second Outpost&lt;/DisplayName&gt;
  6.   &lt;AIName&gt;Outpost&lt;/AIName&gt;

I then modified the CoreRaceConfigs to reference each:

Code: xml
  1.  &lt;RaceConfig InternalName="KingdomOfAltar"&gt;
  2.   &lt;NewCityHubType&gt;Outpost_Test&lt;/NewCityHubType&gt;
  3.   &lt;CapitalHubType&gt;Outpost&lt;/CapitalHubType&gt;
  4.  &lt;/RaceConfig&gt;

I created both a new city with my sovereign and a second city with a pioneer.  Both reference "Outpost_Test" and the cities are both named "Second Outpost."

So the reference is correctly applied to new cities, but the capital hub (internal name "Outpost"/<CapitalHubType>) does not appear to be used at this time.  It would be nice to get some official Stardock feedback on this.

 

Reply #31 Top

That's what I said on the last page, heh.

Reply #32 Top

Quoting Heavenfall, reply 31
That's what I said on the last page, heh.

I wasn't sure which tag you were referencing and I was not sure if you had found the improvement type with the Outpost internal name, so I just added some additional notes on it.  It has a direct impact on my mod, so it was something I had to take a look at anyhow.  :)

This is the kind of stuff that makes dissecting their XML so frustrating and time-consuming.