Results 1 to 10 of 10

Thread: Explaination: Building Collision Files

  1. #1
    Bassist, God and Modder Member Thor the Bassist's Avatar
    Join Date
    Jan 2008
    Location
    Yorkshire, England
    Posts
    213

    Default Explaination: Building Collision Files

    N.B. Before I start I would like to point out that by day I'm a physicist/mathematician and so am good with logic and numbers. Words not so much. If you spot any huge problems with the flow of this explanation then pm me so I can iron out the creases.

    One of the areas of modding that hasn't been explored enough in the RTW engine is the buildings and central to much of the problem is the creation of collision files that are vital to a buildings use in game. First it is important to state what the collision files do. The collision files contain all the data regarding how troops, projectiles and the cursor can interact with a building. This may seem rather vague but the area isn't as preset as many people would assume. It is indeed possible to create a fortress that are unspeakably complicated with many walls (although only one outer gate is possible) and buildings that troops can fight upon.

    Associated Files
    First it is important to outline what files are needed for a collision file.

    xxxxxxxxx.bpi This is the actual collision file used by the engine. It is not editable directly but the game can convert a cas file to a bpi during startup.

    xxxxxxxxx.cas This is the file you will create in 3dsmax. It consists of several geometries each of which gives a certain instruction to the engine.

    descr_building_battle.txt This contains all the building references in the whole game (I would advise using the "include" command as CA have done). The key reference is the "physical_info" reference. This should point to your cas.

    Possible geometries within the cas
    So you look at me perplexed. The task now seems simple - create a cas, get your building to reference it and then the game will automatically create the bpi and everythings jolly. Unfortunately the game has a habit of spitting the cas file straight back at you with no error message if one of the geometries is a little wrong. For that I shall now list all known possible geometries, how they are implemented and some of the tricks I have found that can prevent unwanted effects.

    Collision Outlines: affects troops
    This is a 2D loop that encircles an area of the map that cannot or should not be reached by troops. It acts as an invisible brick wall and troops will simply walk into it and be forced to stop. The geometry is named "collision" and should be a single polygon. If two regions are wanted as collision they should be made into separate objects and named accordingly (eg collision_1 and collision_2). The game engine draws a clockwise connected loop following the edges of the geometry.

    Collision Volumes: affects cursor/projectiles
    This is a 3D geometry that should show where a building is and is named "collision_3d". It doesn't effect troops but the cursor will move over the building and projectiles will hit the building. This can be a simple copy of the file used to make the item though any complex details should be simplified to improve load time and lag (eg stairs changed to a slope)

    Tunnels: affects troops
    Tunnels are so named because they are used to get troops from lower levels to upper levels and are usually inside buildings though this is by no means a necessity (eg troops getting from ground to top of walls). They either have 2 entry points or 3 entry points and their polygons have 4 or 6 sides respectively. The smallest side of the polygon is alocated as an entrance and then every other side is an entrance. The game then directly connects these sides. The geometry is named "tunnel" and is a simple rectangle or hexagon. Troops who enter a tunnel cannnot turn around or stop they must travel all the way to the end.

    Platforms: affects troops
    Platforms are basically surfaces that troops can walk upon. They consist of the platform (named "platform_N_<edges>") and the slots for the platform (named "slot_platform_N_<rank>"). The platform is a simple quadrilateral that must form a plane. Bad effects also occur when a platform is not horizontal. N is the platform number (0-9) and gives the platform an identity and <edges> specifies whether an edge is clear (C - can walk off), soft (S - can fall off) or hard (H - cannot fall off). One edge also must be vertex coloured as this shows which is the "forward" edge - the front where the troops will face - and this is also the first edge to be given an edge specifier. The slots are rank positions and show where troops will stand when idle. These are made from an isoceles triange (must be isoceles). The first troops is placed at the short edge and troops are then evenly spaced about a metre apart up until the vertex of the triangle is reached. The slot must have the N value of the corresponding platform and the rank is given as a value starting at front rank being 0 and increasing to presumably 99.

    (eg) platform_0_HCSC and slot_platform_0_0

    Good practise: Several things I have found include that if the slots are too close to any of the edges of the platform troops will tend to fall off. Just make the platforms generously. Also the vertex painting is an absolute b***h. Re-import after exporting to check the right vertices are coloured and then fiddle till it works - this really is a bad aspect of max - Vercingetorix said it was to do with the fact that max paints the polygon and then changes the vertices or something - and if anyone has a fix...

    Point of question: Although I am uncertain about this I believe that platforms can only have 4 edges as when I started on this area I got errors/CTDs on platforms with more edges - however this could just have been the fact that it was at the beginning of research. Either way it is relatively easy to make platforms with rectangles.

    There are several others that are detailed here but I haven't used these yet and so can only reference you to these. The above are however more commonly used.

    So you have all this info but that doesn't seem to be helping you much. Actually having read through this myself I believe the words are actually more complicated than the process should be. So an example is called for.



    Now hopefully things make more sense. The two red arrows show two different collision data sections each a separate object and they make it impossible for troops to walk through the wall. The blue arrows are pointing at the two 3d collision sections - the wall bulk and the battlements. This means the cursor will pass over the wall and arrows will collide with the wall. The yellow/brown highlighted area shows a tunnel where troops can climb the stairs up to the wall. Notice that the smallest edges are the entrances. Finally the green highlighted area shows a platform area.

    I hope this helps someone and soon we can see custom settlements sprawling across RTW landscapes.
    Last edited by Thor the Bassist; 06-02-2008 at 20:45.

    Building for the Future of METW

  2. #2

    Default Re: Explaination: Building Collision Files

    Great tutorial Thor, the picture really does help show how everything goes together and what they do.

    As you know, I've been doing a bit of research into settlement construction lately and this will be a nice addition to my growing collection of tutorials. However, as in most things, I will not completely understand it until I actually try it for myself.

    I have several questions, but I am most confused about tunnels.

    Is the tunnel in your example an exposed tunnel and if I am seeing the example correctly it doesn't look like its touching the ground? So, tunnels don't necessarily need to be inside a structure?
    Last edited by Ramashan; 05-30-2008 at 01:36.

  3. #3
    Bassist, God and Modder Member Thor the Bassist's Avatar
    Join Date
    Jan 2008
    Location
    Yorkshire, England
    Posts
    213

    Default Re: Explaination: Building Collision Files

    Indeed it is open. All the vanilla and BI ones are within the building I think but they work well wherever you put them. Also the ground is elevated in the map when in game so the ground does come up to the bottom of the tunnel. The main problem with having the tunnel open I believe is that you cannot fight on the tunnel and so people worryingly run up and down oblivious to the world. This may seem like nothing but if you fight around it you end up with a fight at each end and troops running all over the place to get to the fight at the other end - basically it doesn't look too real. I think the right effect can be made by a platform without any slots - like on bridges if I'm correct - where you cannot move onto the bridge but can move and fight on it to get to the other side though I haven't tried that yet.

    When fiddling around with things I was actually rather impressed at how flexible the game engine is with the entry and exit to tunnels. The troops are able to actually "jump" about their own height to get onto a tunnel and get off again. I'd advise some experimentation to find out what geometries are suitable for what purposes.

    You mentioned some other questions?
    Last edited by Thor the Bassist; 05-30-2008 at 16:34.

    Building for the Future of METW

  4. #4
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Explaination: Building Collision Files

    Super information here Thor which should enlighten many. Great work!
    "One of the most sophisticated Total War mods ever developed..."

  5. #5

    Default Re: Explaination: Building Collision Files

    Great job Thor!

    I'll try out your hints asap with my brand new LOTR-TW buildings and if I'll have doubts or questions I'll post them here.

  6. #6

    Default Re: Explaination: Building Collision Files

    Yes yes YES it works!

    My orthanc tower now have its own collision info file and it works!




    Ok i run to correct my tutorial on this point, Thor thanks A LOT!


    PS later on i will surely try to add tunnels, would be lovely to have attackers running up the black towers, or minas tirith fortress...

    A question: will it be possible to make a "goal" to climb up a building? Mmm maybe i already have the answer, one way may be to set the target area for the settlement on a plane which ends up to a specific building...

    But again, out of this way, when soldiers run up a tower or a wall segment, game says its conquered and changes ownership. Will it be possible to do the same for some buildings inside the settlement?

    And what about giving them also firepower?

    Ops guess I'm running OT...

  7. #7
    Death and Glory TW modder Member Flying Pig's Avatar
    Join Date
    Dec 2007
    Location
    Looking for a place to land...
    Posts
    313

    Default Re: Explaination: Building Collision Files

    Are you on LOTRTW? If not sign up! LOTRTW needs a building moddeler!

    Can you make the plaza atop a building, Thor?
    Death And Glory TW Needs You - Sign Up Now! All it takes is one PM!

    Ὦ ξεῖν', ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε
    κείμεθα, τοῖς κείνων ῥήμασι πειθόμενοι.

    Ō zein', angellein Lakedaimoniois hoti tēide
    keimetha tois keinōn rhēmasi peithomenoi.

    Go, thou that passeth, to the Spartans tell
    That as per their orders, here we fell.

  8. #8
    Bassist, God and Modder Member Thor the Bassist's Avatar
    Join Date
    Jan 2008
    Location
    Yorkshire, England
    Posts
    213

    Default Re: Explaination: Building Collision Files

    I'm METW but LOTRTW are welcome to use my downloads (with proper notice and acknowledgement).

    The plaza atop a building is a funny one. Technically it may be possible but I believe the AI may get rather confused. I hit a bit of an AI brick wall with Helms Deep (which I've left so it doesn't become stale but will return to) regarding troops negotiating the buildings to get from the walls/gateway to the capture zone (namely that they just didn't move when controlled by the computer). Personally I'd avoid that and try to get the area as part of the map underlay.
    Last edited by Thor the Bassist; 06-07-2008 at 13:32.

    Building for the Future of METW

  9. #9

    Default Re: Explaination: Building Collision Files

    Quote Originally Posted by Thor the Bassist View Post
    (..) Personally I'd avoid that and try to get the area as part of the map underlay.
    That will surely work with Minas Tirith:




    A question: i noticed that if I add to the settlement underlay a hill to put under a building, in battle it is shown as "solid", but if I create a slot_underlay or a slot_overlay for a building they are shown as "semi_trasparent".

    That is pretty annoying, given I saw some of those (like lets say overlay_egyptian_imperial_palace.cas) that are not at all transparent.

    Is there a way to decide the alpha level of the slot_underlay or slot_overlay?

    EDIT: sorry, I didn't kept in mind this is scriptorium. I move my questions in modding questions forum.
    Last edited by Seth Krn3ll; 06-07-2008 at 17:49.

  10. #10
    Bassist, God and Modder Member Thor the Bassist's Avatar
    Join Date
    Jan 2008
    Location
    Yorkshire, England
    Posts
    213

    Default Re: Explaination: Building Collision Files

    Personally I much prefer using the basic map underlay especially for iconic cities like Minas Tirith as I've done it before. Buildings do tend to confuse the AI.

    Building for the Future of METW

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO