C++ as DLC?

So I like to do 99% of my project in C++ and I was starting to think about how I would add new guns, abilities, etc as DLC content where I could publish a new gun at runtime without the user having to restart their game.

Is it possible to ship c++ classes as dlc, say through the chunk downloader in a pak file?
Are there other ways to ship c++ as dlc?

I really just don’t want to have to use blueprints and make all my dlc be spaghetti.

u can load a dll file, but I don’t think it will work properly, since the game must recognize the additional functions.
Why don’t just lock the ability behind the DLC?

No, most/all platforms expect your code to be a monolith. This means that any code changes require you to actually patch your game instead of just downloading a new dll. You can get around this with blueprint logic (as you pointed out) or by integrating another asset based scripting language like lua into your build and workflows.

But all’s that really means is that you have to patch in support for new types/features but the content itself (blueprints and other assets) could be in a separate pak files that are downloaded and loaded up by your game.

There’s also the new-ish (4.27+) Game Features system that lets you build plugins that are dependent on your game which allows you to write dlc/update code as if it were a separate dll without it actually being shipped as one. You can each enable and disable them at runtime! The code is still a monolith, but the plugin structure allows you to prevent the types of references you’d want to avoid. Features are still a work in progress so there are some gotcha’s like the fact that subsystems from Features still get instanced even if the feature is disabled.

Interesting I’m kinda doing the opposite approach of making plugins that my game depends on, so a lot of systems in my game are split out into plugins and don’t know about the content of the game

Yeah, you’re describing “standard” plugins and they absolutely have a place in organizing your code and project. But they do have limitations that the Game Feature plugins are trying to fill. And for content, Feature plugins seem to be the better fit right now.

One of those limitations involves how easy or difficult it is to make pak files for a plugin that you could ship independently as DLC. In the most recent 5.3 update I’ve seen some movement on support to make that easier for Feature plugins (it was already possible before if you hand rolled it). I’ve never heard of anyone making plugin pakfiles and shipping those. But it doesn’t mean it hasn’t happened.

Im a little bit confused if you could explain further, so a Game Feature plugin means that it depends on your PRIMARY_GAME_MODULE, while normal plugins cant, but its still in the same dll? Is this purely an organizational benefit or are there any unique features of a Game Feature plugin?
Right now I have two modules inside my project: GameCore and GameContent where core has all the base classes and under the hood stuff and GameContent has my derived weapons, abilities, etc. Is my GameContent module sort of what the Game Feature plugin does? and is there any benefit to moving this to the Game Feature plugin?
Thank you for your responses, super helpful!

It depends on what you’re building.
When you’re building the Editor, all the modules build their own dll’s. It doesn’t matter if the module is from a plugin, the engine, your game or game features.
When you’re building a non-editor version of your game everything is statically linked together into a single exe. There are no dlls (at least not from Unreal, but that’s not important).

Correct.

More or less. The only difference is that the GameCore module would probably be your PRIMARY_GAME_MODULE.

As mentioned before they allow for some easier ways to package your game in smaller chunks. It wasn’t impossible before but it could be less obvious what those smaller chunks were supposed to be or to manage references that crossed chunks.
There multiple systems dedicated to allowing you to turn these game features on & off at runtime and have that interact with the asset system in ways that are really useful.
But mostly it allows you to build things that are game specific and wouldn’t be transferred to another game (they’re not trying to import Mario Kart features directly into a Mario platformer) in a way similar to plugins for similar reasons.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.