Havok: Difference between revisions
m
Fixed some typos
imported>Kreny (Specify some header entries, added known classes) |
imported>Kreny m (Fixed some typos) |
||
Line 1: | Line 1: | ||
'''Havok''' is a middleware software suite developed by the Irish company Havok. Havok provides a physics engine component and related functions to video games. | '''Havok''' is a middleware software suite developed by the Irish company Havok. Havok provides a physics engine component and related functions to video games. | ||
Line 5: | Line 4: | ||
</onlyinclude> | </onlyinclude> | ||
== Products == | ==Products== | ||
The Havok middleware suite consists of the following modules:<ref>[http://www.havok.com/products Product Overview]</ref> | The Havok middleware suite consists of the following modules:<ref>[http://www.havok.com/products Product Overview]</ref> | ||
* '''Havok Physics''': It is designed primarily for video games, and allows for real-time collision and dynamics of rigid bodies in three dimensions. It provides multiple types of dynamic constraints between rigid bodies (e.g. for ragdoll physics), and has a highly optimized collision detection library. By using dynamical simulation, Havok Physics allows for more realistic virtual worlds in games. The company was developing a specialized version of Havok Physics called Havok FX that made use of ATI and NVIDIA GPUs for physics simulations;<ref>[https://web.archive.org/web/20081205092623/http://www.xbitlabs.com/news/multimedia/display/20051028224421.html Havok Intros Havok FX Engine to Compute Physics Effects on GPUs]</ref> however, the goal of GPU acceleration did not materialize until several years later.<ref>[https://www.youtube.com/watch?v=v1hoVCZZOd0&list=UUfcEdH66zmcp8JEz5NkwJuw&index=6 Havok Physics Playstation 4 Demo]</ref> | *'''Havok Physics''': It is designed primarily for video games, and allows for real-time collision and dynamics of rigid bodies in three dimensions. It provides multiple types of dynamic constraints between rigid bodies (e.g. for ragdoll physics), and has a highly optimized collision detection library. By using dynamical simulation, Havok Physics allows for more realistic virtual worlds in games. The company was developing a specialized version of Havok Physics called Havok FX that made use of ATI and NVIDIA GPUs for physics simulations;<ref>[https://web.archive.org/web/20081205092623/http://www.xbitlabs.com/news/multimedia/display/20051028224421.html Havok Intros Havok FX Engine to Compute Physics Effects on GPUs]</ref> however, the goal of GPU acceleration did not materialize until several years later.<ref>[https://www.youtube.com/watch?v=v1hoVCZZOd0&list=UUfcEdH66zmcp8JEz5NkwJuw&index=6 Havok Physics Playstation 4 Demo]</ref> | ||
* '''Havok AI''': In 2009, Havok released Havok AI, which provides advanced pathfinding capabilities for games. Havok AI provides navigation mesh generation, pathfinding and path following for video game environments. | *'''Havok AI''': In 2009, Havok released Havok AI, which provides advanced pathfinding capabilities for games. Havok AI provides navigation mesh generation, pathfinding and path following for video game environments. | ||
* '''Havok Cloth''': Released in 2008, Havok Cloth deals with efficient simulation of character garments and soft body dynamics. | *'''Havok Cloth''': Released in 2008, Havok Cloth deals with efficient simulation of character garments and soft body dynamics. | ||
* '''Havok Destruction''': Also released in 2008, Havok Destruction provides tools for creation of destructible and deformable rigid body environments. | *'''Havok Destruction''': Also released in 2008, Havok Destruction provides tools for creation of destructible and deformable rigid body environments. | ||
* '''Havok Animation Studio (discontinued)''': Havok Animation Studio is formally known as Havok Behavior and Havok Animation. Havok Behavior is a runtime SDK for controlling game character animation at a high level using finite state machines. Havok Animation provides efficient playback and compression of character animations in games, and features such as inverse kinematics. | *'''Havok Animation Studio (discontinued)''': Havok Animation Studio is formally known as Havok Behavior and Havok Animation. Havok Behavior is a runtime SDK for controlling game character animation at a high level using finite state machines. Havok Animation provides efficient playback and compression of character animations in games, and features such as inverse kinematics. | ||
* '''Havok Script (discontinued)''': Havok Script is a Lua-compatible virtual machine designed for video game development. It is shipped as part of the Havok Script Studio. | *'''Havok Script (discontinued)''': Havok Script is a Lua-compatible virtual machine designed for video game development. It is shipped as part of the Havok Script Studio. | ||
* '''Havok Vision Engine''' '''(discontinued):''' On August 8, 2011, Havok announced their acquisition of German game engine development company Trinigy and their Vision Engine and toolset. | *'''Havok Vision Engine''' '''(discontinued):''' On August 8, 2011, Havok announced their acquisition of German game engine development company Trinigy and their Vision Engine and toolset. | ||
== Usage == | ==Usage== | ||
{{Expand section}} | {{Expand section}} | ||
''Breath of the Wild'' uses the '''Havok Physics''', '''Havok AI''' and '''Havok Cloth'''. | ''Breath of the Wild'' uses the '''Havok Physics''', '''Havok AI''' and '''Havok Cloth'''. | ||
Line 57: | Line 56: | ||
|} | |} | ||
=== File Types === | ===File Types=== | ||
==== hknm2 ==== | ====hknm2==== | ||
{{Expand section}}Used in shrines and field sections. | {{Expand section}}Used in shrines and field sections. | ||
==== hkrb ==== | ====hkrb==== | ||
{{Expand section}}Used in actors. | {{Expand section}}Used in actors. | ||
==== hkcl ==== | ====hkcl==== | ||
{{Expand section}}Used in actors. | {{Expand section}}Used in actors. | ||
==== hkrg ==== | ====hkrg==== | ||
{{Expand section}}Used in actors. | {{Expand section}}Used in actors. | ||
==== hksc ==== | ====hksc==== | ||
{{Expand section}}Used in shrines and field sections. | {{Expand section}}Used in shrines and field sections. | ||
==== hktmrb ==== | ====hktmrb==== | ||
{{Expand section}}Used in field sections. | {{Expand section}}Used in field sections. | ||
== Havok File Specification == | ==Havok File Specification== | ||
Havok files serve as a data container for multiple Havok classes per file and sometimes multiple Havok files per file<ref>Static Compound files ([[hksc]]) include two Havok file definitions. The first file defines <code>StaticCompoundInfo</code> and the second defines <code>hkpPhysicsData</code> (which includes <code>hkpRigidBody</code>, <code>hkpStaticCompoundShape</code>, <code>hkpBvCompressedMeshShape</code>, <code>hkpConvexVerticesShape</code>, et. al.).</ref>. The class names are defined in each file. | Havok files serve as a data container for multiple Havok classes per file and sometimes multiple Havok files per file<ref>Static Compound files ([[hksc]]) include two Havok file definitions. The first file defines <code>StaticCompoundInfo</code> and the second defines <code>hkpPhysicsData</code> (which includes <code>hkpRigidBody</code>, <code>hkpStaticCompoundShape</code>, <code>hkpBvCompressedMeshShape</code>, <code>hkpConvexVerticesShape</code>, et. al.).</ref>. The class names are defined in each file. | ||
Note that this specification only applies to version 2014.2.0-r1 | Note that this specification only applies to version 2014.2.0-r1 | ||
=== File Structure === | ===File Structure=== | ||
[[File:Havok-file-structure.png|thumb|File structure]] | [[File:Havok-file-structure.png|thumb|File structure]] | ||
Each file contains a header and three sections: classnames, types and data | Each file contains a header and three sections: classnames, types and data | ||
==== classnames ==== | ====classnames==== | ||
The classnames section (<code>__classnames__</code> internally) contains a list of Havok classes used by the file to correctly decompile the binary data into a usable data structure. | The classnames section (<code>__classnames__</code> internally) contains a list of Havok classes used by the file to correctly decompile the binary data into a usable data structure. | ||
==== types ==== | ====types==== | ||
The types section (<code>__types__</code> internally) does not appear to be used by ''Breath of the Wild''. | The types section (<code>__types__</code> internally) does not appear to be used by ''Breath of the Wild''. | ||
==== data ==== | ====data==== | ||
the data section (<code>__data__</code> internally) contains binary data to be serialized into Havok data structures for use by the Havok engine. | the data section (<code>__data__</code> internally) contains binary data to be serialized into Havok data structures for use by the Havok engine. | ||
== Header == | ==Header== | ||
The header seems to have a 16-byte alignment and can be 64-bytes (short header) or 80-bytes (long header) in length, depending on if ''' | The header seems to have a 16-byte alignment and can be 64-bytes (short header) or 80-bytes (long header) in length, depending on if '''Section offset''' equals 0 (short header) or 16 (long header). | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ | ||
Line 186: | Line 185: | ||
|} | |} | ||
=== Optional Header Bytes === | ===Optional Header Bytes=== | ||
There are optional header bytes for a long header. If | There are optional header bytes for a long header. If Section offset equals 16, an additional 16 bytes are added to the header for a total of 80 bytes. | ||
{| class="wikitable" | {| class="wikitable" | ||
|+Optional Header Bytes | |+Optional Header Bytes | ||
Line 196: | Line 195: | ||
|- | |- | ||
|0x40 | |0x40 | ||
| | |4 | ||
|Int | |Int | ||
|Unknown (always 20) | |Unknown (always 20) | ||
Line 216: | Line 215: | ||
|} | |} | ||
== Section Headers == | ==Section Headers== | ||
[[File:Havok-class-header-delimits.png|thumb|<code>FF</code> bytes indicate section header boundaries]] | [[File:Havok-class-header-delimits.png|thumb|<code>FF</code> bytes indicate section header boundaries]] | ||
Each section has a 64-byte header which includes the section name, absolute offset to the section start and six relative offsets to segments within the section. All three section headers follow the file header and are delimited by 16 delimiter bytes (<code>0xFF</code>). | Each section has a 64-byte header which includes the section name, absolute offset to the section start and six relative offsets to segments within the section. All three section headers follow the file header and are delimited by 16 delimiter bytes (<code>0xFF</code>). | ||
Line 267: | Line 266: | ||
|} | |} | ||
=== Section Name === | ===Section Name=== | ||
There are only three section names: <code>__classnames__</code>, <code>__types__</code> and <code>__data__</code>. The section name is a null-terminated string with a delimiter byte (<code>0xFF</code>) in byte 20. | There are only three section names: <code>__classnames__</code>, <code>__types__</code> and <code>__data__</code>. The section name is a null-terminated string with a delimiter byte (<code>0xFF</code>) in byte 20. | ||
=== Absolute Offset === | ===Absolute Offset=== | ||
The absolute offset to the section. | The absolute offset to the section. | ||
=== Relative Offsets === | ===Relative Offsets=== | ||
The relative offsets point to different large structures within the section. | The relative offsets point to different large structures within the section. | ||
Line 336: | Line 335: | ||
== Class Names Section == | ==Class Names Section== | ||
[[File:Havok-class-names.png|thumb|Class names binary data]] | [[File:Havok-class-names.png|thumb|Class names binary data]] | ||
The classnames section header includes the absolute offset to the class names data and a single unique relative offset to the end of the section. The section is made up of an array of hash ids and a null-terminated string class name. | The classnames section header includes the absolute offset to the class names data and a single unique relative offset to the end of the section. The section is made up of an array of hash ids and a null-terminated string class name. | ||
=== Class Name === | ===Class Name=== | ||
Class names are read until the end of the section or a delimiter byte (<code>0xFF</code>) is is reached. | Class names are read until the end of the section or a delimiter byte (<code>0xFF</code>) is is reached. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 365: | Line 364: | ||
|} | |} | ||
== Types Section == | ==Types Section== | ||
The types section is unused in ''Breath of the Wild''. The absolute offset points to the beginning of the data section with all null (<code>0x00</code>) relative offsets. | The types section is unused in ''Breath of the Wild''. The absolute offset points to the beginning of the data section with all null (<code>0x00</code>) relative offsets. | ||
== Data Section == | ==Data Section== | ||
[[File:Havok-data-structure.png|thumb|390x390px|Data structure]] | [[File:Havok-data-structure.png|thumb|390x390px|Data structure]] | ||
=== Data === | ===Data=== | ||
The bulk of the file is devoted to the data section which is divided into smaller segments dependent on the file type. | The bulk of the file is devoted to the data section which is divided into smaller segments dependent on the file type. | ||
All files follow a general structure as you can see in the picture. | All files follow a general structure as you can see in the picture. | ||
Line 379: | Line 378: | ||
After that, several more chunks can be found depending on the file. | After that, several more chunks can be found depending on the file. | ||
=== Pointer === | ===Pointer=== | ||
The next section, at the end of the file, contains three different pointer arrays. | The next section, at the end of the file, contains three different pointer arrays. | ||
It is used to connect the whole file together, and should be used as an entry point while reading the file. | It is used to connect the whole file together, and should be used as an entry point while reading the file. | ||
Line 385: | Line 384: | ||
The offsets to these three sections can be found in the header. | The offsets to these three sections can be found in the header. | ||
==== Data Pointer ==== | ====Data Pointer==== | ||
An array of offsets relative to the beginning of the data section, pointing into various chunks. | An array of offsets relative to the beginning of the data section, pointing into various chunks. | ||
Line 394: | Line 393: | ||
==== Linked Entries ==== | ====Linked Entries==== | ||
Contains pointer-pairs to connect chunks together. | Contains pointer-pairs to connect chunks together. | ||
Line 430: | Line 429: | ||
==== Class Mapping ==== | ====Class Mapping==== | ||
The last section contains the mapping between the chunks and the classes they are using. | The last section contains the mapping between the chunks and the classes they are using. | ||
Line 468: | Line 467: | ||
This also marks the end of the file, if the offset is not aligned to 16 bytes, the rest is filled with <code>0xFF</code>. | This also marks the end of the file, if the offset is not aligned to 16 bytes, the rest is filled with <code>0xFF</code>. | ||
== Data Classes == | ==Data Classes== | ||
{{Expand section}} | {{Expand section}} | ||
All known classes that chunks can use are listed here. | All known classes that chunks can use are listed here. |