Page 1 of 3 123 LastLast
Results 1 to 20 of 54

Thread: World Collision Entry alterations

  1. #1

    Default World Collision Entry alterations

    EDIT: 9 Jan '10 : Tutorial amended to include use of the Integrated World / Terrain Editor released by wilddog. The IWTE tool incorporates most functionality from KnightErrant's WCEditor v1.2, which he kindly allowed to be used, and also allows collision entries to be automatically generated from individual .world objects.

    WCEditor v1.2 functions not included in new editor are;
    A). the ability to view collision entries in Mayavi (because we haven't managed to get Mayavi to pack to .exe file) - you may wish to load collision files in WCEditor v1.2 to use viewer function if searching for entries to re-use
    B). the ability to write and load ms3d files direct to the collision file (instead of loading derived file from .world into collision entry) - If you want to ammend the shape of a collision entry that you know is used for multiple objects you need to use WCEditor v1.2a as before to do that.

    Tutorial only covers the .worldcollision file part of battlemap buildings, this provides the invisible element of the information, that allows game to tell when building has been hit, and stops camera going through buildings etc.... Some preliminary information on the collision file is written up here: https://wiki.twcenter.net/index.php?...on_file_-_M2TW most of the information contained in that comes from the work of Argantonio, KnightErrant and friends in the World Modified thread.

    To usefully change the .worldcollision file you need to have changed or added an object in the .world file (by using the WorldEditor or IWTE tool to change an .ms3d structure file) and you need to know the object number for the item you changed.... that can be found by looking up the complex/structure/group number from the .ms3d file in the cheatsheet produced by the v0_9 WorldEditor, or by reference to the gameobjects tab in the IWTE tool.

    Adding a collision entry has now been automated to an extent, but you're still likely to need to understand some of the background information to this.

    Index:
    Overview
    Using the WCEditor 1_2
    ---Changing an Existing Collision Entry with WCEditor
    ---Removing a Collision Object with WCEditor
    ---Collision Volume Location and Orientation with WCEditor
    Adding a New Collision Entry
    Bounding Boxes and Spheres

    ****************************************************
    Overview
    The world collision files control the invisible bits of the settlements and battlemap buildings. If an object e.g. a part of a wall or a roof, has a collision volume entry then missiles will hit the object instead of passing through it, damage can also be done to the object if it has damaged states it can change to. A building or object needs to have a collision volume in the right place for it to be recognised as a building or tower when you hover your cursor over its position in game. The position of the collision volume also determines where the objects animation (if any) appears, see experiment on: https://wiki.twcenter.net/index.php?...es_file_-_M2TW

    The .worldcollision file is made up of five different types of table:
    Table One defines a structure of bounding boxes, some lines define only bounding boxes that contain a series of smaller boxes. The lines containing the lowest level boxes 'contain' one of the lines in table two.

    Table Two assigns each object from the .world file into one of the bounding box lines in table one.

    Table Three lists each object from the .world file in turn, and specifies which 'Central Entry' collision volume they use, and give it's relative position, rotation, and individual bounding sphere coordinates and radius. Objects that don't use a collision volume have -1 as the Central Entry volume number.

    Central Entries these tables give the information for each individual collision entry volume. They may be made up of multiple groups (in the same way the .world objects can be made up from multiple groups). If a .world object has two groups representing an undamaged and a damaged state then the Central Entry it uses should also have two corresponding groups.
    You'll find there are less Central Entry tables than objects in the corresponding .world file, that is because CA's system re-uses the same collision volume for multiple similar objects in different locations. I’ll describe this re-use of the same collision volume as a different ‘instance’ of the same volume.

    Last/Final Table this simply lists all the bounding sphere dimensions for each object in the .world, there's one row per object. Objects that don't use a collision volume have four +0.0000 entries in their row.

    ****************************************************
    Starting to Use the WCEditor
    To use the WCEditor you need to have a specific type of python installation on your computer see
    https://wiki.twcenter.net/index.php?...n_Installation
    for details. You should also ideally have the mayavi2 element working so you can preview existing volumes.

    EDIT: The WCEditor is still has useful functions not yet included in IWTE but as they're for more advanced use (and you need python installation) I've spoilered this bit.
    Spoiler Alert, click show to read: 

    I'd recommend making a separate folder to work on the files, place both the WCEditor_v1_2a.py and WClib_v1_2.py files in that folder together with a copy of the .worldcollision file you want to work on.

    You launch the editor by double clicking or 'opening' with python, the WCEditor_v1_2.py file. A black dos box will come up first and then the menu interface.

    click the "read binary .worldcollision file" button to load a file. While you're doing that it's worth getting in the habit of moving the dos box so you can view the contents, if you hit an error opening or saving a file that's where the information will show up....

    Once you've got a file loaded if you go to the Central Entries section and open one of the Entry's and one of it's Groups, if you double click on the 'Large Table' entry it will generate a mayavi2 view of the collision volume.

    The volume pictured is the damaged version of a small part of roof, it's likely that this volume is in use for multiple objects. If you inspect other collision volumes you’ll find most of them are smaller items than this – some are just squares made up of two triangle representing a 2m x 2m approx piece of wall in the game, some of the settlement buildings can be made up of 100’s of different small objects each with their own instance of a collision entry.

    ****************************************************
    Changing an Existing Collision Entry
    To try to pick on a relatively easy example which will have an obvious noticeable effect in the game – try altering the collision volume for a simple type of tower. (one which doesn’t have a damage transition animation – or you’ll get some odd effects when it tries to apply the animation)

    Central Entry 16 – group0 in Stone Fort C is the undamaged entry for the top of a small square tower – for the basic arrow slot version (there’s two upgrades to these towers for the higher fortification levels and the upgrades use different collision entries!)

    Select the large table for that group, and view the mayavi diagram to make sure it’s the right one, then click the ‘save scratch file’ option. The resulting ms3d file will be saved as “WCeditorscratchfile.ms3d”.

    Open that file with milkshape and make some obvious alterations.


    Here I’ve raised the top section of the tower 8m in milkshape, and duplicated the square bottom sections to fill in the gap that would be left below – I’ve then regrouped everything into one group (collision volumes need to be only one group). Inspect the ‘model statistics’ and note the number of triangles now in the model. Also note that the ms3d model for the collision volume is positioned relative to the 0,0,0 axis and not located at x=-100, y=-60 or where-ever the .world object appears in the game. This is due to the way CA re-use the same volume for different objects, they set the collision volume at 0,0,0 and then move each different instance of it to match up with the object location by using the rotation and co-ordinate positions for each object in Table Three.

    Save the revised ms3d using the same “WCeditorscratchfile.ms3d” name. With the relevent large table entry selected again, click the ‘load scratch file’ option – the mayavi view should now look like your revised shape (don’t worry if it looks mangled initially) Click ‘save changes to memory’, if your model looked mangled initially double click the large table entry again and you should find the view has sorted itself out… If you changed the number of triangles in the model you should also change the small table entry, though there seems to be some latitude you can get away with on that – currently changing the small table rows of a multi row small table needs to be done via text rep, as we don't currently understand the set up of multi-row small tables I'd recommend using simple single row small tables for anything new you're adding....

    To make it more obvious where collision volume was I also scaled it up x2. Here’s result:

    unfortunately it’s quite hard to screen shot but if you hover cursor over area near tower it now shows as being ‘tower’ and when a missile strikes it strikes the enlarged tower area.

    ****************************************************
    Removing a Collision Object
    If you've hidden an existing object and want to get rid of its collision effects (so that missiles don't collide with a now invisible object!) You can achieve that simply by changing the Table Entry it uses in Table Three of the .worldcollision file to -1 (eg so it doesn't use a collision entry)

    You need to know the object number of the thing you've changed. To find that load the .world file in the _09 version of the WorldEditor. View the list near the bottom of the file_name_nomodeldata.txt file that is automatically generated in a sub-folder of the folder your .world file is in. You'll see list like:
    Code:
    =============
    Complex 17
    =============
    Complex  17,   Structure:   1,   Group:    1 Independent.  Object no. 518
    Complex  17,   Structure:   1,   Group:    2 Independent.  Object no. 519
    
    Complex  17,   Structure:   1,   Group:    3 First  of a pair.  Object no. 520
    Complex  17,   Structure:   1,   Group:    4 Second of a pair.
    
    Complex  17,   Structure:   1,   Group:    5 Independent.  Object no. 521
    
    Complex  17,   Structure:   2,   Group:    1 First  of a pair.  Object no. 522
    Complex  17,   Structure:   2,   Group:    2 Second of a pair.
    
    
    Complex  17,   Structure:   2,   Group:    3 First  of a pair.  Object no. 523
    Complex  17,   Structure:   2,   Group:    4 Second of a pair.
    
    
    Complex  17,   Structure:   1,   Group:    6 First  of a pair.  Object no. 524
    Complex  17,   Structure:   1,   Group:    7 Second of a pair.
    The complex structure and group numbering ties up with the milkshape files the editor produces so if you've changed Complex 17, Structure 2 Groups 1 & 2, you'll see they make up Object no 522 in this example.

    To disable that objects collision entry load the equivalent .worldcollision file in WCEditor_v1_2, in the main tab expand +Table Three, and double click on the entry for object 522, you'll get screen like:

    to disable that object from having a collision entry just change whatever it says in first box for 'Entry Used'
    to -1
    Press 'Save' on that screen then go back to 'Main' tab and select 'Write Binary .worldcollision File'
    to get a revised file.
    ****************************************************
    Collision Volume Location and Orientation
    As already stated CA frequently use one collision volume (eg. one Central Entry section) for a variety of similar objects, eg; objects that are the same shape but appear in different locations and in different orientations. Thus they normally have the model for the collision volume centred at 0,0,0 on the x,y,z axis when you view an example in milkshape.

    As an example the complex six group collision object for a piece of wall that can be demolished is in Central Entry number 65 in stone_fort_C's collision file, the three breakable wall objects 153, 257 and 626 from stone_fort_C's .world file all use that same Central Entry no 65. Their table three entries are:

    Code:
      65  153   +0.0000003139   +0.0000000000   -0.9999999404  +52.5616798401      +0.0000003139   +0.0000000000   +1.0000000000  -27.3374595642 
                +0.0000000000   +1.0000000000   +0.0000000000  +12.6244945526      +0.0000000000   +1.0000000000   +0.0000000000  -12.6244945526 
                +0.9999999404   +0.0000000000   +0.0000003139  +27.3374404907      -1.0000000000   +0.0000000000   +0.0000003139  +52.5616760254 
                +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000      +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000     +52.7671394348  +13.0917243958  +26.9950160980  +13.6092519760 
    
      65  257   +1.0000000000   +0.0000000000   +0.0000000000  -33.9383888245      +1.0000000000   +0.0000000000   +0.0000000000  +33.9383888245 
                +0.0000000000   +1.0000000000   +0.0000000000   +0.5697202682      +0.0000000000   +1.0000000000   +0.0000000000   -0.5697202682 
                +0.0000000000   +0.0000000000   +1.0000000000  -35.1630630493      +0.0000000000   +0.0000000000   +1.0000000000  +35.1630630493 
                +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000      +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000     -34.2808113098   +1.0369502306  -35.3685226440  +13.6092519760 
    
    
      65  626   -0.0000000437   +0.0000000000   +1.0000000000  -60.4378356934      -0.0000000437   +0.0000000000   -1.0000000000   -4.6633787155 
                +0.0000000000   +1.0000000000   +0.0000000000   +8.5682640076      +0.0000000000   +1.0000000000   +0.0000000000   -8.5682640076 
                -1.0000000000   +0.0000000000   -0.0000000437   -4.6633758545      +1.0000000000   +0.0000000000   -0.0000000437  +60.4378356934 
                +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000      +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000     -60.6432952881   +9.0354938507   -4.3209514618  +13.6092519760
    The version of the collision volume used for object 257 is in the same orientation as the model produced by the coordinates in Central Entry 65 the others are turned 90 degrees and 270 degrees approximately, the way the orientation stuff works seems to be related to this sort of system....
    http://www.euclideanspace.com/maths/...ples/index.htm
    a better explanation but not in English can be found here
    http://spanusoft.altervista.org/Pipe..._rotazione.htm
    that was used by johnwhile to make very handy excel sheet to calculate required values see:
    http://www.twcenter.net/forums/showt...07#post6504307


    For final collision object position with same orientation as the collision model you need a table three format like:

    +1.0000000000 +0.0000000000 +0.0000000000 (difference x value)
    +0.0000000000 +1.0000000000 +0.0000000000 (difference y value )
    +0.0000000000 +0.0000000000 +1.0000000000 (difference z value )
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000
    for the first section and:
    +1.0000000000 +0.0000000000 +0.0000000000 -(difference x value)
    +0.0000000000 +1.0000000000 +0.0000000000 -(difference y value )
    +0.0000000000 +0.0000000000 +1.0000000000 -(difference z value )
    +0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000
    for the second part - the 'difference' part means the difference between the coordinate position of the centre of the model used for the collision entry and the coordinate position of the centre of where you actually want it to turn up in the game (eg at the centre of the object that's using it).

    if you depart from CA's method and don't re-use Central Entry's for multiple objects, you can with the WCEditor just load your object model (at its actual desired location and not centred on 0,0,0) that then means you don't need to give relocation figures in table three.... so the entry for a collision volume to appear at same place as it's .ms3d coordinates looks like:
    Code:
    (entry)  (object) +1.0000000000   +0.0000000000   +0.0000000000  +0.0000000000      +1.0000000000   +0.0000000000   +0.0000000000  +0.0000000000
                    +0.0000000000   +1.0000000000   +0.0000000000  +0.0000000000      +0.0000000000   +1.0000000000   +0.0000000000  +0.0000000000 
                    +0.0000000000   +0.0000000000   +1.0000000000   +0.0000000000      +0.0000000000   +0.0000000000   +1.0000000000   +0.0000000000
                    +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000      +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000     (x of bounding sphere centre) (y of sphere) (z of sphere) (radius)
    that limits the complexity involved in getting things in the right place, but would end up making larger files if you need new collision entries for a lot of objects that could have shared.

    The IWTE tool automatically moves your object co-ordinates to centre on 0,0,0 and calculates the displacement, but it doesn't handle rotations.

  2. #2

    Default Re: World Collision Entry alterations

    Adding a New Collision Entry
    The IWTE tool has a button on the gameobjects tab which says "Add Object Collision"
    (I'm very tempted to leave tutorial as that as its so refreshingly simple....)

    Anyway.... to use the IWTE tool just copy and paste the IWTE_1v2_beta.exe somewhere, near / in same folder you're working in is easiest so you don't have to navigate far to files. Double click the .exe to launch, you don't need python installation or any thing else to make this run... When program starts you get interface screen and .dos window launched - don't close the .dos window it a). contains useful info you need to keep an eye on, and b). will shut the program

    Click 'Read binary world file' from any of the last three tabs to load the .world file you've been working on. If you don't already know the object numbers for the elements you've added you should be able to work them out from the 'gameobjects' tab.

    The screen example shows that the first object in complex 3 - structure 2 (in IWTE numbering) is object number 89. The 1 in the third column shows it only contains one group. To add a new collision entry for this object simply click the 'Add Object Collision' button while its line is selected. You'll then be asked to load the .worldcollision file that is to be amended, and asked for a new file name for the revised file. It should then write file - keep an eye on the .dos window to see when its finished.

    If you want to add a collision entry for another object you'll need to remember to load the revised file when it asks you for the file to be amended next time! You'll end up with a lot of intermediate files if you add collisions for a lot of objects.... once you confirm that the last one is functional you can safely delete the intermediate files.

    Note: that the IWTE editor doesn't currently delete un-used collision entries from .worldcollision, so I'd recommend only adding collisions once you know you've got your structure fairly well finalised, otherwise repeatedly adding new entries will expand file size a lot.... ! - a clean up feature might get added later, but WD isn't promising anything...

    *******************************************************************************

    For the technically minded and 'world modified' thread followers, what the IWTE tool does is to extract the vertex information from the objects' groups' information in the .world file (that's why you need to have loaded correct .world file first) and then moves all the vertex co-ordinates to produce an identical set of groups centred on 0,0,0 origin, and writes them to a new 'central entry' section. (All entries added by the tool use the simplified one line small table entry, we've not yet found any problem doing this, please report if you notice any odd effects.)

    The tool then uses the amount it moved the co-ordinates to populate the table three entry and re-position the collision model for the object back to its in game position. The table three entry follows the
    Code:
     1  0  0  x    1  0  0  -x
     0  1  0  y    0  1  0  -y
     0  0  1  z    0  0  1  -z
     0  0  0  1    0  0  0   1
    pattern which effectively means keep model in same orientation and move it from origin by x, y & z
    (y is height as in milkshape, x is -x compared to milkshape).

    Although the IWTE editor does not support the re-use of existing collision entries for other objects you can still opt to do this manually via the 'Collision Binary to Text Conversion' found on the 'World' tab of the IWTE editor - and conversion back on same screen.

    If you've added say a wall shaped object and you know that another object you've added is same shape, just relocated, you can re-use the collision model for the second & subsequent objects by changing the displacement / rotation for its table 3 matrix, and make it use the same central entry as was added for the first object. To find matrix values for rotated objects use johnwhile's excel sheet, attached here: http://www.twcenter.net/forums/showt...07#post6504307

    CA set up most of their objects to share collision entries, we don't know yet if there would be any performance problems in deciding to have unique collision entries for each object (it would obviously enlarge the .worldcollision file sizes substantially but other side effects are unknown)


    EDIT: Spoilered previous content as it contains some tech information relevant to tool development but not now required for normal use.
    Spoiler Alert, click show to read: 

    Adding a New Collision Entry manually with WCEditor and Text Editing
    If you’ve changed the shape of an object and can’t change the shape of its existing collision volume because that volume is also in use by other objects you need to add a new Central Entry section.

    You can use the textrep facility of the WCEditor to copy and paste in a new central entry section.
    Load the binary .worldcollision file in the editor and click the ‘write ASCII textrep.txt file’ button.
    Open the .txt file it produces with Notepad or similar text editor and search for ‘final table’.

    You're going to need to insert a new section between the end of the last Central Entry table and the Final Table
    +44.6149291992 -18.9582290649 -35.0506820679 +48.6149902344 -15.0202951431 -35.0502319336 +44.6149291992 -14.9596815109 -35.0505447388
    +48.6149902344 -15.0202951431 -35.0502319336 +44.6149291992 -18.9582290649 -35.0506820679 +48.6149902344 -19.0202941895 -35.0502319336
    15 0 303 16 0 302
    >insert here<
    # ----------------------------------------------
    # Final Table:
    # ----------------------------------------------
    0 627 0
    +38.2565002441 -0.1241939068 -31.8343200684 +17.9504051208 # Object no.0
    +48.0062980652 -0.2908888161 -18.2337913513 +5.1483392715 # Object no.1
    There's no point trying to put the right co-ordinates for our new model shape in at this stage so we just need to insert the simplest possible table that will allow us to change the model via the editor later.

    here's an example of a two group entry that would be used for a .world object that also had two groups (eg a damaged and undamaged state)
    Code:
    # ----------------------------------------------------------
    #            Central Entry 1
    # ----------------------------------------------------------
       6   -0.0476392880   +0.3665484488   -0.1113462672   +6.0415430069    2
    # ----------------------------------------------------------
    #            Central Entry 1, Group 0
    # ----------------------------------------------------------
    16  0    7
       1
      +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000  1 10 
      10
      -1.9999600649   -2.4996671677   -4.2500686646   -2.0000345707   +0.6597508788   +0.2500207722   +1.9999352694   +0.6597512364   +0.2500215471 
      +1.9999352694   +0.6597512364   +0.2500215471   +2.0000391006   -2.4996674061   -4.2500691414   -1.9999600649   -2.4996671677   -4.2500686646 
      +2.0000391006   -2.4996674061   -4.2500691414   +2.0000391006   -2.9996666908   -4.2500691414   -1.9999600649   -2.9996664524   -4.2500686646 
      -1.9999600649   -2.9996664524   -4.2500686646   -1.9999600649   -2.4996671677   -4.2500686646   +2.0000391006   -2.4996674061   -4.2500691414 
      +2.0000391006   -2.9996666908   -4.2500691414   +2.0000329018   -2.9996666908   -3.7500686646   -1.9999600649   -2.9996666908   -3.7500679493 
      -1.9999600649   -2.9996666908   -3.7500679493   -1.9999600649   -2.9996664524   -4.2500686646   +2.0000391006   -2.9996666908   -4.2500691414 
      +2.0000097752   -3.9999992847   -3.7501151562   -1.9999600649   -3.9999992847   -3.7500679493   -1.9999600649   -2.9996666908   -3.7500679493 
      -1.9999600649   -2.9996666908   -3.7500679493   +2.0000329018   -2.9996666908   -3.7500686646   +2.0000097752   -3.9999992847   -3.7501151562 
      -2.0000345707   +0.6597508788   +0.2500207722   -2.0000391006   +3.9999992847   +4.2500691414   +1.9999306202   +3.9999992847   +4.2500691414 
      +1.9999306202   +3.9999992847   +4.2500691414   +1.9999352694   +0.6597512364   +0.2500215471   -2.0000345707   +0.6597508788   +0.2500207722 
    15  0       8    16  0       7
    # ----------------------------------------------------------
    #            Central Entry 1, Group 1
    # ----------------------------------------------------------
    16  0    9
       1
      +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000  1 10 
      10
      -1.9999600649   -2.4996671677   -4.2500686646   -2.0000345707   +0.6597508788   +0.2500207722   +1.9999352694   +0.6597512364   +0.2500215471 
      +1.9999352694   +0.6597512364   +0.2500215471   +2.0000391006   -2.4996674061   -4.2500691414   -1.9999600649   -2.4996671677   -4.2500686646 
      +2.0000391006   -2.4996674061   -4.2500691414   +2.0000391006   -2.9996666908   -4.2500691414   -1.9999600649   -2.9996664524   -4.2500686646 
      -1.9999600649   -2.9996664524   -4.2500686646   -1.9999600649   -2.4996671677   -4.2500686646   +2.0000391006   -2.4996674061   -4.2500691414 
      +2.0000391006   -2.9996666908   -4.2500691414   +2.0000329018   -2.9996666908   -3.7500686646   -1.9999600649   -2.9996666908   -3.7500679493 
      -1.9999600649   -2.9996666908   -3.7500679493   -1.9999600649   -2.9996664524   -4.2500686646   +2.0000391006   -2.9996666908   -4.2500691414 
      +2.0000097752   -3.9999992847   -3.7501151562   -1.9999600649   -3.9999992847   -3.7500679493   -1.9999600649   -2.9996666908   -3.7500679493 
      -1.9999600649   -2.9996666908   -3.7500679493   +2.0000329018   -2.9996666908   -3.7500686646   +2.0000097752   -3.9999992847   -3.7501151562 
      -2.0000345707   +0.6597508788   +0.2500207722   -2.0000391006   +3.9999992847   +4.2500691414   +1.9999306202   +3.9999992847   +4.2500691414 
      +1.9999306202   +3.9999992847   +4.2500691414   +1.9999352694   +0.6597512364   +0.2500215471   -2.0000345707   +0.6597508788   +0.2500207722 
    15  0      10    16  0       9
    to explain what's there here's an annotated version of the above
    # ----------------------------------------------------------
    # Central Entry 1
    # ----------------------------------------------------------
    6 -0.0476392880 +0.3665484488 -0.1113462672 +6.0415430069 (bounding sphere) 2 (this number tells you how many groups are coming)
    # ----------------------------------------------------------
    # Central Entry 1, Group 0
    # ----------------------------------------------------------
    16 0 7
    1 (number of rows following in small table)
    +0.0000000000 +0.0000000000 +0.0000000000 +0.0000000000 1 10 (total number of triangles in the model)
    10 (number of rows following in large table... the same as the total number of tri's)
    -1.9999600649 -2.4996671677 -4.2500686646 -2.0000345707 +0.6597508788 +0.2500207722 +1.9999352694 +0.6597512364 +0.2500215471
    +1.9999352694 +0.6597512364 +0.2500215471 +2.0000391006 -2.4996674061 -4.2500691414 -1.9999600649 -2.4996671677 -4.2500686646
    +2.0000391006 -2.4996674061 -4.2500691414 +2.0000391006 -2.9996666908 -4.2500691414 -1.9999600649 -2.9996664524 -4.2500686646
    -1.9999600649 -2.9996664524 -4.2500686646 -1.9999600649 -2.4996671677 -4.2500686646 +2.0000391006 -2.4996674061 -4.2500691414
    +2.0000391006 -2.9996666908 -4.2500691414 +2.0000329018 -2.9996666908 -3.7500686646 -1.9999600649 -2.9996666908 -3.7500679493
    -1.9999600649 -2.9996666908 -3.7500679493 -1.9999600649 -2.9996664524 -4.2500686646 +2.0000391006 -2.9996666908 -4.2500691414
    +2.0000097752 -3.9999992847 -3.7501151562 -1.9999600649 -3.9999992847 -3.7500679493 -1.9999600649 -2.9996666908 -3.7500679493
    -1.9999600649 -2.9996666908 -3.7500679493 +2.0000329018 -2.9996666908 -3.7500686646 +2.0000097752 -3.9999992847 -3.7501151562
    -2.0000345707 +0.6597508788 +0.2500207722 -2.0000391006 +3.9999992847 +4.2500691414 +1.9999306202 +3.9999992847 +4.2500691414
    +1.9999306202 +3.9999992847 +4.2500691414 +1.9999352694 +0.6597512364 +0.2500215471 -2.0000345707 +0.6597508788 +0.2500207722
    15 0 8 16 0 7
    # ----------------------------------------------------------
    # Central Entry 1, Group 1
    # ----------------------------------------------------------
    16 0 9
    1 (number of rows following in small table)
    +0.0000000000 +0.0000000000 +0.0000000000 +0.0000000000 1 10 (total number of triangles)
    10 (number of rows following in large table... the same as the total number of tri's)
    -1.9999600649 -2.4996671677 -4.2500686646 -2.0000345707 +0.6597508788 +0.2500207722 +1.9999352694 +0.6597512364 +0.2500215471
    +1.9999352694 +0.6597512364 +0.2500215471 +2.0000391006 -2.4996674061 -4.2500691414 -1.9999600649 -2.4996671677 -4.2500686646
    +2.0000391006 -2.4996674061 -4.2500691414 +2.0000391006 -2.9996666908 -4.2500691414 -1.9999600649 -2.9996664524 -4.2500686646
    -1.9999600649 -2.9996664524 -4.2500686646 -1.9999600649 -2.4996671677 -4.2500686646 +2.0000391006 -2.4996674061 -4.2500691414
    +2.0000391006 -2.9996666908 -4.2500691414 +2.0000329018 -2.9996666908 -3.7500686646 -1.9999600649 -2.9996666908 -3.7500679493
    -1.9999600649 -2.9996666908 -3.7500679493 -1.9999600649 -2.9996664524 -4.2500686646 +2.0000391006 -2.9996666908 -4.2500691414
    +2.0000097752 -3.9999992847 -3.7501151562 -1.9999600649 -3.9999992847 -3.7500679493 -1.9999600649 -2.9996666908 -3.7500679493
    -1.9999600649 -2.9996666908 -3.7500679493 +2.0000329018 -2.9996666908 -3.7500686646 +2.0000097752 -3.9999992847 -3.7501151562
    -2.0000345707 +0.6597508788 +0.2500207722 -2.0000391006 +3.9999992847 +4.2500691414 +1.9999306202 +3.9999992847 +4.2500691414
    +1.9999306202 +3.9999992847 +4.2500691414 +1.9999352694 +0.6597512364 +0.2500215471 -2.0000345707 +0.6597508788 +0.2500207722
    15 0 10 16 0 9
    the numbers shown in Cyan are part of a header and trailer and count system that runs through the Central Entry's of the .world collision file. The count has to be incremented correctly if you add or remove any entry's from the file, hence the suggestion that you only try adding a new volume at the end of the list!

    to make something even shorter we can reduce the number of triangles to 1 to produce a generic format to paste in:
    this is for a one group object (no damaged version)
    Code:
    # ----------------------------------------------------------
    #            Central Entry n+1
    # ----------------------------------------------------------
      c+1   +0.0000000000   +0.0000000000  +0.0000000000   +5.000000000   1
    # ----------------------------------------------------------
    #            Central Entry n+1, Group 0
    # ----------------------------------------------------------
    16  0   c+2
       1
      +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000  1 1 
      1
      -1.9877917767   +2.4482860565   +2.5161402225   -2.0122828484   +2.5644335747   -4.2282190323   -1.9878177643   +0.5559591055   +0.2500215471 
    15  0      c+3    16  0      c+2
    you need to change the values of c+1 etc to use the value of c that represents the highest number of the count from the existing last table, so if I paste that into my example file it would be c = 303, and n (the last Central Entry number was 68)
    so:
    Code:
     +44.6149291992  -18.9582290649  -35.0506820679  +48.6149902344  -15.0202951431  -35.0502319336  +44.6149291992  -14.9596815109  -35.0505447388 
     +48.6149902344  -15.0202951431  -35.0502319336  +44.6149291992  -18.9582290649  -35.0506820679  +48.6149902344  -19.0202941895  -35.0502319336 
    15  0     303    16  0     302
    # ----------------------------------------------------------
    #            Central Entry 69
    # ----------------------------------------------------------
      304   +0.0000000000   +0.0000000000  +0.0000000000   +5.000000000   1
    # ----------------------------------------------------------
    #            Central Entry 69, Group 0
    # ----------------------------------------------------------
    16  0   305
       1
      +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000  1 1 
      1
      -1.9877917767   +2.4482860565   +2.5161402225   -2.0122828484   +2.5644335747   -4.2282190323   -1.9878177643   +0.5559591055   +0.2500215471 
    15  0     306    16  0      305
    # ----------------------------------------------
    #                   Final Table:                
    # ----------------------------------------------
      0   627     0
     +38.2565002441   -0.1241939068  -31.8343200684  +17.9504051208  # Object no.0
     +48.0062980652   -0.2908888161  -18.2337913513   +5.1483392715  # Object no.1
     +54.0615615845   -0.4439726472  -18.6633853912   +2.8284285069  # Object no.2
     +58.0615653992   -0.4439713061  -16.6633834839   +3.4641077518  # Object no.3
     +52.0063095093   +3.7091097832  -18.2338085175   +5.1483345032  # Object no.4
    if I wanted to add another table after that I'd do the same thing but the c value would now be 306

    if I want to add a two group entry I'd need the format:
    Code:
    # ----------------------------------------------------------
    #            Central Entry n+1
    # ----------------------------------------------------------
      c+1   +0.0000000000   +0.0000000000  +0.0000000000   +5.000000000   2
    # ----------------------------------------------------------
    #            Central Entry n+1, Group 0
    # ----------------------------------------------------------
    16  0   c+2
       1
      +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000  1 1 
      1
      -1.9877917767   +2.4482860565   +2.5161402225   -2.0122828484   +2.5644335747   -4.2282190323   -1.9878177643   +0.5559591055   +0.2500215471 
    15  0      c+3    16  0      c+2
    # ----------------------------------------------------------
    #            Central Entry n+1, Group 1
    # ----------------------------------------------------------
    16  0   c+4
       1
      +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000  1 1 
      1
      -1.9877917767   +2.4482860565   +2.5161402225   -2.0122828484   +2.5644335747   -4.2282190323   -1.9878177643   +0.5559591055   +0.2500215471 
    15  0      c+5    16  0      c+4
    The part with the
    # Central Entry n+1, Group 0
    is actually just a comment, it's not read back when you reload the txt file, but you should probably keep to the format so you can keep track of how many tables you've ended up with! When you have finished adding the tables you require you need to update the number of Central Entries you have, the count of the number of Entries is at the start of the Central Entries section - it's the number 69 in this example:
    Code:
      65  626   -0.0000000437   +0.0000000000   +1.0000000000  -60.4378356934      -0.0000000437   +0.0000000000   -1.0000000000   -4.6633787155 
                +0.0000000000   +1.0000000000   +0.0000000000   +8.5682640076      +0.0000000000   +1.0000000000   +0.0000000000   -8.5682640076 
                -1.0000000000   +0.0000000000   -0.0000000437   -4.6633758545      +1.0000000000   +0.0000000000   -0.0000000437  +60.4378356934 
                +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000      +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000     -60.6432952881   +9.0354938507   -4.3209514618  +13.6092519760 
    
      0 69   1   2
    # ----------------------------------------------------------
    #            Central Entry 0
    # ----------------------------------------------------------
       1 0   +0.0249217097   +0.2118091136   +0.0432120040   +6.2719726563 0    2   0
    # ----------------------------------------------------------
    #            Central Entry 0, Group 0
    # ----------------------------------------------------------
    16  0  1  0       2      0  0
       1
      +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000  1 22 
     0  0       22     0  0
    so if I've added one new Central Entry I'd change it to 70
    0 70 1 2
    # ----------------------------------------------------------
    # Central Entry 0
    # ----------------------------------------------------------
    note the Central Entry numbering system starts at 0 so if your last table says 69 you've actually got 70 tables.... The number of groups in each central entry doesn't effect the overall count.

    Once you've added your tables you should save the .txt file, then using the WCEditor click the 'read ASCII textrep.txt file' button, and select your text file. If it loads correctly you can click the 'write binary .worldcollision file' button. It will write you a new .worldcollision file with 'modified' added to the title to stop you accidentally overwriting existing files. You need to change the name of the file back to the same as the existing file to try it out in the game.

    Once you've got your new file with more Entries working you can use the 'change an existing collision entry' process above to swap in the object shapes you actually want. Note that adding a new ms3d file via the load scratchfile button doesn't reset the number of triangles shown in the last row of the small table you need to do that manually. It's nice and simple to do for an entry that only has a one row small table. When you load the scratchfile look at the content of the black dos box eg:

    you'll see its counted the number of tri's in the new model for you (280 in that example) Type that number in as the last number (short 2) of the single row small table and save the changes... Note that the save process isn't working properly on multi row small tables, also unfortunately at the moment we don't understand the function of multi row small tables, but so far single row tables seem to be working OK even for complex shapes, so I'd recommend for now you stick to using single row small tables for any Central Entries you're changing.

    To make your .world object use the new entry table you need to change the objects table three entry. The first number in the objects table three entry is the number of the Central Entry table it uses:

    shows the line entry for object 87, the first box shows its currently using Central Entry 27, if I want it to use the Central Entry 69 that I just added, then I'd change the 27 to 69 and click 'save' note that, the save button only saves to memory, it doesn't make you a new file yet, to make a revised file when you've made all your changes you need to go back to the main menu tab and click the 'write binary....' button.

    The same process can be done using the textrep file in text that section looks like:
    Code:
     27   87   +0.0000003139   +0.0000000000   +1.0000000000  +28.0604228973      +0.0000003139   +0.0000000000   -1.0000000000   +1.3367607594 
                +0.0000000000   +1.0000000000   +0.0000000000   -4.4527444839      +0.0000000000   +1.0000000000   +0.0000000000   +4.4527444839 
                -1.0000000000   +0.0000000000   +0.0000003139   +1.3367695808      +1.0000000000   +0.0000000000   +0.0000003139  -28.0604228973 
                +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000      +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000     +28.4900169373   -4.2996602058   +1.3920252323   +5.1483392715
    I'd just need to change the 27 to 69 save the text file and reload and make a new binary from the editor that way.

  3. #3

    Default Re: World Collision Entry alterations

    Bounding Boxes and Spheres
    If you add a collision volume and you don't see any effect in game (unless you simply ended up with the collision volume at the wrong co-ordinates) its probably because the new/revised collision volume is outside one of the bounding boxes or spheres and therefore not being used. The bounding boxes and spheres control which bits of a structure the game 'renders' and save processing power by allowing the engine to ignore any coordinates outside the bounding areas.

    The bounding spheres and boxes in the .world file also control whether or not a collision volume works properly....

    EDIT: Wilddog's IWTE tool calculates and adds bounding spheres for objects that you 'add object collision' for, and includes those spheres in table 3, the Central Entry header, and the Last Table. It selects the useable bounding box in table 1 with the closest centre to the object, and if necessary adjusts the size of that box and it's parent boxes in table 1.

    you therefore shouldn't now need to know the rest of this, but I've left it incase you decide to fiddle with something manually / need to bug hunt / or for further tool development.

    Spoiler Alert, click show to read: 

    Collision File Bounding Boxes
    Both the .world file and the .worldcollision file have bounding boxes defined by the coordinates at the right hand side of their First Tables. The coordinates on the left hand side of the rows in the first tables represent the centre points of a cubic distribution structure. The top level line represents one large cube, 8 possible smaller cubes can fit inside that and a further 8 inside each of those 8.... luckily that structure really only deals with the relative positioning of complexes and groups and so can be left alone if you stick to the principal of keeping structures in same relative position e.g. if you want to change something at the back right hand side of a settlement, use a complex/collision file table one entry that already has a bounding box that's roughly in the right area.

    Table Two of the .worldcollision file controls which bounding box line in Table One is used by each object. Here's an example chunk of Table Two in textrep form
    7 65 66 67 68 81 82 86 14 # Row no.6
    9 73 74 75 76 77 78 79 80 87 15 # Row no.7
    7 89 90 91 92 93 94 622 16 # Row no.8
    8 95 104 108 110 111 112 113 114 19 # Row no.9
    The first number of each line shown in blue is the count of the number of objects to follow in the line (if you save a version where that doesn't tie up correctly you'll get a CTD in game)
    The numbers shown here in red are the object numbers as used by this file and the .world file.
    The number at the end of each row, shown in green, is the row number from Table One which gives the bounding box used for the objects in the row.
    The row no. shown after the # comment is just the count to show which row of table two you're looking at.

    If I was changing the shape/use of object 622 in the example I'd need to look up row number 16 in table one to see what it's existing bounding box dimensions were.

    Row 16 of table one turns out to be:
    Code:
      +1.8546447754   -2.9304504395   -5.5956459045     2     2     2    -1    -1     2    -1    -1     2     2    -1    -1     2    -1    -1     3     8 None     +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000   +0.0000000000 # Row no.16
    if you look at the 6 floats at the right hand side of that row you'll see that's a zero dimensioned box, so isn't any use if I actually want my new collision volume to show up!

    So we need to look in table one for a better existing bounding box for our object to use.

    Looking just at the right hand side of a chunk of table one
    -1 3 9 None +30.9674377441 -5.4479975700 +11.7588043213 +61.5257110596 +11.0201377869 +28.2681713104 # Row no.19
    -1 3 10 None +54.4836769104 +0.7276027203 +4.1330556870 +64.7803497314 +12.8574447632 +14.4297246933 # Row no.20
    35 2 -1 None -14.0837259293 -15.4651947021 +1.0399708748 +42.5445861816 +12.9415550232 +54.4293899536 # Row no.21
    -1 3 11 None +23.3416786194 -9.4479999542 +1.0399708748 +42.5445861816 +12.8910217285 +32.2681388855 # Row no.22
    -1 1 -1 None -15.1009025574 -1.7105903625 +2.1738610268 +66.3763885498 +41.7950286865 +79.5112991333 # Row no.23
    -1 2 -1 None +35.3425369263 -0.5175275803 +2.1738610268 +66.3763885498 +28.3893470764 +54.5407829285 # Row no.24
    -1 3 12 None +36.8981132507 -0.5175275803 +2.1738610268 +66.3763885498 +28.3893470764 +40.6042671204 # Row no.25
    -1 3 13 None +54.9108390808 +8.7273845673 +4.6652164459 +63.0336608887 +21.7708816528 +19.6086921692 # Row no.26
    -1 2 -1 None -15.1009025574 -0.3917217255 +46.1737594604 +42.7051734924 +41.7950286865 +79.5112991333 # Row no.27
    -1 3 14 None +8.7625598907 -0.3917217255 +51.9230575562 +42.7051734924 +37.7119522095 +79.5112991333 # Row no.28
    notice the numbers in pink before it says 'none' only the positive numbers represent a row with a usable bounding box - the ones with -1 are just a row for a bounding box that contains other smaller bounding boxes from lower level rows. The number shown in pink is the row number in table two that uses this bounding box. The column with the numbers shown in orange tells you what level of bounding box / cubic structure you're at. The rows that are actually used to contain table two object rows are at level 3 in this example, each of them is in turn contained within a level 2 row, and each level 2 row is contained in a level 1 row and each of them is in the first row which is the only level 0 row (our one large cube in the cubic structure).

    Let's assume that I think row 19 from table one in that example has the best fit of bounding box for my object 622's collision volume. The six floats at the end of that line are +30.9674377441 -5.4479975700 +11.7588043213 +61.5257110596 +11.0201377869 +28.2681713104
    that means the bounding box is defined by a rectangle drawn with minimum sides at
    x = +30.9674377441
    y = -5.4479975700
    z = +11.7588043213
    and maximums at
    x = +61.5257110596
    y = +11.0201377869
    z = +28.2681713104
    that's a straightforward box, so long as my .ms3d coordinates don't exceed any of those maximums or minimums it will work.

    I look up the number in the column before 'none' which is 9 in this case. That means row number 9 in Table Two, so I need to move my object into that row by making the following changes:

    7 65 66 67 68 81 82 86 14 # Row no.6
    9 73 74 75 76 77 78 79 80 87 15 # Row no.7
    76 89 90 91 92 93 94 622 16 # Row no.8
    89 95 104 108 110 111 112 113 114 622 19 # Row no.9
    i.e. move the 622 to row 9 and correct the first number in each effected row to reflect the new count of objects in each row.

    To continue the example, say the x and z co-ordinates from that table one bounding box were large enough but the maximum height at +11.0201377869 was too low as my new object and its collision volume go up to +17.5. I can edit the bounding box in that row, generally the figures don't seem to have to be too precise so long as they are larger rather than smaller so I'd say make the +11.0201377869, +18.50000000 instead (some of the funny very precise looking figures just look that way because of the way floats convert into hex not because they really have to be that precise). Now I need to check if the bigger bounding box that contains my # row no. 19 box is large enough for that height. To do that I need to find where the number 19 appears in the middle columns of another row in table one, it turns out to be easy to find as its actually in row 18 directly above:
    +58.7434921265 -14.3082199097 +28.5376625061 2 2 2 -1 -1 2 19 34 2 2 -1 -1 2 20 -1 2 -1 None +30.9674377441 -5.4479975700 +4.1330556870 +64.7803497314 +12.9078722000 +54.5407905579 # Row no.18
    the maximum height in that row is only +12.9078722000 so that needs changing too, and I then need to look up which bigger bounding box row contains row 18... again luckily its easy to spot as its the one above row 17 is:
    +35.9879531860 -37.0637588501 +51.2932014465 2 2 2 -1 -1 2 21 84 2 2 -1 -1 2 18 32 1 -1 None -14.0837259293 -15.4651947021 +1.0399708748 +64.7803497314 +12.9415550232 +72.1654968262 # Row no.17
    that's still not tall enough so the +12.9415550232 needs to change to my +18.50000000 and I need to check where row 17 is included, that was a level 1 row so it should be in the level 0 row, row no.0 at the start, sure enough it is:
    -9.5231199265 +8.4473199844 +5.7821202278 2 2 2 36 74 2 65 7 2 2 1 17 2 51 23 0 -1 0 -181.1501007080 -123.2893218994 -165.6569824219 +266.3764038086 +143.8012847900 +384.4580688477 # Row no.0
    and the max bounding box height for that is already +143.8012847900, so doesn't need changing

    Collision File Bounding Spheres
    There are three separate places where bounding spheres are defined for each use of a collision volume.

    Table Three
    The table three entry for object 620 in textrep form looks like this
    Code:
      35  620   -0.0000000437   +0.0000000000   -1.0000000000  +12.0623130798      -0.0000000437   +0.0000000000   +1.0000000000  -51.3361549377 
                +0.0000000000   +1.0000000000   +0.0000000000   +3.5809504986      +0.0000000000   +1.0000000000   +0.0000000000   -3.5809504986 
                +1.0000000000   +0.0000000000   -0.0000000437  +51.3361549377      -1.0000000000   +0.0000000000   -0.0000000437  +12.0623149872 
                +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000      +0.0000000000   +0.0000000000   +0.0000000000   +1.0000000000     +12.0623140335   +3.5809497833  +51.3361549377   +2.8279151917
    if you scroll to the right hand side you'll see the figures
    +12.0623140335 +3.5809497833 +51.3361549377 +2.8279151917
    that's a bounding sphere for the objects collision volume of

    co-ordinates of centre point =
    x=+12.0623140335
    y=+3.5809497833
    z=+51.3361549377
    radius= +2.8279151917

    viewed in the WCEditor they're the 4 floats at the bottom of the table three entry:

    they can either be changed in the textrep file or via the editor

    Central Entry
    The 'header' for each Central Entry table is a bounding sphere again in the format x,y,z,radius for the collision volume.

    This one relates to the co-ordinates of the model used for the collision volume, so if the volume is centred at 0,0,0 (and relocated to its in use position by table three) then the bounding sphere position will be centred aproximately on 0,0,0 with the radius just large enough to enclose the volume.

    Again you can change the dimension either via the textrep.txt file or the WCEditor screen (remembering to click to save!)

    Last/Final Table
    The last table is made up solely of a list of bounding spheres for each object, there is one line per object in object order.

    Again the sphere is defined by x,y,z coordinates of its centre and radius. Again you can change it either in textrep or via the WCEditor screen. The sphere used in this table should be the same size and coordinates as used for the object in it's table three sphere. Objects that don't use a collision volume (normally little things like torches or benches usually have 4 x 0.0000 values for their 'sphere'.


    World File Bounding Boxes and Spheres
    EDIT: The IWTE tool updates bounding spheres for structures when they are added or replaced, it does not at the moment update the complex and world level ones (that feature will be added in future version). If you've tried adding collision entry and its not appearing - and your new structure is larger / moved, then problem may be that the complex and world level bounding spheres in .world file aren't big enough, if so refer to info in spoiler. (Note: textrep examples are from WorldEditor, IWTE output is slightly different in terms of comments / layout)

    Spoiler Alert, click show to read: 
    Table One of the .world file has a very similar structure to the collision file as described above, the bounding boxes in that table control if the visible structure is rendered properly and don't really effect the collision volumes.

    Annoyingly if the bounding spheres in the .world file are too small your collision volume won't work.... that was something I'd overlooked for a long while and couldn't figure out why changes I was making didn't show up.

    There are bounding spheres for each individual structure (a structure contains multiple groups/objects in one .ms3d file), then there are larger bounding spheres that cover each complex, and there is one overall bounding sphere which should be large enough to contain all the parts of a settlement at the end of the complexes section.

    Viewed in the textrep version of a .world file generated by the WorldEditor the bounding sphere for a structure looks like:
    4 174 120 180
    130 174 119 181
    255 130 211 151
    0 0 0 0 39 0 90 40 0 89
    0 0 0 0
    -0.2923878 +4.3469734 -38.0206947 +27.6362915
    0 0 0 0 19 0 91 20 0 72 20 0 92
    # ============================================================
    # Structure 2
    # ============================================================
    23 0 93 3 # Structure number 2
    27 0 94 0 0 0 0 0 0 0 0 88
    155 156 157
    again it's x,y,z coordinates of the centre and radius, that's the sphere for Structure 1 of the complex. The one for the last structure in a complex will appear just before the textures section for that complex:
    255 138 239 191
    255 143 223 191
    0 0 0 0 39 0 112 40 0 111
    0 0 0 0
    +0.9098927 -0.4163971 -34.7492523 +9.8374634
    0 0 0 0 19 0 113 20 0 92 2 0 0 0
    49 0 114
    12 buildinglod0
    17
    50 BlockSet/Textures/walls_castle_large_stone.texture
    The sphere that covers all of an individual complex, is written at the end of the textures section of a complex eg:
    18 buildinglitterlod0
    17
    40 BlockSet/Textures/NE_litter_pass.texture
    47 BlockSet/Textures/NE_litter_pass_normal.texture
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    48 0 2941 49 0 2940
    +3.5611148 +1.0839137 +46.9186592 +18.7703285
    15 0 2942 16 0 2801 605 625 1 0 0 0 4 0 0 0
    472 226 96 44 31
    69
    416 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
    1
    # ============================================================
    # Complex 24
    # ============================================================
    The sphere that covers all the complexes is the line just before the list of files at the end of the complexes section:
    2164 32
    66
    145 146 147 148 149 152 153 154 155 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 341 343 345 346 348 350 352 353 354 355 356 357 358 359 360 361 362 363 364 365
    None
    -13.7802124 +10.7251711 +6.0081201 +102.0638657 0 0
    52 settlements/pkh/Hill_Fort_C/hill_Fort_C.worldTerrain
    56 settlements/pkh/Hill_Fort_C/hill_Fort_C.worldPathfinding
    55 settlements/pkh/Hill_Fort_C/hill_Fort_C.worldVegetation
    0 0
    # ============================================================
    # Many Tables
    # ============================================================
    even if you don't understand much of the rest of the file the bounding spheres with their characteristic 4 floats are reasonably easy to pick out.... they can be changed by amending the textrep version of a .world file and then reloading the textrep in the WorldEditor and writing a new .world file.

  4. #4

    Default Re: World Collision Entry alterations

    I always wondered if it would be even possible to change those collisions and now I have seen this tutorial. Thanks a lot for that!
    Somehow it seems not many people are interested in this yet (or they just havn't managed to really understand all this, like me ), but I suppose it will become invaluable once someone has achieved to modify a settlement.

    Do you think you may do such a tutorial for modifying buildings and pathfinding (which is probably even more important than collision)?
    Last edited by King Kong; December 09, 2009 at 07:03 AM.

    Winner of 'Favorite M2TW Mod' and 'Favorite M2TW Modder' Award 2007 & 2008

  5. #5

    Default Re: World Collision Entry alterations

    I also completely missed this. Bookmarking it for a rainy day when my brain is functioning properly. Thanks for posting this makanyane, you're a star. Feel sure it will be compulsory reading in the future.

  6. #6

    Default Re: World Collision Entry alterations

    Quote Originally Posted by King Kong View Post
    Do you think you may do such a tutorial for modifying buildings and pathfinding (which is probably even more important than collision)?
    Re: modifying buildings I've been able to do some bits under existing tools see Example fort, but its not ideal at the moment without facility to add or subtract objects from existing structures, so I was holding off explaining too much on that in case we can get a bit further with tools shortly.

    Pathfinding (on walls) will probably always end up being a manual addition as alterations require you to 'understand' in 3 dimensions links to the existing paths and routes, and I don't think anyone's likely to make modding program that can 'think' in that way, so that one I will try and write some more about. I did manage to add some extra routes in the fort example but its a bit time consuming and finicky...

  7. #7

    Default Re: World Collision Entry alterations

    Nice, that's great news!

    As long editing pathfinding doesn't end in real programming, I would certainly be willing to make this stuff manually, given that I will ever understand it.
    Good luck for you and wilddog for whatever you do next.

    Winner of 'Favorite M2TW Mod' and 'Favorite M2TW Modder' Award 2007 & 2008

  8. #8

    Default Re: World Collision Entry alterations

    @Makayane
    It looks a "bit" sofisticated.
    I don´t even ask what you are doing, all I understood respectively saw is that you are able to remove buildings form castles/cities. So this means you are able to remove structers/complexes? Wouldn´t then this thread belong to the world modified thread?
    I hardly look into the tutorial section but I am actually very interested in this.
    I am pretty much a nob when it comes to bits and bytes.
    Maybe you can say in a few (understandable) words what the benefit of this will/may be?

  9. #9

    Default Re: World Collision Entry alterations

    @DA
    this tutorial isn't really to do with adding or deleting visible structures from the .world file. Wilddog is still working on tool to try and do that, it looks feasible but is still a way off yet.....

    This tutorial can help with what you are able to do at the moment. Existing WorldEditor by KE allows you to change shape of objects within a structure, or hide them by moving them underground (by changing milkshape models). But if you do that on its own you are left with the collision version of the object (the invisible bit that tells the game when something has been hit by artillery - and that gives an object the label 'building' when you hover mouse over it in game / says you can't attack it / stand cavalry on it etc...) still in the old shape / position.

    If you're just trying to hide object you can get rid of the invisible collision part by changing the objects table three entry in the .worldcollision file. I've just added section here, which explains more explicitly how to do that.

    If you've vastly changed shape or size of visible object then you either need to Change Existing Collision Entry (to get its invisible version to match up with new shape)

    ...or if it shared a collision entry with another object (that hasn't changed to same shape and size) then you need the bit about adding a new entry - so it can have its own unique shape for its invisible version.


    Some of this might get automated later, but I wouldn't want to guarantee how much! A lot of the info here (apart from adding new collision entries), was actually in the World Modified thread, most things are in there somewhere..... but when thread got past 50 pages it got a bit impossible to find

  10. #10

    Default Re: World Collision Entry alterations

    Ahhh, now I get it, why it is called 'World Collision'.
    I understand now its purpose and what is meant.
    Thanks for clarification!


    @ KK so that´s what you did to TATW?

  11. #11

    Default Re: World Collision Entry alterations

    I create a excel file to undestand the RotationMatrix. Makanyane has tested my excel file with a lot of test and at the moment it work at 100%.
    In this site i found the math information to build the matrix:
    http://spanusoft.altervista.org/Pipe..._rotazione.htm
    The matrix work with 90°, 180°, -90°, -180°, 270° and mirror operation but i don't test other angle.



    Attention:
    In milkshape: make the following order operations: mirror, rotation, move and utilize the "User point" and "Absolute" option to do a correct rotation and movement without altering the pivot of object. The sign of "X move" in the collision file must changed in -X !!!

    In 3dstudio: mirror, rotation, move haven't a order, put "absolute" in move and rotation operation, the mirror utilize the traslated pivot, not like milkshape so it's very simple
    Last edited by johnwhile; January 09, 2010 at 11:00 AM.
    Forums:............freeforumzone - mtwitalia - twcenter
    Works:.....worldcollision file - ModelReferencePoints files - MaxScript Building Editor
    Other:.............siege-engine(video) - new-animations(video) - buildings
    Have to take the money where it is: at the poor. They have little, but they are many. Alphonse Allais

  12. #12

    Default Re: World Collision Entry alterations

    A very simple script for 3dstudio max to view the row BoundingBox of table1 from file .world.
    (A little correction here).
    Copy the script and the file ascii.txt in the same folder, drag on the script into 3dstudio max interface.
    I never utilize maxscript so i can't create a perfect tool, if someone know the maxscript can do it better
    this is the resul for ne_curch.world, make attention to delete the two "0" in the first Line:
    Last edited by johnwhile; January 09, 2010 at 11:09 AM.
    Forums:............freeforumzone - mtwitalia - twcenter
    Works:.....worldcollision file - ModelReferencePoints files - MaxScript Building Editor
    Other:.............siege-engine(video) - new-animations(video) - buildings
    Have to take the money where it is: at the poor. They have little, but they are many. Alphonse Allais

  13. #13

    Default Re: World Collision Entry alterations

    Thanks for posting the excel file, I've been using it and it works well for everything I've tried so far.
    (think you need to enter rotation as clockwise rotation not the value you put in milkshape 'rotate' menu which seems to turn anticlockwise - I'm still managing to confuse myself about differences between milkshape and game co-ordinates.... )

    I'll try and re-write the relevant section of the tutorial now that you've shown how to find the matrix numbers for re-using a collision object in different locations / orientation. I hadn't thought that was going to be feasible to work out before...


    I'd love to try the Bounding Box visualiser but don't have access to 3ds at the moment.
    Can you name the boxes so you can refer back to which line of the table they came from? For .world file you're really stuck with adapting the box the complex is already in... but for collision file you can change which existing box your object uses (it's just figuring out which one is closest that is the problem!) if tool works for collision file table 1 that might be a solution.

    As the Bounding Box thing relates to the .world file as well as collision it might be worth posting about that in World Modified thread too.

  14. #14

    Default Re: World Collision Entry alterations

    Quote Originally Posted by johnwhile View Post
    Do I understand things right, those boxes simulate the area, ingame invisible of course, where the collision with the church i.e. that area happens? The textured church model itself is so to speak 'just a visual placeholder'?

  15. #15

    Default Re: World Collision Entry alterations

    Ops, the X game correspond to -X in 3dstudio so now i correct the position of box but i don't undestand why the pivot has the x and not -x.... my knowledge of maxscript is very low
    Forums:............freeforumzone - mtwitalia - twcenter
    Works:.....worldcollision file - ModelReferencePoints files - MaxScript Building Editor
    Other:.............siege-engine(video) - new-animations(video) - buildings
    Have to take the money where it is: at the poor. They have little, but they are many. Alphonse Allais

  16. #16

    Default Re: World Collision Entry alterations

    Quote Originally Posted by Devils_Advocate View Post
    Do I understand things right, those boxes simulate the area, ingame invisible of course, where the collision with the church i.e. that area happens? The textured church model itself is so to speak 'just a visual placeholder'?
    i make this tool only to help me to correct quickly the BoundingBox and to see quickly all BoundingBox, but i don't know now export the correct file, you can do it manually...
    Why don't exist a WORLD to MAX coverter ??? i think it's simple to build and don't exist the vertices and triangles limit
    Forums:............freeforumzone - mtwitalia - twcenter
    Works:.....worldcollision file - ModelReferencePoints files - MaxScript Building Editor
    Other:.............siege-engine(video) - new-animations(video) - buildings
    Have to take the money where it is: at the poor. They have little, but they are many. Alphonse Allais

  17. #17

    Default Re: World Collision Entry alterations

    Quote Originally Posted by makanyane View Post
    .
    Can you name the boxes so you can refer back to which line of the table they came from?
    The name of box are Box01 Box02 ecc... and correspond with line1, line 2 ecc...
    This is only a modest contribution, if you wnat a big tool you can ask to Knight Errant or Vicingetorix (i don't remenber...)
    Forums:............freeforumzone - mtwitalia - twcenter
    Works:.....worldcollision file - ModelReferencePoints files - MaxScript Building Editor
    Other:.............siege-engine(video) - new-animations(video) - buildings
    Have to take the money where it is: at the poor. They have little, but they are many. Alphonse Allais

  18. #18

    Default Re: World Collision Entry alterations

    @ Devils_Advocate
    Not quite, you've got the right idea that there is an invisible version of the church that says where collisions occur. But that should actually be exactly the same shape as the church, complete with pitched roof / crosses etc..

    That invisible version is made up of lots of small models in a similar way to the visible textured one.



    Those invisible small models all have to fit within the bounding box structure that johnwhile has illustrated, and also their own bounding spheres. If your invisible small model doesn't actually fit inside the bounding box that it's meant to be using then it won't work properly (either 'disappears' from some angles or doesn't work at all - you can tell if the bits of invisible collision model are working or not by hovering mouse pointer over building in battle - if it says 'building' etc, its working - if it doesn't say anything / you can move camera through it, then its not)

  19. #19
    wilddog's Avatar Paintedwolves run free
    Join Date
    Jan 2005
    Location
    UK
    Posts
    2,337

    Default Re: World Collision Entry alterations

    OK, I finally caught up on some things and so intend to look at this over the next few days (whilst still on hols). Maks explained the basics and I want to try and re-enter the info associated with a Gate as a first step. Some bits look relatively straight forward but we'll see

    @johnwhile - thanks for uploading the excel sheet with the rotation matrix info. I need to cross check it to make sure I understand it - but it should come in handy... and my maths is very rusty.

  20. #20
    xeryx's Avatar Follow the White Rabbit
    Join Date
    Nov 2006
    Location
    Wyoming, Usa
    Posts
    4,337

    Default Re: World Collision Entry alterations

    KUDOS to you SIR!! As this is one of the top problems of this game that must be fixed, for seiges to work correctly!! +rep

    If the portals and gates can be fixed those two are big problems. Then of course there are many buildings inside of the castles/cities that pose problems.However the most anoying are the roads in some of the settlements are just all hosed up. As I'm sure you well know.

    This really is some AWESOME news!! I hope the community realizes how big this is.
    Last edited by xeryx; December 29, 2009 at 02:00 PM.
    Proudly patronized by B. Ward Click Sig Logo for Downloads, Click forums here and here
    "Do not try and bend the spoon, that is impossible, instead only try and realize the truth.
    There is no spoon, and you will see, it is not the spoon that bends, only yourself."-The Matrix


Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •