.worldpkgdesc - M2TW
Which settlement, techtree or ambient turns up in the game for each specific use is controlled by a .worldpkgdesc file. Each .worldpkgdesc file calls one specific .world file.
The .world file's name and folder location that is specified inside the .worldpkgdesc file and other parameters can be amended with a hex editor or the IWTE tool.
A further explanation of how battlemap elements are loaded can be found on Battle Map Buildings - M2TW
Location and Name of .worldpkdesc files
packagedb.txt
The packagedb.txt file determines where the game will search for .worldpkgdesc files. Its normal contents are;
; List of directories to search for packages .\settlements
which means the game will search inside
- data/settlements
if you add a copy of the packagedb.txt to your mod-folder it will also search
- mods/my_mod/data/settlements
The .worldpkgdesc files in the specified folders will all be read when M2TW loads (prior to reaching the menu). The .worldpkgdesc files in the /packs folders will also be read meaning you cannot effectively delete any original .worldpkgdesc's.
Mod-folder versus M2TW data
Mod-folder versions of a named .worldpkgdesc do not 'overwrite' the data folder version
unlike other files, a mod-folder version of a .worldpkgdesc does not replace the data or /pack version in game, so naming your pkg the same as the original version and having;
- data/settlements/north_european/settlements/city/north_european_city_a.worldpkgdesc &
- my_mod/data/settlements/north_european/settlements/city/north_european_city_a.worldpkgdesc
does not mean your mod-folder version will take precedence. Unless the mod-folder version can be made more specific, i.e. by including a faction specific control, then the contents of both pkgs will be read and used.
.worldpkgdesc file name
The name of the .worldpkgdesc file is irrelevant
so "copy of north_european_city_a.worldpkgdesc" and "xxxxnorth_european_city_a.worldpkgdesc" will still be read and used, for this reason beware of leaving unwanted copies of the files in your /settlements folder.
Contrary to popular belief the naming of the files and folders in /settlements is completely irrelevant to which culture uses which building. You could call a set of files/folders "Freds_custom_thing.****" and have that settlement turn up for Northern_european factions' towns if you set the contents of the .worldpkgdesc correctly. Likewise, the .worldpkgdesc doesn't have to be in the same folder as the .world it calls. The reason for naming files/folders after cultures and city levels, and placing the relevant pkg in each is purely for ease of understanding what is meant to be turning up where!
Editing the .worldpkgdesc file
Tools
Hex Editor
The .worldpkgdesc files can be edited with a hex editor. A typical view of a file in the XV132 editor is shown on the right. Note that each string is preceded by an integer that gives the number of characters in the string, e.g. as shown the integer 17 for the string 'northern_european'. Editing the file with a hex editor is more difficult than using IWTE, but a hex editor can also be useful to quickly view the file contents.
IWTE
A typical view of a .worldpkgdesc open for editing in IWTE is shown on the right. If the 'OK' button is clicked IWTE saves a new version of the file with _WD added to the end. This file will be functional - see note about file naming above - if you no longer need the original file you must delete it.
Contents
Not all of the possible content types are included in each .worldpkgdesc. They can be added in if required, doing that via hex-editor is slightly complicated by needing to also add an integer for the count of the types used. IWTE will do this automatically for you, and by default displays all the possible types with 'unused' for the unused ones.
Name:
This is used to select a settlement or individual building or ambient in the battle editor.
Pkg Group:
Options;
- settlement - used for settlements including castles and forts
- ambient - used for ambients such as monasteries, farms and mills
- ambientmisc - used for some smaller ambients such as ruined walls - not known if there is a functional difference to 'ambient'
- rivercrossing - for bridge and ford models to be used as river crossings
- techtree - used for the buildings that fill techtree slots within settlements, e.g. barracks, churches and 'slot-fillers'
Pkg Path:
This is the path to the .world file the pkg will call, e.g.
- settlements/South_European/Castles/Fortress/south_european_fortress_A.world
note this starts relative to data/ level the name of the mod-folder and data/ are not included
Category:
For techtrees only. The categories used in the vanilla settlements are;
- generic
- market
- smithy
- church
- guild
- tavern
- university
- cultural_building_small
- cultural_building_large
However, you can use any category name you want, to get the techtree building to appear this must match the name of the techtree slot in the settlement.
Size:
For techtrees only. The sizes used in vanilla settlements are;
- 32x32
- 64x32
- 64x64
- 128x64
You can add different sizes but to get the techtree building to appear this should match the name of the techtree slot in the settlement.
Theoretically, if you change your techtree slots and packages to say 62x62, then that should stop the vanilla 64x64 building models appearing, unfortunately however, if you don't have anything that can fill those slots for a particular settlement the game can be 'overenthusiastic' in its interpretation and still put the 64x64's in!
Type:
Common name | EDB core building | descr_walls.txt level | pkg 'type' required |
---|---|---|---|
Village | none | none | village |
Town | wooden_pallisade | level 0 | small_town |
Large Town | wooden_wall | level 1 | large_town |
City | stone_wall | level 2 | city |
Large City | large_stone_wall | level 3 | large_city |
Huge City | huge_stone_wall | level 4 | huge_city |
Motte And Bailey | motte_and_bailey | level 0 | wooden_castle |
Wooden Castle | wooden_castle | level 1 | stone_keep |
Castle | castle | level 3 | castle |
Fortress | fortress | level 3 | large_castle |
Citadel | citadel | level 3 | fortress |
Fort | n/a |
Please note that the 'type' name and the wall level used for the settlements are hard coded. The wall level used is included here for info only as it determines which ladder/tower size attacking armies use and may influence your choice of model to use for settlements.
For techtrees the 'type' name required is the internal name of the building from export_descr_buildings.txt in the example shown in the picture that would be c_cannon_maker
Variant:
Culture:
This needs to be the internal name of the culture you want to use the settlement etc, e.g. northern_european, mesoamerican. From vanilla cultures the following culture names work as expected:
- northern_european
- southern_european
- middle_eastern
- aztec
- mesoamerican
The 'greek' culture and 'eastern_european' do not work if used in the culture slot, they have a hard coded default as follows;
- greek uses southern_european pkg results
- eastern_european uses northern_european pkg results
If you have added a new named culture, or changed the internal name of an existing one, the new culture name can be used here.
Environment:
Unkown use
Faction:
This needs to be the internal name of the faction you want to use the settlement etc.
Use of this function allows one faction in a culture to use different buildings from the other factions in that culture.
For most cases the culture entry on the pkg should match the culture of the faction as specified in descr_sm_factions.txt, however because of the hard coded default behaviour of the greek and eastern_european cultures a faction belonging to the greek culture needs southern_european listed as its culture, and a faction belonging to the eastern_european culture needs northern_european listed as its culture.
If you want a faction to reliably use a specific settlement in custom battle you will need to give every faction in its culture group a faction specific .worldpkgdesc for that settlement level - if you do not cover every faction you will get a random selection of either the faction specific settlement or the main culture's settlement appearing.
Fortificationlevel:
Intended to alter the fortification level, e.g. use of arrow versus canon towers. Doesn't seem to work.