Lecture on Modules and Plugins

Jul 16, 2024

Lecture on Modules and Plugins

Introduction

  • Discussion on why to use plugins in Unreal Engine.
  • Need to understand modules to understand plugins.
  • Key Differences:
    • Modules: Encapsulated libraries, single purpose, only contain code.
    • Plugins: Have both content and code (assets, player models, etc.), can include modules.

What is a Module?

  • Standalone piece of code with no dependencies.
  • Good practice for code separation and limiting dependencies.
  • Benefits for large projects:
    • Separate compilation of modules (no need to recompile the whole product).
    • Filter out modules based on platform needs.

Setting Up Modules in Unreal Engine

  • Structure required for a module includes build.cs, ModuleName.h, ModuleName.cpp.
  • Example seen in Unreal Engine’s developer directory with blank module template.

Introduction to Plugins

  • Plugins contain a content and source folder, unlike modules which only contain code.
  • **Purpose of Plugins: ** Decoupling functionality to limit dependencies among components.
  • Categories of plugins in RTS framework:
    • Core plugin: Decouples other plugins, no dependencies on specific plugins like RTS player.
    • Other plugins: RTS entities, RTS AI, RTS teams, default character setup.

Dependencies in Plugins

  • Designed to minimize dependencies between plugins, with Core acting as a common base.
  • For example, RTS entities may depend on Core, while RTS AI should have minimal dependencies so it can be reused in other projects.

Core Plugin Details

  • Core plugin manages base classes (GameMode, GameState, PlayerController, etc.) and interaction interfaces/components for other plugins.
  • Example: RTS player inherits from RTS core, then adds its specific functionalities.

Creating the First Plugin

  • Steps to create plugin in Unreal Engine using the editor and IDE (Rider/Visual Studio).
  • Importance of setting proper build settings (Debug Game) and linking plugin in the project.

Configuring Plugins in a Project

  • Tell project to use the plugin via modifying build.cs in project’s source directory.
  • Relaunch project to reflect changes.

Editor Settings for Plugins

  • Enable “Show Plugin Content” in settings for visibility and management of plugin assets in the editor.
  • Create C++ classes in plugins from the editor.

Tips and Pitfalls

  • Keep individual plugin source directories open and manage class locations carefully to avoid confusion.
  • Ensure proper settings are enabled to access and reference plugin content when needed.

Framework Setup

  • Outline of the framework setup, focusing on decoupling and making classes reusable across projects.

Upcoming Content

  • Subsequent episodes will cover creating plugins with specific classes and functionalities.

Patreon Information

  • Details on Patreon support levels and access to content.
  • Encouragement for support and future goals.