Asset Management - Database, Packages, and Local Files
Loading Assets
Database
BeardLib can load Assets for your level in different ways. Currently the standard is to load assets from database, also known as DB Loading. BeardLib handles this process automatically when spawning a unit and there is next to no other step required.
However you can also manually load assets with the Load From Database option.
Package
The old method was Package loading. When spawning a Unit, you had to load a package containing said Unit. The downside is that a package also contains lots of other units, taking up memory. In some cases like sound effects or voice lines you may still need to load some, just remember to pick the smallest available packages.
You can load packages with the Load With Packages option.
Local Files / Extract
The third method is Local Files, or extract loading. This means the Unit’s files are actually present inside your Map’s assets folder.
It was used in combination with Package loading to reduce the memory usage of a heist. The downside is that since the files had to be extracted, the space the Map folder takes on your harddrive went up the more Units you load this way, resulting in longer download times. These days Local files are only really used for custom assets.
While extract loading has been removed from the editor entirely, and there isn't really a reason to have do it anymore, you can still include the files into your project with the following method:
Use the Load From Database option, but with the "With Options" toggle on.
After picking your asset in the list you now get the option to include the files in your project.
Dependencies
Some Units are dependent on other assets, like Effects, and those sometimes don’t get loaded properly. In this case you need to manually load them.
You can see the dependencies of a unit by extracting its .unit file using Diesel Bundle Viewer, opening the file in a text editor and checking for a <dependencies>
tag.
Those assets need to be loaded for the unit to work, otherwise the game might crash.
Assets Manager
You can manage your loaded assets and packages from the Assets Manager in the Main-Tab. There you can see a list of every package and a list of every Asset currently loaded in your level.
You have several options on the right side of the screen:
Remove And Unload Unused Assets Will unload all assets that are loaded but not used anywhere. For example a unit that isn't actually spawned in the level.
This sometimes also unloads important assets such as dependencies for units, to prevent this from happening you can tag assets as Used.
They will show up in the list with a green background and will not be unloaded with the Unload Unused Assets button.
Package Report Will let you select any package from the game. When selecting it, all units from the package will be spawned into your level.
Scan Assets Directory Will scan through your project's assets folder and add all files to the add.xml.
Clean Add Xml will clean up your level's add.xml by removing duplicate entries.
Unused Assets
Assets that are loaded but not used are marked in Yellow. While building your level those can stack up really fast, since just clicking on a unit in the spawn list will already load it. Before releasing your map you should make sure to unload all units that are not used and not needed to reduce memory usage.
Unloaded Assets
Assets marked in Red are assets that are spawned in your level despite not being loaded.
Usually BeardLib automatically loads missing assets when opening your level and notifies you about them.
You can easily fix these with by either loading a package that's containing them, loading them directly from database ot just remove them from your level.
add.xml
The add.xml tells BeardLib what assets are needed when loading into your level. It’s unique for every level and can be found in *Your Project*/levels/*your level*/add.xml
.
Assets loaded in-editor will be added here automatically, but you can always edit it manually using a text editor.
Memory Usage
PAYDAY 2 has a theoretical limit of about 3.5GB (3500MB), but usually you’re gonna crash at around 3200-3300MB. To keep your used memory as low as possible, you should load as few packages as possible and unload unused assets. Additionally assets that are only used inside your level, such as voicelines, interactions or hooks, should only be loaded while in your level. You can see how much memory your level is using with the -qa launch property.
No Comments