Welcome to the TWC Wiki! You are not logged in. Please log in to the Wiki to vote in polls, change skin preferences, or edit pages. See HERE for details of how to LOG IN.

Difference between revisions of ".animinstances file - M2TW"

From TWC Wiki
Jump to navigationJump to search
(watermark template)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
The .animinstances files are so far the least understood of all the M2TW battlemap building world files.
+
{{M2TW Modding Logo}}
 +
'''The .animinstances file is one of the [[Battle Map Buildings - M2TW|M2TW battlemap building]] world files. The .animinstances file used, and the path to it, is specified inside the [[.world]] file.'''
  
The function of the file is to provide the animated transitions that occur when some objects switch from undamaged to damaged group.  Not all paired group objects have an animation.  The objects that have the most obvious animation are the wall breach areas, where the wall passes through five animations as it switches between the undamaged and five progressively more damages states.
+
'''See [[Building Animations - M2TW]] for more general information about building animations and how to modify them.'''
  
===Relationship to collision volume===
+
The function of the .animistances file is to provide some of the information for the animated transitions that occur when some objects switch from undamaged to damaged group, or in the case of gates, open or close. 
  
Experimentation shows that the animinstances file does not contain the co-ordinate data for the animation in relation to the settlement plan. Moving the objects collision volume in the[[.worldcollision]] file results in the animated version moving to the new position of the collision volume.
+
==File Contents==
 +
The .animinstances file contains a count of the total number of objects in the .world - if the .animinstances / [[.worldcollision]] and/or [[.world]] files have become mismatched and contain different numbers of objects that can cause a battle loading CTD.
  
In this example the normally visible structural groups have been moved backwards in the ms3d file the pathfinding and docking information has been left as it was, and the collision volume has been moved forward and right:
+
The file then contains an entry for each object in order - that will either be a '0' for objects without an animation or will contain a binary segment for each transition for objects with an animation.  The binary segments start with the name of the transition, followed by vertex coordinates for the starting position of the animation, and shading and effect illumination information for those vertexes at various stages of the animation.  The binary segments are in compressed form, and need to be 'un-packed' to produce recognisable data.  The compression used is the LZO system as used for other in-game packed files.
  
[[Image:Objectmoved.jpg]]
+
The file does not contain rotation or bone assignment data, or texture or uv mapping data.
  
Interestingly the unit that deployed the ladders to the old docking position then abandoned them - they wouldn't climb ladders with the collision volume in different location....
+
==Related Files==
  
When the wall gets to the damage level where the animated transition comes in the wall appears in the collision volume location.
+
===.anim Files===
[[Image:Collisionmoved.jpg]]
+
The .anim files, located in data/blockset/culture/animations/etc contain the key frames for the animation, its rotations and movements.  The .anim file used is specified inside the .world file.
  
===Textures===
+
===.mesh Files===
The animinstances file also seems to include a reference (not in text form) to the texture used for the building whilst its in transition.  
+
The .mesh files, located in data/blockset/culture/animations/etc contain the bone assignments for each vertex involved in the animated model, the texture name/path to be used, and the UV mapping used.
  
[[Image:Worldtexture.jpg]]
 
  
The above is a quick test changing the texture used for the wall in the .world file to the litter texture.  While the animation is in progress that same bit of wall switches texture back to the normal one
 
  
[[Image:Animtexture.jpg]]
+
==Relationship to .worldcollision volume==
 +
The coordinates contained in the animinstances file are related to a 0,0,0 position, the file does not contain the coordinate data for the animation in relation to the settlement plan. 
  
which isn't now specified for it in the .world file...  (The texture reference might be being picked up by use of the texture header and trailer numbers from somewhere else in the world file that texture is being used)
+
The animation appears in-game aligned with the object's collision volume as defined by the[[.worldcollision]] file, the .worldcollision file provides the displacement for the collision (and hence also the animation) from 0,0,0 and 0 rotation, to the object's position in the .world.
  
[[Category:Battle Map Modification - M2TW]]
+
Animations appearing in the 'wrong' location will usually be because the collision volume doesn't align with the visible object.  Loading a new animation that didn't start centered properly on 0,0,0 will also cause a mismatch.
 +
 
 +
==Shading and Effect Lighting==
 +
Vanilla .animinstances entries also include, in the packed section, texture shading information and intensity of adjacent effect information recorded against each vertex.  This contains values for both shading and effect information at the start of the animation and at the end of the animation,  this appears to be why some swing gates gradually go black when held in the open position, it also explains why transplanting an .animinstances chunk from a vanilla file to one with fewer effects causes the "disco lighting" problem.  If an effect number is referenced, and the .world file does not have an entry for that many effects, the game gets confused and applies some multi-coloured lighting!
 +
 
 +
These aspects of the .animinstance chunks are unique to each object - if re-using an existing chunk is causing problems you may find copying a chunk from another object using the same animation (ideally one far away from effect light sources) works better.
 +
 
 +
[[Category:M2TW Battle Map Modding]]

Latest revision as of 10:13, 25 May 2020

M2TW Modding Index


The .animinstances file is one of the M2TW battlemap building world files. The .animinstances file used, and the path to it, is specified inside the .world file.

See Building Animations - M2TW for more general information about building animations and how to modify them.

The function of the .animistances file is to provide some of the information for the animated transitions that occur when some objects switch from undamaged to damaged group, or in the case of gates, open or close.

File Contents

The .animinstances file contains a count of the total number of objects in the .world - if the .animinstances / .worldcollision and/or .world files have become mismatched and contain different numbers of objects that can cause a battle loading CTD.

The file then contains an entry for each object in order - that will either be a '0' for objects without an animation or will contain a binary segment for each transition for objects with an animation. The binary segments start with the name of the transition, followed by vertex coordinates for the starting position of the animation, and shading and effect illumination information for those vertexes at various stages of the animation. The binary segments are in compressed form, and need to be 'un-packed' to produce recognisable data. The compression used is the LZO system as used for other in-game packed files.

The file does not contain rotation or bone assignment data, or texture or uv mapping data.

Related Files

.anim Files

The .anim files, located in data/blockset/culture/animations/etc contain the key frames for the animation, its rotations and movements. The .anim file used is specified inside the .world file.

.mesh Files

The .mesh files, located in data/blockset/culture/animations/etc contain the bone assignments for each vertex involved in the animated model, the texture name/path to be used, and the UV mapping used.


Relationship to .worldcollision volume

The coordinates contained in the animinstances file are related to a 0,0,0 position, the file does not contain the coordinate data for the animation in relation to the settlement plan.

The animation appears in-game aligned with the object's collision volume as defined by the.worldcollision file, the .worldcollision file provides the displacement for the collision (and hence also the animation) from 0,0,0 and 0 rotation, to the object's position in the .world.

Animations appearing in the 'wrong' location will usually be because the collision volume doesn't align with the visible object. Loading a new animation that didn't start centered properly on 0,0,0 will also cause a mismatch.

Shading and Effect Lighting

Vanilla .animinstances entries also include, in the packed section, texture shading information and intensity of adjacent effect information recorded against each vertex. This contains values for both shading and effect information at the start of the animation and at the end of the animation, this appears to be why some swing gates gradually go black when held in the open position, it also explains why transplanting an .animinstances chunk from a vanilla file to one with fewer effects causes the "disco lighting" problem. If an effect number is referenced, and the .world file does not have an entry for that many effects, the game gets confused and applies some multi-coloured lighting!

These aspects of the .animinstance chunks are unique to each object - if re-using an existing chunk is causing problems you may find copying a chunk from another object using the same animation (ideally one far away from effect light sources) works better.