+ All Categories
Home > Documents > Hello, I am Keegan Gibson. Welcome to Creating plugins...

Hello, I am Keegan Gibson. Welcome to Creating plugins...

Date post: 04-May-2018
Category:
Upload: vuthuan
View: 220 times
Download: 3 times
Share this document with a friend
18
Hello, I am Keegan Gibson. Welcome to Creating plugins with Unreal Engine 4. I would also like to introduce Sungin Hong who has taken on the challenge of translating for me. For this talk I have created a little plugin, Which demonstrates adding grid generation and grid navigation systems to Unreal. 1
Transcript

Hello, I am Keegan Gibson.

Welcome to Creating plugins with Unreal Engine 4.

I would also like to introduce Sungin Hong who has taken on the challenge of translating for me.

For this talk I have created a little plugin, Which demonstrates adding grid generation and grid navigation systems to Unreal.

1

In this talk I will be covering:

What plugins are?

Some of the possible things you can do with plugins?

My process of creating the Grid Generation plugin.

The Key Parts of a Plugin

Along with some helpful information to get you started.

2

So what can you do with plugins?

Plugins can be created to expand the unreal engine to introduce functionality independently of a version of the engine or your game.

They can be used to create custom tools within the editor or expand the tools that are there with additional functionality.

Create reusable code across projects

Create and expose new Actors and Uclasses, even new blueprints.

3

Plugins are a self contained set of Modules, meaning they shouldn’t rely on other plugins or modules.

They can contain Code or Content that can do almost anything.

Including art, sounds, blueprints and other content that might be used by the plugin, such as slate brushed for editor buttons etc.

There are 2 main types of plugins

You can create engine plugins, which can be used across multiple projects.

Or Game Plugins which can be used for a single project.

Which can be found in there respective folders.

A plugin can contain multiple modules which can each be used and loaded at different times of your Game / Editor. These modules are defined inside of your .uplugin descriptor.

4

There are 3 types of modules.

Runtime modules which are loaded any time the editor, or standalone game is run, even in shipping builds.

For the grid generation plugin this contains code that is primarily by the game project and but the editor also has access to it so that gameplay settings can be changed.

Editor Modules are loaded when the editor is. It is not loaded when the game is run or in shipping builds.

For the grid generation plugin this contains code the is only used by the editor to generate the grid.

Developer Modules are only loaded in developer builds of the game and editor, and are not loaded in shipping builds.

This could contain debugging information for the plugin you are creating.

4

So what kind of features are we adding to the Engine and our Games in the form of this Grid Navigation Plugin.

In the editor Module:

It will automatically divide up the world into a custom sized grid squares, Would be really cool to add an option for hexagons.

It need to find suitable locations to place the grid and if its possible for one grid node to reach another grid node.

In the Runtime Module

It will Define what a Grid Location in the world actually is.

It will also have a new movement component which could be added to a character, that would allow that character to navigate through the grid.

5

So Im now going to Jump into the Editor and Demonstrate some of the features that I have mentioned.

The most important this is to make sure the plugin is loaded, if its not you’ll need to enable it and restart the editor for it to take effect.

The First small feature I added was a way to Visualise the grid, to see where it was being generated and if it was connecting together correctly.

I’ve added it to the Quick Options Menu, as an easy way to toggle the grid.

The next this we need is the ability to Generate and Regenerate the grid.

So I’ve added them to the build menu here.

So as well build this we get some nice feed back in the form of this notification here with handy cancel button if the grid

6

generation system goes a bit crazy.

And lastly some settings in the project setting menu, which allow you to tweak some of the grid generation systems.

6

So where do you begin to create a new plugin.

My recommendation is to copy and paste one of the sample plugins in the Unreal Engine plugins folder, and rename it to the name of your plugin.

You will need to go through and rename the files, classnames and plugin names throughout so that it does not class with the existing plugins.

Then regenerate your project files so you can edit it nicely inside of visual studio or your preferred IDE.

The Key file for a plugin is the .Uplugin File

Its pretty similar to a .uproject file, and when creating your plugin you should probably treat it like its own project.

7

Plugins have there own lifecycle which comes in the form of these 2 functions.

virtual void StartupModule() OVERRIDE;

virtual void ShutdownModule() OVERRIDE;

The Startup function is called after the plugin has loaded and the shutdown function is called, as you’d expect, when the plugin is shutdown.

If you have copied one of the starter samples you will find these function stubbed and ready for you to add your own custom logic.

8

I’m going no to jump now into Visual Studio, to talk about some of the Key Classes and elements of the Grid Navigation System.

I threw this together in the last week or so, so it might look a bit rough.

Here is the Startup and shutdown functions as mentioned before.

You can also see here how the Menus were extended to add in the additional functionality.

There’s a few other menu extenders so its worth having a look around the codebase.

They each vary slightly on the information the require, but the basic setup is the same.

You can also see here my .uplugins descriptor which outlines the 2 modules.

9

And please note this Key here, CanContainContent

9

This Enables you to add any type of content to your plugin.

This can be really useful for adding debug assets and helper assets to you plugin. As an example the Grid Generation plugin has an icon for use by level designers so they can place down where the start of the grid should be.

You need to create a content folder in your plugin directory and well as the Can Contain Content flag to you .uplugin descriptor.

10

When adding code that needs to be exposed to other modules, include modules inside the same plugin, you need to decide which parts of it should be exposed.

For example the GridNode class, Movement Component Class, and A Star Pathfinding logic need to be exposed for the Game Project to use.

There are 2 Ways to do this.

You can expose The Entire class, including all methods and members by adding the PluginName_API as a prefix before the class, where Plugin Name is the Name of your Plugin

or

By add the Minimal API tag to the class which Exports the Bare minimum information about the object, including type information.

You can then add any functions individual that need to be accessed directly by adding the same PluginName_API.

All you have to do then is statically link against the module

11

from your game code.

11

You can see here how the plugin settings are created, Note it is tagged with globaql config

All you have to do now is register it with the settings system.

Like this.

Make sure to Appropriately clean up after the plugin aswell.

12

Just some last notes from me:

Threading, The Grid generation system doesn’t use any threading, this is something I would like to change in the future. The reasons around this as I use a lot of traces when generating the grid and you cannot really touch the world while in other threads. I feel like there may be a way round this but at the time I didn't find a way to intergrade this in the time frame.

Also you can find some premade plugins on the unreal wiki up there. Aswell as some more ideas about things you can do with plugins.

I hope this has given you some insight into the plugin system, how to get started creating one, and how to begin extending the editor.

Lastly if you have any questions and or comments regard plugins or other unreal stuff feel free to send me an email,

13

you can read me at that address there.

Thank you Sungin, for translating for me.

Thank you all very much for attending the Unreal Summit 2014 Programming Stream.

13


Recommended