Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Plug-ins & Third-Party SDKs in UE4

3,853 views

Published on

Overview of the basics of modules, plug-ins and projects in UE4, and a deep dive into integrating third-party dependencies. Presented at MIGS 2016 in Montreal.

Published in: Software
  • Be the first to comment

Plug-ins & Third-Party SDKs in UE4

  1. 1. Plug-ins & Third-Party SDKs in UE4 Yes, there will be funny cats, too Gerke Max Preussner max.preussner@epicgames.com @gmpreussner
  2. 2. Funny cat videos have been removed to keep these slides at a reasonable download size. You can find those videos (and many more) at https://www.reddit.com/r/thecatdimension/
  3. 3. The Basics Modules Plug-ins Projects Modules Overview •Two methods to implement features in UE4: Blueprint & C++ •Most projects use a combination of both •All C++ code resides in modules •Modules bundle type declarations and implementations •Each module has a particular purpose or responsibility •Most modules are generic and reusable •UE4 ships with hundred of modules •Can be compiled into DLLs or static libs
  4. 4. The Basics Modules Plug-ins Projects Module Types •Developer – for development only •Editor – for Unreal Editor only •Runtime – for anything •Programs – for standalone programs •Third Party – for external code & libs Note: The UE4 EULA prohibits inclusion of Editor modules in shipping games
  5. 5. The Basics Modules Plug-ins Projects Structure of Modules •Private folder • Internal implementation • Module initialization • Pre-compiled header •Public folder • Interfaces • Exported Types •Build.cs file https://github.com/ue4plugins/NdiMedia
  6. 6. The Basics Modules Plug-ins Projects Structure of Modules •Private folder • Internal implementation • Module initialization • Pre-compiled header •Public folder • Interfaces • Exported Types •Build.cs file https://github.com/ue4plugins/NdiMedia
  7. 7. The Basics Modules Plug-ins Projects Structure of Modules •Private folder • Internal implementation • Module initialization • Pre-compiled header •Public folder • Interfaces • Exported Types •Build.cs file https://github.com/ue4plugins/NdiMedia
  8. 8. The Basics Modules Plug-ins Projects Module initialization
  9. 9. The Basics Modules Plug-ins Projects Module initialization
  10. 10. The Basics Modules Plug-ins Projects Structure of Modules •Private folder • Internal implementation • Module initialization • Pre-compiled header •Public folder • Interfaces • Exported Types •Build.cs file https://github.com/ue4plugins/NdiMedia
  11. 11. The Basics Modules Plug-ins Projects Pre-compiled Headers
  12. 12. The Basics Modules Plug-ins Projects Pre-compiled Headers
  13. 13. The Basics Modules Plug-ins Projects Pre-compiled Headers
  14. 14. The Basics Modules Plug-ins Projects Structure of Modules •Private folder • Internal implementation • Module initialization • Pre-compiled header •Public folder • Interfaces • Exported Types •Build.cs file https://github.com/ue4plugins/NdiMedia
  15. 15. The Basics Modules Plug-ins Projects Structure of Modules •Private folder • Internal implementation • Module initialization • Pre-compiled header •Public folder • Interfaces • Exported Types •Build.cs file https://github.com/ue4plugins/NdiMedia
  16. 16. https://github.com/ue4plugins/NdiMedia Structure of Modules The Basics Modules Plug-ins Projects
  17. 17. The Basics Modules Plug-ins Projects Structure of Modules •Private folder • Internal implementation • Module initialization • Pre-compiled header •Public folder • Interfaces • Exported Types •Build rules https://github.com/ue4plugins/NdiMedia
  18. 18. The Basics Modules Plug-ins Projects Build Rules
  19. 19. The Basics Modules Plug-ins Projects Build Rules
  20. 20. The Basics Modules Plug-ins Projects PrivateIncludePaths •Sub-folders inside your module’s Private folder PublicIncludePaths •Sub-folders inside your module’s Public folder (not needed) PrivateIncludePathModuleNames •Modules whose public headers your module’s private implementation includes, but doesn’t link to PublicIncludePathModuleNames •Modules whose public headers your module’s public interface includes, but doesn’t link to
  21. 21. The Basics Modules Plug-ins Projects PrivateDependencyModuleNames •Modules that your module’s private implementation requires for compiling and linking PublicDependencyModuleNames •Modules that your module’s public interface requires for compiling and linking DynamicallyLoadedModuleNames •Modules that are loaded at run-time via ModuleManager (this is to ensure that they get compiled) More options in RulesCompiler.cs
  22. 22. 1 2 3
  23. 23. The Basics Modules Plug-ins Projects Structure of Plug-ins •One or more modules •Plug-in descriptor •Content (optional) •Resources (optional) Configuration files for plug-ins are not yet supported, so any settings should be stored in Engine or project INI files (set default values in constructors) https://github.com/ue4plugins/NdiMedia
  24. 24. The Basics Modules Plug-ins Projects Structure of Plug-ins •One or more modules •Plug-in descriptor •Content (optional) •Resources (optional) https://github.com/ue4plugins/NdiMedia
  25. 25. The Basics Modules Plug-ins Projects Structure of Plug-ins •One or more modules •Plug-in descriptor •Content (optional) •Resources (optional) https://github.com/ue4plugins/NdiMedia
  26. 26. The Basics Modules Plug-ins Projects Plug-in Descriptor •Json file {PluginName.uplugin} •Inside root of plug-in directory •Contains: • Version information • User friendly description • Module loading rules https://github.com/ue4plugins/NdiMedia
  27. 27. The Basics Modules Plug-ins Projects Plug-in Descriptor
  28. 28. The Basics Modules Plug-ins Projects Plug-in Descriptor
  29. 29. The Basics Modules Plug-ins Projects Plug-in Descriptor
  30. 30. The Basics Modules Plug-ins Projects Plug-in Descriptor
  31. 31. The Basics Modules Plug-ins Projects Plug-in Descriptor 1
  32. 32. The Basics Modules Plug-ins Projects Plug-in Descriptor 1
  33. 33. The Basics Modules Plug-ins Projects Plug-in Descriptor 1
  34. 34. The Basics Modules Plug-ins Projects Plug-in Descriptor 1
  35. 35. The Basics Structure of Projects •Configuration files •Content (optional) •Plug-ins (optional) •Modules (optional) •Target Rules •Project descriptor Modules Plug-ins Projects
  36. 36. The Basics Modules Plug-ins Projects Project Descriptor
  37. 37. The Basics Modules Plug-ins Projects Project Generation •UBT searches entire solution for *.Build.cs files •GenerateProjectFiles.bat invokes UBT to generate Visual Studio solution files containing all modules
  38. 38. The Basics Modules Plug-ins Projects Project Compilation •Visual Studio invokes UBT to... • find all *.Build.cs files • compile and instantiate them • create a module dependency graph • generate compiler and linker settings • compile all C++ modules •A module is compiled if it is... • a dependency of another module • required by an enabled plug-in, or the project itself
  39. 39. Third-Party Libraries Engine Plug-ins UPL Platforms Distribution
  40. 40. Third-Party Libraries Engine Plug-ins UPL Platforms Distribution Structure of Engine Dependencies •Located in /Engine/Source/ThirdParty •Each has its own Build.cs file • Just like any other module • Public includes (for headers to be compiled into dependent modules) • Public libraries (for libraries to be linked into dependent modules) • Optional pre-processor definitions
  41. 41. Third-Party Libraries Engine Plug-ins UPL Platforms Distribution Building Engine Dependencies •Source code is often included, but… • We provide pre-compiled libs for everything • UBT never compiles them when building your projects •Internally, we pre-compile the libraries using… • BuildThirdPartyLibs UAT script (automated) • Batch files and shell scripts (manual) • Specialized UAT scripts (i.e. for PhysX) •Sometimes there are text files with instructions
  42. 42. Third-Party Libraries Engine Plug-ins Platforms UPL Distribution More Build Rules
  43. 43. Third-Party Libraries PublicLibraryPaths •Paths to folders containing additional libraries PublicAdditionalLibraries •Additional libraries (.lib or .a files) to link against PublicFrameworks •Additional XCode frameworks (iOS, macOS only) PublicWeakFrameworks •Weak frameworks (for OS transition) Engine Plug-ins Platforms UPL Distribution
  44. 44. Third-Party Libraries PublicAdditionalShadowFiles •Files that need to be copied for remote compilation RuntimeDependencies •Runtime dependencies to be staged for a packaged build Engine Plug-ins Platforms UPL Distribution
  45. 45. Third-Party Libraries Engine Plug-ins Platforms UPL Distribution Structure of Plug-in Dependencies •Same as Engine third-party dependencies •Same build rules
  46. 46. Third-Party Libraries Engine Plug-ins Platforms UPL Distribution Linux: Building libs that require STL •Use our bundled libc++ (offers most independence, because then your plug-in works wherever UE4 works) •Modules built within UE4 are automatically linked with libc++ •We support CentOS 7 and newer (4.14) and CentOS 6 (4.13) •We don’t target any particular version of Ubuntu •Most other Linux versions should also be covered
  47. 47. Third-Party Libraries Engine Plug-ins Platforms UPL Distribution Linux: Locating Libs at Runtime • On macOS we update RPATH via RuntimeDependencies •On Linux you have to hack LinuxToolchain.cs  •Or use FPlatformProcess::GetDllHandle •At some point we will fix this On Linux we always use weak symbol resolution by default!
  48. 48. Third-Party Libraries Engine Plug-ins Platforms UPL Distribution Android • One lib subfolder per architecture • You list all of them in the Build.cs • Tool chain filters out unused architectures
  49. 49. Third-Party Libraries Engine Plug-ins UPL Platforms Distribution Unreal Plug-in Language • Used to be Android Plug-in Language (APL) • XML based scripting system for building UE4 plug-ins • Interpreter implemented in UnrealPluginLanguage.cs •Can be used for iOS as well (for modifying Plists) •Other platforms not implemented yet •Often used for: • Staging additional files • Stripping out files • Injecting Java code
  50. 50. GearVR_APL.xml
  51. 51. GearVR_APL.xml
  52. 52. GearVR_APL.xml
  53. 53. GearVR_APL.xml
  54. 54. GearVR_APL.xml
  55. 55. GearVR_APL.xml
  56. 56. GearVR_APL.xml
  57. 57. Third-Party Libraries Engine Plug-ins Platforms UPL Distribution Marketplace Submissions •http://publish.unrealengine.com/welcome Our current web form sucks a little, so we’ll communicate with you over email, too.
  58. 58. Third-Party Libraries Engine Plug-ins Platforms UPL Distribution Submission Audit •Plug-in / project descriptor files must be complete •Payment information must be correct •Automated test builds for all platforms & versions •Basic code review & light runtime testing •Virus scan We don’t enforce UE4 coding guidelines, but we look for common bad practices that may break in the future.
  59. 59. Third-Party Libraries Engine Plug-ins Platforms UPL Distribution Third-party Libs (permissive license) •Can be included with submission •Must provide web links to library origin •Must include license copies Third-party Libs (non-permissive license) •Must be a separate download from the vendor •Must include instructions on how to install
  60. 60. Third-Party Libraries Engine Plug-ins Platforms UPL Distribution What else? •Plug-ins will be installed in /Engine/Plugins •We include pre-compiled binaries for all supported platforms •We include source code, so they can be used in custom UE4 • You can put your secret sauce into static libraries •You must resubmit for every new UE4 version
  61. 61. Case Studies LogiLed VlcMedia GearVR https://github.com/ue4plugins/LogiLed
  62. 62. Case Studies LogiLed VlcMedia GearVR
  63. 63. Case Studies LogiLed VlcMedia GearVR
  64. 64. Case Studies LogiLed VlcMedia GearVR https://github.com/ue4plugins/VlcMedia
  65. 65. VlcMedia.Build.cs
  66. 66. Vlc.cpp
  67. 67. Vlc.cpp
  68. 68. Case Studies LogiLed VlcMedia GearVR GearVR_APL.xml
  69. 69. Case Studies LogiLed VlcMedia GearVR Java Code Injection via UPL GearVR_APL.xml
  70. 70. Case Studies LogiLed VlcMedia GearVR GameActivity.java
  71. 71. Case Studies UEDeployAndroid.cs
  72. 72. Questions? Documentation, Tutorials and Help at: • Answer Hub: • Documentation: • Forums: • Issue Tracker: • Wiki: • UE4 Road Map • YouTube Tutorials: • Community Discord: • Community IRC: https://answers.unrealengine.com https://docs.unrealengine.com https://forums.unrealengine.com https://issues.unrealengine.com https://wiki.unrealengine.com https://trello.com/b/gHooNW9I/ue4-roadmap https://www.youtube.com/user/UnrealDevelopmentKit http://unrealslackers.org #unrealengine on FreeNode

×