Skip to content

A tool to generate NAVP and AIRG files for Hitman: World of Assassination Scenes in the Glacier 2 Engine

License

LGPL-2.1, Apache-2.0 licenses found

Licenses found

LGPL-2.1
LICENSE
Apache-2.0
LICENSE.md
Notifications You must be signed in to change notification settings

glacier-modding/NavKit

Repository files navigation

NavKit

A tool to generate Navp files for Hitman: World of Assassination Scenes in the Glacier 2 Engine

Running instructions

You can run NavKit by opening NavKit.exe. To use the View Navp in game and Scene Extraction features, you will need ZHMModSdk installed, and you will need to copy the included Editor.dll to your Hitman 3\Retail\mods folder. For the Scene Extraction feature, you will also need to have Blender installed.

Functions available are loading and saving Navp and Navp.json, loading Airg and Airg.json, loading and saving Obj, scene extraction, building Navp, and viewing navp in game.

View Navp in game

  1. Open Hitman and launch a mission.
  2. Open NavKit and load a Navp file for that mission.
  3. Click the Send Navp button in NavKit.

Full generation of Navp and Airg (Scene Extraction, Navp generation, Airg generation)

  1. Download the lastest release of NavKit (https://github.com/glacier-modding/NavKit/releases/latest) and extract it to any folder (e.g. C:\NavKit)
  2. Install ZHMModSDK (https://github.com/OrfeasZ/ZHMModSDK/releases/latest)
  3. Backup the "HITMAN 3\Retail\mods\Editor.dll" file
  4. Copy the included Editor.dll from the NavKit folder to the "HITMAN 3\Retail\mods" folder
  5. Install Blender (tested with 3.4 https://download.blender.org/release/Blender3.4/)
  6. Start Hitman and enter a mission
  7. Open NavKit
  8. On the "Extract menu" of NavKit, set your file paths:
    1. Hitman 3 directory (e.g. C:\Program Files (x86)\Steam\steamapps\common\HITMAN 3)
    2. Output directory (e.g. C:\NavKit\Output)
    3. Blender Executable (e.g. C:\Program Files\Blender Foundation\Blender 3.4\blender.exe)
  9. On the "Extract menu" of NavKit, click "Extract from game". It may take up to around 10 minutes depending on the complexity of the mission being extracted, and whether the alocs have already been extracted from the rpkg files.
  10. When the OBJ finishes generating, you can save it to an OBJ file so you can load it later if you'd like by clicking the "Save Obj" button on the "Obj menu"
  11. On the "Navp menu" click the "Build Navp from Obj" button
  12. On the "Navp menu" click the "Save Navp" button and choose where to save the navp file
  13. On the "Airg menu" click the "Build Airg from Navp" button
  14. On the "Airg menu" click the "Save Airg" button and choose where to save the airg file

Adding navp and airg to a new scene

  1. Include the .navp and .airg files in the chunk folder for your brick
  2. Choose an IOI string for it (for instance [assembly:/_pro/scenes/missions/trapped/scene_wolverine_modified.navp].pc_navp)
  3. In GlacierKit, search the original scene file for "navp" and it should take you to the Pathfinder Configuration (usually at Scene\Scenario_[scene name]\Global\Pathfinder\PathfinderConfiguration
  4. Copy the entity id (in this example screenshot it is 0f374e8c1e033807) and put it somewhere easily accessible
  5. Open your new brick file in GlacierKit in the Editor
  6. In the Property overrides for your new brick, add this to add the navp:
    {
        "entities": [
            {
                "ref": "[pathfinder entity id]",
                "externalScene": "[original scene file]"
            }
        ],
        "properties": {
                "m_NavpowerResourceID": {
                    "type": "ZRuntimeResourceID",
                    "value": {
                        "resource": "[new navp ioi string]",
                        "flag": "5F"
                    }
                }
        }
    }
  1. Where [pathfinder entity id] is the id you copied earlier for the pathfinder, [original scene file] is the ioi string of the original scene (e.g. [assembly:/_pro/scenes/missions/snug/mission_vanilla.brick].pc_entitytype), and [new navp ioi string] is your new ioi string for the navp.
  2. In GlacierKit, search the original scene file for "airg" and it should take you to the Pathfinder Configuration (usually at Scene\Scenario_[scene name]\Global\Pathfinder\ReasoningGridConfig
  3. Copy the entity id (in the other example screenshot it is 6c6e6c3217bf058e) and put it somewhere easily accessible
  4. In the Property overrides for your new brick, add this to add the airg:
    {
        "entities": [
            {
                "ref": "[reasoning grid entity id]",
                "externalScene": "[original scene file]"
            }
        ],
        "properties": {
                "m_pGrid": {
                    "type": "ZRuntimeResourceID",
                    "value": {
                        "resource": "[new airg ioi string]",
                        "flag": "5F"
                    }
                }
        }
    }
  1. Where [reasoning grid entity id] is the id you copied earlier for the pathfinder, [original scene file] is the ioi string of the original scene (e.g. [assembly:/_pro/scenes/missions/snug/mission_vanilla.brick].pc_entitytype), and [new airg ioi string] is your new ioi string for the navp.
  2. Save your brick file
  3. In GlacierKit, under the Text Tools, paste your navp ioi string into the Hash Calculator
  4. Copy the Hex value, and rename your navp to [hex value].navp Where [hex value] is the Hex value you calculated
  5. Paste your airg ioi string into the Hash Calculator
  6. Copy the Hex value, and rename your airg to [hex value].airg Where [hex value] is the Hex value you calculated
  7. Deploy the mod

How NavKit generates Navp files

NavKit performs the following series of steps to be able to generate Navp files.

  1. Run glacier2obj.exe to connect to the Editor server of the running Hitman game, and issue commands to: rebuild the entity tree, find the scene's brick tblu hashes, and send them back to NavKit.
  2. Get the temp hashes for those bricks, and scan those bricks' dependencies to get the hashes for all Prim dependencies that are children of ALOCs and save them to toFind.json in the specified output folder.
  3. Connect to the Editor server of the running Hitman game again, and issue a command with all of the ZGeomEntity / Prim hashes to get the transforms of all the ZGeomEntities and send them back to NavKit and save them to prims.json in the specified output folder.
  4. Extract all of the needed Prim files from the rpkg files to the prim folder of the specified output folder.
  5. Open the blender cli and run glacier2obj.py to generate an obj by importing all of the Prim files, copy them the number if times they are used in the scene, and transform each one according to what was sent by the game, and save it to output.obj in the specified output folder.
  6. Load output.obj from the specified output folder in NavKit. You can also save the obj file to another filename by pressing the Save obj button.
  7. At this point, the build Navp section of the menu will be available and you can customize the parameters, then press build to call Recast to generate the Navmesh. Then you can save the Navmesh as a Navp or Navp.json file by pressing the Save Navp button.

Disclaimer

NavKit is still a work in progress, and there may be glitches or issues with navp generation in the current version. If you encounter any problems while running NavKit please create an issue on this GitHub repo.

Future enhancements

  • Airg Generation
  • Faster Scene generation
  • Linux and MacOs support

Building instructions

You can also build NavKit yourself. To build NavKit:

  1. Clone this repository with the '--recurse-submodules' option
  2. Open in Visual Studio
  3. Cmake should load
  4. In the x64 command prompt make a build folder, cd into it, and run:
    cmake -B . -S ..
  5. Then change back to the main directory and run
    cmake --preset x64-debug

Credits

NoFate
Atampy25
Notex
Anthony Fuller
Recast team
rdil
2kpr
kercyx
Kevin Rudd
And everyone at the Glacier 2 discord!

About

A tool to generate NAVP and AIRG files for Hitman: World of Assassination Scenes in the Glacier 2 Engine

Resources

License

LGPL-2.1, Apache-2.0 licenses found

Licenses found

LGPL-2.1
LICENSE
Apache-2.0
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published