Custom .pkg Texture Packages
Before you start, make sure you've installed deppth2.
Hades II uses .pkg files to store textures for every asset (texture) in the game, including 3D model textures (how to pack those is described separately in 3D Model Textures).
Extracting textures
Base game packages can be found in Content\Packages\1080p (or Content\Packages\720p for the lower-resolution variants).
To extract the individual textures from e.g. GUI.pkg, run this command:
deppth2 ex -s GUI.pkg
-s ensures deppth2 extracts each sprite individually, without it, you'll get the full atlas images instead.
Add --include-mip to the extraction command if you also want lower-mip subtextures, or run deppth2 list GUI.pkg if you only need to find a texture key.
Building sprite atlases
In your repository, create a new packages directory next to src and data.
Within this folder, create a new parent folder for each new package you want to ship with your mod (you may want multiple packages for different types of assets for better organization, or if not all textures need to be loaded in the same contexts to save memory).
Your packages must always start with your mod GUID, e.g., packages\SGG_Modding-ModdingTemplate_Portraits_source, here SGG_Modding-ModdingTemplate is the mod GUID.
Anything after the GUID is up to you, typically describing the type of assets contained in the package, such as Portraits for portrait textures.
You may want to suffix the folder name with _source to ensure the source and target folders for the package have different names, so your source folder is not replaced during the packaging process.
You can create additional subfolders within the package as you want, but don't nest them too deeply, as this may cause issues with file paths being too long in some cases.
For this example, assume we place a new portrait texture in the package root, at packages\SGG_Modding-ModdingTemplate_Portraits_source\Portraits_Skelly_01.png.
From packages, run:
deppth2 hpk -c BC7 -s .\SGG_Modding-ModdingTemplate_Portraits_source -t SGG_Modding-ModdingTemplate_Portraits
hpk builds the atlas and packs it in one step.
-c BC7 compresses the textures using the BC7 format to reduce package size, and -s points to the source directory.
-t sets the target basename without .pkg - include your mod GUID here.
deppth2 replaces the target directory if it exists, so keep the input _source folder separate from it.
deppth2 has now created SGG_Modding-ModdingTemplate_Portraits.pkg and SGG_Modding-ModdingTemplate_Portraits.pkg_manifest.
Place both of these files within your data folder following Shipping and loading packages below (recommended path is data\Content\Packages\1080p).
Use the texture key deppth2 logs during the build process when referencing a sprite in your mod.
It contains the package basename and the path relative to the source directory, without the file extension.
For this portrait, that's SGG_Modding-ModdingTemplate_Portraits\Portraits_Skelly_01.
Add --includehulls if you want deppth2 to compute convex outlines for rendering (not required in most cases).
Use --skippack if you only want the intermediate atlas images and manifest JSON. If you already have those files, you can pack them directly:
deppth2 pk -c BC7 -s .\SGG_Modding-ModdingTemplate_Portraits -t SGG_Modding-ModdingTemplate_Portraits.pkg
Building 720p atlas packages
A 720p atlas uses smaller textures to reduce texture memory use, which is very useful for mod users playing on less powerful hardware such as laptops.
Build the normal atlas first and copy its .pkg and .pkg_manifest to data\Content\Packages\1080p.
Do this before the next build, since both 1080p and 720p builds use the same output filenames (and must be named the same).
Then run the same command as before with the addition of the --lowres flag:
deppth2 hpk -c BC7 -s .\SGG_Modding-ModdingTemplate_Portraits_source -t SGG_Modding-ModdingTemplate_Portraits --lowres
--lowres downsamples the textures by a factor of 1.5 while preserving their logical on-screen size, which is similar to how the base game builds its 720p atlases.
Both builds use the same 1080p source folder. Don't use --lowres on input that's already scaled for 720p.
Copy the new output pair to data\Content\Packages\720p (720p packages must live in a 720p parent folder for Hell2Modding to recognize them correctly).
Shipping and loading packages
Within your data folder, create two folder pairs named 1080p and 720p at any nested depth, such as:
data/
`-- Content/
`-- Packages/
|-- 1080p/
| |-- SGG_Modding-ModdingTemplate_Portraits.pkg
| `-- SGG_Modding-ModdingTemplate_Portraits.pkg_manifest
`-- 720p/
|-- SGG_Modding-ModdingTemplate_Portraits.pkg
`-- SGG_Modding-ModdingTemplate_Portraits.pkg_manifest
If you don't ship 720p variants of your packages (we recommend always shipping both variants), you may place the files anywhere within your data folder.
If you do ship 720p packages, they must be placed in a 720p parent folder for Hell2Modding to recognize them correctly.
Next, you must uncomment or add the [[build.copy]] entry in your thunderstore.toml so the build command copies your data folder to the plugins_data folder in the packaged mod:
[[build.copy]]
source = "./data"
target = "./plugins_data"
Hell2Modding discovers packages in plugins_data automatically.
The game still needs to load a package before using its textures.
Pass the package basename without .pkg to LoadPackages wherever your textures are required:
LoadPackages({ Name = "SGG_Modding-ModdingTemplate_Portraits" })
Refer to the portrait replacement mod tutorial for an example use case and where to call LoadPackages.