Intended plugin workflow?

Howzit everyone :). I have been struggling to wrap my head around unreal’s module and plugin systems, so I figured it was about time I seek some assistance. Forgive me if this is not the most appropriate place for these questions.

Over the past few months I’ve been developing my own framework which I intend to use as a common set of generic tools and classes to help speed up the development of content. At first it was just a single project/module, and I thought I’d be able to import this module into other projects (I am no longer sure if this is actually possible?). I then discovered plugins which seemed the more appropriate route to take for this particular use case since I want to share the framework between multiple projects. I have just completed converting my framework into a plugin and have got it running successfully within a dedicated plugin project running UE 4.22.

The plugin is still work in progress, however it is fleshed out enough to start prototyping games with it. So I’m wanting to setup a fresh game project and use my plugin in this project. However because the plugin is still work in progress and I’ll be updating it as I expose its shortcomings, I’m hesitant to install it as an engine plugin (and consequently reinstalling it each time I make an update). So my main question here is if it is possible to share a project plugin between multiple projects, and if so how do I achieve this? Or is it only possible to share a plugin between multiple projects if it is installed to the engine?

Another kind of unrelated question that I thought I’d throw in here is with regards to the importance of the Private / Public project structure. Most guides seem to suggest putting all .h files in the Public sub-directory, and all corresponding .cpp’s in the Private folder. I have not followed this structure for my own framework because I like to keep my .h and .cpp files together. It hasn’t seemed to cause any issues so far, but is this perhaps something that will bite me further down the line?

Sorry for the very verbose explanation :o, here’s the TL;DR version

  1. In terms of projects, plugins and modules, what is the intended unreal workflow when it comes to developing a common game library, and consuming this library for multiple games?
  2. Is it possible to import a project module into another project, if so how?
  3. Is it possible to import a project plugin into another project, if so how?
  4. Is the Private / Public project source separation strictly necessary?

I don’t have a “this is the right way to do it” answer, but the one that I came up with quickly that worked for me, is that i have one project where i actually do work on the project directly, which has the plugin in a git repository. In my project where I’m using that plugin, I have that git repo checked out as a submodule. Then whenever I make changes in the plugin development project, i commit them to the repo, then i git pull in the plugin directory in the project.

Public / Private isn’t strictly necessary at all, but in the case of plugins using a Public / Private setup has two potential advantages:

  • Other modules and plugins can choose to only include your Public headers, which saves compilation time as the source files will be ignored
  • You can set up a closed source plugin workflow where you precompile the plugin, delete the Private folder and just distribute the plugin as Intermediate files and the Public header files
    As far as I can tell those are the only differences, would like to know more about this as well.

The intended workflow to reuse code among multiple projects is to make plugins. You basically listed the two ways to do that already which are:

  • Treat it as an engine plugin by placing it in /UE4 install dir/Engine/Plugins
  • Treat it as a game plugin by placing it in /Game project dir/Plugins. In this case you’ll have the plugin in multiple places on your hard drive and you’re responsible for keeping each folder in sync with version control.

Both approaches have advantages and disadvantages. In my experience they are:

  • Placing a plugin in Engine/Plugins has the advantage that the plugin will be accessible by any game project on your PC, while the files are only in one place. However, if you’re working in a team, every team member will need to have the plugin in their engine folder as well and keep it updated, meaning multiple file locations to keep track of with version control. Also, if you make a change to the plugin for one game, it could break other games and it can be inconvenient to have to address that right away.
  • Placing a plugin in game project’s Plugins basically avoids the drawbacks of the above, at the cost of having to track the same plugin in multiple folders and avoid creating conflicts.

Unfortunately there is no perfect solution that solves all as far as I know, so it depends on which drawbacks you’re okay with. Personally, I place plugins in each game project’s Plugin folder because I don’t like breaking other projects while making plugin updates for one project. But I track the plugin folders with a git repo and I usually do plugin work from one project alone.

Do you use the binary version of the engine or do you compile it from source? If from source, I wouldn’t think treating your plugin as an engine plugin causes much overhead? if you have to precompile it for the binary release every time before you can use it in a game project, I can imagine it is inconvenient though.