Modding using DLC / Plugins system

I have tried every solution I know of for days now, hope someone can help me out!

My goal: I am creating a base game. Separate .pak files that the game shouldn’t know anything about can be added and loaded on demand (metadata would be included in a separate file). In my case, a pak mod needs to be capable of loading a map which may contain custom assets. Inheriting from the base game’s classes (blueprint) needs to be possible as well.

EDIT:

The problem: The content inside can not be loaded. More info below.


What I tried: The DLC system of the Project Launcher seems perfect for this, but it has only caused trouble so far.
UE4 loads the pak file automatically (shown in the log) if put into the Content/Paks folder, but opening the map contained does not work. (Should this work as it is?)

Mounting the pak file using allowed the map to load, but its content failed to load: DoesPackageExist FAILED: '/PAKNAME/Assets/example' is not a standard unreal filename or a long path name. Reason: Path does not start with a valid root.

Mounting the pak file using did not work at all, the map file was not found when attempted to open.

In all cases, I verified that the pak contained everything using UnrealPak.
I also made sure that all mod plugins were disabled when building the base game.

All was tested in staged development and shipping builds.

EDIT: Using FPackageName::RegisterMountPoint with the dlc’s name results in only the custom content showing, while engine/base game content fails to load with the generic error message ERROR: Couldn't find file for package.


I would greatly appreciate any help. May it be a way to fix the problems I’ve run into, or another method to achieve what I’m trying to accomplish.

EXCLUDE_NONPAK_UE_EXTENSIONS = 0 only seems to change anything when loading uasset files directly. Additionally, it shows that the value only makes a difference when doing a shipping build, but even development builds did not work out for me. :frowning:

The only solution I found so far, although not ideal, is to add placeholder plugins to the project in advance, but not ship any pak files for them until later. The plugin names are stored in the exe, but obviously won’t be loaded until you include any content and ship the pak file.
Of course, this won’t work with a user-based modding system, but if you are planning on adding DLC to your game, it seems viable enough.

Did you ever find a solution for this?
I’m working on a project with similar demands, we were using an old plugin to achieve this until version 4.14. We are trying to update to 4.20 but we are having the exact same problem you are.

In a related post (Mounting pak files at runtime - World Creation - Unreal Engine Forums) they mention that setting EXCLUDE_NONPAK_UE_EXTENSIONS = 0 in IPakPlatformFile.cpp solves the issue and allows for loading lose files, however it requieres recompiling the engine, which is not an option for us right now.

Same issue on our side. We’d love to load mods from an arbitrary PAK file at runtime, and we’ve yet to find any method that allows it.

Same issue.

I’m a newcomer to the unreal engine and also interested in making a game with modding capability. As I understood UE4 enable the modding capability via the plugin system, So I looked into this plugin \UE_4.22\Engine\Plugins\Editor\PluginBrowser and the “PluginManager.cpp”

I think UE4 capable of loading a plugin that is unknown at the build time if you placed it in the “GameFolder/Mods” following code snippet is copied from “PluginManager.cpp”

if (Project != nullptr)
	{
		// Always add the mods from the loose directory without using manifests, because they're not packaged together.
		ReadPluginsInDirectory(FPaths::ProjectModsDir(), EPluginType::Mod, Plugins);

		// If they have a list of additional directories to check, add those plugins too
		for (const FString& Dir : Project->GetAdditionalPluginDirectories())
		{
			ReadPluginsInDirectory(Dir, EPluginType::External, Plugins);
		}

		// Add plugins from FPaths::EnterprisePluginsDir if it exists
		if (FPaths::DirectoryExists(FPaths::EnterprisePluginsDir()))
		{
			ReadPluginsInDirectory(FPaths::EnterprisePluginsDir(), EPluginType::Enterprise, Plugins);
		}
	}

I also tried the manual .pak file mounting which is capable of loading a .pak file from the given location following this repository. It only loaded the assets which are placed in the plugin content folder. but when I placed the .pak file into the “Content/Paks” all assets are loaded correctly. I think it messed up with asset paths stored in Assestregistry.bin when I placed the .pak file other than the “Content/Paks”.

By trying both approaches I realized that Mod Developer should store all its content in Plugin Content folder ( I’m also interested in avoiding this behaviour)

please correct me if I am wrong about UE4 Mod/DLC System I’m Still new to the Framework.