Difference between revisions of ".world file - M2TW"
m (Removed category "Battlemap Modification - M2TW"; Quick-adding category "Battle Map Modification - M2TW" (using HotCat)) |
(→File Structure: link to editor) |
||
Line 13: | Line 13: | ||
==File Structure== | ==File Structure== | ||
− | The file layout (with names used in [[KnightErrant]]'s WorldEditor is as follows: | + | The file layout (with names used in [[KnightErrant]]'s [[World_File_Editing_Tools_-_M2TW#.World_File|WorldEditor]] is as follows: |
===Table 1=== | ===Table 1=== | ||
This table deals with the inter-relation of the bounding boxes and Complex relative locations and bounding spheres. | This table deals with the inter-relation of the bounding boxes and Complex relative locations and bounding spheres. |
Revision as of 04:35, 29 August 2009
Contents
Overview
The .world file forms the major part of the information controlling each settlement or ambient building in M2TW. The file contains details of the 3d structures making up each building, wall or other static object. It is very closely interrelated to the .worldcollision file.
The 3d game elements are grouped into:
- Complexes Each complex is numbered (0 to n)in Table 1 and can comprise one or more structures.
- Structures Each structure can comprise one or more objects, a structure can be viewed as a Milkshape ms3d file or in Mayavi2 by use of the WorldEditor user developed modding tool.
- Objects Each object can comprise one or more groups, where an object contains more than one group the first will be the undamaged state of the 3d element and the successive groups will be the damaged states. The most common object size is two groups - a pair of undamaged and damaged versions of an element.
- Groups In game groups are the same as Milkshape ms3d groups, they are organised into objects by the .world files.
Each of the above element stages will also have an invisible bounding sphere or box which effects where it can be viewed from in game (and probably other factors like collision and animation). The complex bounding spheres are located within an Octree structure of bounding boxes described by Argantonio here.
Co-ordinates in the world files generally appear in the order x,y,z. Relative to the game the x axis is east-west (using the convention that north is up), the y axis is the height, and the z axis is north-south.
File Structure
The file layout (with names used in KnightErrant's WorldEditor is as follows:
Table 1
This table deals with the inter-relation of the bounding boxes and Complex relative locations and bounding spheres.
The image below shows a screen shot of Table 1 from Stone_Fort_C which has been coloured in Excel to try to attempt to explain contents.
The numbers in red do not exist in the file - they are notional column and row numbers added to help explain things. The notional row numbers (0-32 in the example) although not stated in the file are actually used within the table to inter-relate components.
Column 19
Column 19 gives the hierarchy level for each of the row contents.
- 0 is the top level cube for the Octree structure - the dimensions of this should contain the entire 3d world for this settlement or building.
- 1 is the second level down, the up to eight smaller cubes that can fit within the largest cube
- 2 is the third level down, theoretically up to 64 smaller cube locations that can fit within the level 1 cubes - in this file the 3d Complexes are notionally located in the level 2 cubes - they can exceed the size of the cube and overlap other cubes in some cases.
Column 20
Column 20 gives the Complex number (with the Complexes numbered 0-23 in this example, if column 20 has the entry "-1" the row doesn't reference a Complex but is instead a bounding box which contains other rows (a level 0 or 1 box as described above). These rows that only contain other rows have been marked in light blue on the diagram.
Columns 7 to 18
These columns represent the eight possible positions (the columns containing only "2" are spacers) within one bounding box cube for another smaller bounding box cube to exist in the Octree system. If the number in these columns (shown in light green on the diagram) is not "-1" then it represents the notional row number of the bounding cube or Complex that is located at that position.
You can see that the top level bounding box cube in row 0 contains all eight level 1 bounding box cubes at rows 13, 26, 24, 4, 1, 7, 17 and 9.
If you look at bounding box row 24, you will see it includes complex rows 25, 32 and 29 (so not just those displayed between it and the next level 1 row!). Viewing column 20 for those rows will show that the actual 3d Complexes contained in that level 1 bounding box are 17, 20 and 23 (with complex numbering starting at 0).
Complexes and smaller boxes are distributed into the eight possible grid positions in the larger boxes following a set pattern with the first position having the lowest x,y,z co-ordinate values and the 8th position the highest x,y,z co-ordinate values. (If you really need to understand where to place new components in the system you need to draw a 3d diagram of the relative positions)
Columns 1 to 3
The co-ordinates in these columns are the x,y,z co-ordinates for the centre of the Octree box each row relates to. The co-ordinates in row 0 represent the nominal centre for this entire world and its largest Octree box. The length of side for the largest box in this example is 90.6779251099 x 2 the number seen above the table, so the dimensions of the box will be + and - 90.6779251099 from the centre locations in row 0 columns 1 to 3.
Columns 21 to 26
The co-ordinates in these columns are the minimum x,y,z co-ordinates (in columns 21 to 23) and maximum x,y,z co-ordinates (in columns 24 to 26) that define the diagonally opposite corners of the effective bounding box applied to whatever is in that row (either smaller bounding boxes or Complexes). These bounding box dimensions can and do overlap each other and do not necessarily fill the entire Octree box size they fit within.