Modding: Is it possible to package a DLC plugin that links to another plugin's code?

I’m trying to achieve a moddable game, where users

  1. have access to a “GameCore” plugin that contains base classes
  2. can create their own plugin “MyGameDLC” with C++ classes and uassets that inherit from those base classes, and
  3. those DLC plugins would be scanned and loaded by the base game, which has no knowledge of the DLC plugins at moment of packaging. Scanning for plugins and their contents is not a worry at this stage. I’m just trying to get more information about the packaging process and wonder if I’m headed in the right direction.

I have a test project that has this setup:
TestGameProject

  • TestGameCore plugin (enabled by default)
  • TestGameDLC plugin (references TestGameCore classes, not enabled)

What’s relevant to note is that I have no problems sharing TestGameProject and TestGameCore with users, private source code will just simply be put in other plugins. What I’m trying to achieve is:
after building TestGameProject with just the TestGameCore plugin enabled, build the TestGameDLC plugin separately and have it dynamically be loaded by the prior. Building TestGameProject with just TestGameCore is obviously no problem. Now, I’m trying to build just TestGameDLC into a pak file, while it has its own source code that utilizes TestGameCore code.

I’m trying to build it with this command:



"D:\UnrealEngine\Engine\Build\BatchFiles\RunUAT" -ScriptsForProject="%CD%\PluginProject.uproject" BuildCookRun -project="%CD%\PluginProject.uproject" -noP4 -clientconfig=Development -nocompileeditor -ue4exe=UE4Editor-Cmd.exe -utf8output -platform=Win64 -build -cook -unversionedcookedcontent -pak -dlcname=TestGameDLC -DLCIncludeEngineContent -basedonreleaseversion=1.0.0 -stage -compressed -compile -CookDir="D:\PluginProject\Plugins\Content\TestGameDLC\Content"


but I’m running into packaging errors indicating that the source code in the plugin isn’t being compiled:



LogLinker: Warning: Can't find file '/Script/TestGameDLC'
  LogUObjectGlobals: Warning: Failed to load '/Script/TestGameDLC': Can't find file '/Script/TestGameDLC'
  LogLinker: Warning: Can't find file for asset '/Script/TestGameDLC' while loading NULL.
  LogUObjectGlobals: Warning: Failed to load '/Script/TestGameDLC': Can't find file for asset '/Script/TestGameDLC' while loading NULL.
  LogLinker: Warning: Can't find file '/Script/TestGameDLC'
  LogUObjectGlobals: Warning: Failed to load '/Script/TestGameDLC': Can't find file '/Script/TestGameDLC'
  LogLinker: Warning: Can't find file for asset '/Script/TestGameDLC' while loading NULL.
  LogUObjectGlobals: Warning: Failed to load '/Script/TestGameDLC': Can't find file for asset '/Script/TestGameDLC' while loading NULL.
  LogLinker: Warning: Can't find file '/Script/TestGameDLC'
  LogUObjectGlobals: Warning: Failed to load '/Script/TestGameDLC': Can't find file '/Script/TestGameDLC'
  LogLinker: Warning: Can't find file for asset '/Script/TestGameDLC' while loading NULL.
  LogUObjectGlobals: Warning: Failed to load '/Script/TestGameDLC': Can't find file for asset '/Script/TestGameDLC' while loading NULL.
  LogLinker: Warning: Can't find file '/Script/TestGameDLC'
  LogUObjectGlobals: Warning: Failed to load '/Script/TestGameDLC': Can't find file '/Script/TestGameDLC'
  LogLinker: Warning: Can't find file for asset '/Script/TestGameDLC' while loading NULL.
  LogUObjectGlobals: Warning: Failed to load '/Script/TestGameDLC': Can't find file for asset '/Script/TestGameDLC' while loading NULL.
  LogLinker: Warning: Unable to load TestDataAssetDLC with outer Package /Game/Data/TestDataAssetDLC because its class does not exist


Am I missing a switch that enables compilation of source code in DLC plugins? Secondly to anyone who has more experience with DLC, and hopefully DLC with code, is this the right general direction?

I don’t have any experience with the DLC system, but my guess would be there’s no direct support for doing this. Problem is UE4 plugins aren’t plugins at all, by the standard definition. They’re just libraries that get conditionally linked in to the exe during packaging.

Obviously they work a bit differently with DLC, but last I asked an Epic dev about this, their module system wasn’t capable of runtime module discovery with a packaged build, so I doubt their packaging process would support anything along these lines.

There’s a somewhat “Asset Bundle” system, but it’s convoluted at best:

https://docs.unrealengine.com/en-US/Engine/Basics/AssetsAndPackages/AssetManagement/index.html

That’s a shame, I knew there would be some hairy edge cases such as when the DLC is built and linked to an outdated or different version of the “core” code base, but if this is simply not supported then I’ll put my experimentation on this topic on hold.

At least we can package DLC with blueprint classes that have blueprint logic, so DLC can add scripting, but the ability to add code would have been amazing.

Robo recall supports c++ mods and the mod editor comes with full source code, may be worth checking out.

1 Like