Battle Map Buildings - M2TW
Overview
Battle map settlements and ambient buildings in M2TW are controlled by the files in the data/settlements folder. Each settlement or ambient building is known as a 'world', more than one 'world' can appear on the same battle map.
As yet only limited alterations to the settlement and buildings can be made. A variety of editors have been released by KnightErrant which make elements of the files viewable and modifiable, but to date there is a limitation in that the numbers of elements in each file can not easily be varied.
Discussion and research on this issue has largely taken place in the World Modified thread. Most of the research findings so far have been discoveries made by Argantonio.
How Settlements are Selected
Which settlement 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.
The .worldpkgdesc files can be located anywhere inside;
- data/settlements or
- mods/my_mod/data/settlements
they will all be read when M2TW loads (prior to reaching the menu).
NOTE: the game reads ALL the .worldpkgdesc's inside the data/settlements folders, so beware of leaving copies of old ones lying around in there that you don't intend to be read!
The .worldpkgdesc options that can be used in M2TW (upgraded to the latest patches) now include, culture type, environment and faction, so each different faction could technically use different settlements instead of setting settlements purely at culture level.
World Components
When a battle map which is to have a settlement or ambient building is loaded in game, the game engine first selects the most relevant .worldpkgdesc file from all of those that it loaded at start-up.
The 'name_here.world' file specified is then loaded, and the file paths inside that name_here.world file are followed to load other components and textures. The log file on full trace will show which of these files are being called (and the alternative places the game can look for variants).
The conventional layout of the files is that each 'world' has it's own folder in data/settlements, the vanilla game organises the world folders inside folders named roughly after the various cultures. NOTE: putting a world folder inside say 'North_European' does not automatically make it appear for that culture, it's solely the content of the .worldpkgdesc that determines which file is used (which explains why it doesn't matter that the culture names are misspelt in the vanilla folder names)
Typically each 'world' folder contains the following:
- name_here.world
- name_here.worldcollision
- name_here.worldpathfinding
- name_here.worldterrain
- name_here.animinstances
- name_here.worldpkgdesc
and a /maps sub-folder.
The only two files that actually have to exist in the same folder and have the same name prefix are .world and .worldcollision, because the path between them is not separately specified anywhere. (It's probably easiest to keep to the convention for the other files as well.)
Each .world file contains the names and paths to the; .worldpathfinding, .worldterrain, .animinstances files and the textures, masks and effects used in that world. These paths can be altered with a hexeditor or using the write and load textfile functions of KnightErrant's or Wilddog's IWTE world editor programmes. (If you copy an existing .world file to a new location without editing it, it will still be looking up all the files except .worldcollision in the old locations)
The .worldterrain file contains the paths to the masks and tgas that effect the representation of the ground plane, eg. for farms, paths and mud. The paths and texture names can be changed with the IWTE tool.