10. Additional Topics – Beginning Unreal Game Development: Foundation for Simple to Complex Games Using Unreal Engine 4

© David Nixon 2020
David NixonBeginning Unreal Game Developmenthttps://doi.org/10.1007/978-1-4842-5639-8_10

10. Additional Topics

David Nixon
(1)
West Palm Beach, FL, USA
 
This chapter will cover some additional topics that didn’t fit into any of the previous chapters. You will learn how to easily pass content from one project to another, where to find content to download, how to import content, and how to package projects.

Migrating Content Between Projects

If you have assets in a project that you would like to use in another, migrating those assets is a simple process. To migrate one or more assets, select them in the Content Browser, then right-click them, go to “Asset Actions” in the menu that appears, then select “Migrate….” To migrate a folder, right-click it and select “Migrate….”
From there, a pop-up will appear allowing you to review all the assets that will be migrated. It’s important to note that if an asset has any dependencies, those assets will be migrated as well, and then if those assets have any dependencies, those will be migrated, and so on. For example, if you wanted to migrate the SM_Chair mesh from the Props folder of the Starter Content, it would migrate all of the assets shown in Figure 10-1. It would migrate the Static Mesh, the Material that the Static Mesh uses, and the Textures that the Material uses.
Figure 10-1
These assets will be migrated when you migrate the SM_Chair mesh
From there, a pop-up will appear allowing you to select the Content folder of the project you wish to migrate the asset(s) to. Once you click “Select Folder,” the migration will begin. The next time you open the project that you migrated the assets to, they will be there, in the Content Browser, ready to use.

Downloading Content from the Epic Games Launcher

This section will show you how to use the Epic Games Launcher to download content to use in the creation of your games. On the Unreal Engine page of the Epic Games Launcher, the Learn tab contains content you can download for free, and the Marketplace tab contains content you can purchase (Figure 10-2).
Figure 10-2
The tabs of the Unreal Engine page in the Epic Games Launcher

Learn Tab

If you go to the Learn tab and scroll down, starting with the Engine Feature Samples category, you will find a lot of content you can use in your games and also sample projects that help to illustrate various concepts and features of the Engine.
For example, the Open World Demo Collection, shown in Figure 10-3, contains various meshes like grass, rocks, bushes, and trees that you can use to make nice-looking outdoor terrains. There are downloads for water, mountains, particle effects, Blueprints, and so on. There’s also projects you can download that demonstrate certain gameplay concepts or even entire sample games. You can click any of the boxes to get more details and to actually download the content, add it to a project, or create a new project out of it (Figure 10-4).
Figure 10-3
Click a box such as this one to learn more information about that content
Figure 10-4
A sample platform game you can download for free from the Learn tab

Marketplace Tab

The Epic Games Marketplace is where you can find assets to purchase. You can get to the Marketplace either by clicking the Marketplace tab in the Epic Games Launcher or by clicking the Marketplace button in the Toolbar of the Level Editor.
The Marketplace is divided into various categories based on the assets provided. For example, you have environments, materials, audio, and so on. You can get to the various categories by hovering over the “Browse” option in the menu, as shown in Figure 10-5. Same as the Learn tab, just click the boxes to learn more about that content or to download it.
Figure 10-5
The Marketplace is subdivided into categories

Vault

When you download something through the Learn tab or the Marketplace, you can access it by clicking the Library tab and going down to the Vault section. If the content is a sample project, you can click the yellow button under its name to create that project (Figure 10-6). If the content is a group of assets, you can click the yellow button to add those folders to the Content Browser of an existing project that you specify.
Figure 10-6
Access content you download through the Vault section of the Library tab

Importing 3D Objects from the Internet

This section will show you a couple more places where you can find free 3D objects to download and how to import those objects into Unreal Engine.

www.​free3d.​com

One great web site to get free 3D models from is www.​free3d.​com . You can use the search box to look for something specific (Figure 10-7), or you can browse by category. Along the top, there is a strip of icons to browse models by file type. Or, along the left-hand side of the page, you can browse models by the types of objects they represent. So if you were looking for grass and tree models, for example, you could click the “Plants” link (Figure 10-8). Then down under the description of the category will be a list of subcategories you can choose from.
Figure 10-7
The search box at www.​free3d.​com
Figure 10-8
Each category will have a description and a list of subcategories
One of the great things about this site is that it is specifically devoted to free 3D objects. There is a section on the right advertising models for a price, but other than that, all the results that appear will be free to download. However, something you need to be aware of that is very important if you’re planning on making games that you charge money for is that just because an asset is free to download, that doesn’t necessarily mean you are free to use it in a commercial game (a game that makes money).
For example, some assets come with a Personal Use Only license. This means you’re allowed to download it, and import it in your projects, and make a game with it; but the only thing you can do with that game is play it yourself or perhaps give it away for free to a few friends. If you started charging money for the game, the person who created the asset would be allowed to sue you for violating the terms of the license.
So if you’re looking for models to use in commercial games, you’ll need to find ones that come with a license for commercial use or a royalty-free license which, unfortunately, are only available on the paid models on this site.
One good thing about this site is that it doesn’t require you to have an account to download. When you’re ready to download an object, simply click the Download button on the objects description page, and it will bring up a list of the available files for download, as shown in Figure 10-9. Often, there will be a .zip or .rar file containing the object in all the different file formats available for that model. Note that the only 3D object type that Unreal Engine can directly import is the .fbx file type.
Figure 10-9
The download button will open a pop-up containing the file formats available
Luckily, most of the web sites you can download 3D objects from have a way for you to narrow down the results to a specific type you’re looking for. For example, on this site, there will be a strip of links showing the different file types available (Figure 10-10), and clicking a type will narrow the results down to only objects that have a version of that type available. So if you click “FBX,” you will only see those objects that are available as an .fbx file.
Figure 10-10
You can filter your results by file format

www.​cgtrader.​com

Another 3D object web site you can use is www.​cgtrader.​com . You can use the search bar (Figure 10-11), or if you want to browse by category, you can go up to the top of the page, hover over “3D models,” and then click the category you’re interested in, as shown in Figure 10-12. From there, you can choose to either browse that category as a whole or click down into one of its subcategories.
Figure 10-11
The search box at www.​cgtrader.​com
Figure 10-12
You can browse the various categories available by clicking the 3D models menu at the top of the home page
By default, you will mainly see listings of the objects for sale, so if you’re only interested in the free objects, you will need to check the “Free” checkbox (Figure 10-13). This will still return paid content, but every other model listed will be a free model. This site has a dropdown you can use to search by file type.
Figure 10-13
Narrow results down by price and/or file format
Just like with the last site, or any site that you download artistic content from, make sure you check the details to see what kind of license agreement it has and what the terms of that agreement are. Unlike the last site, you will need to have an account in order to download from www.cgtrader.com.

Importing .fbx Files

Importing .fbx files into Unreal Engine works pretty much the same as importing any other file. You can either use the Import button in the Content Browser or drag and drop the files into the Content Browser directly.
One difference when importing an .fbx file, however, is that the import is heavily customizable. A pop-up menu will appear giving you a long list of options regarding how you want the object imported, as shown in Figure 10-14. For example, if you want to import the object as a skeletal mesh, you would check the Skeletal Mesh checkbox.
Figure 10-14
The FBX Import Options window
By default, the object will be added to the center of the Level, with it rotated and scaled the same as it was when it was exported, but you can change these settings if you wish. You can also choose if you want the Materials and Textures imported as well, or if you only wish to import the underlying mesh. When all the options are to your liking, you simply need to click the Import button to complete the import. You may get some warning messages if the file wasn’t formatted exactly how the Engine likes it, but often, the import will still work.
One thing you need to be aware of, however, is that, even with the restriction of only being able to import .fbx files, and despite Epic Games’ best efforts, the system is still far from perfect. Most of the time, the mesh itself will import without any problem, but there are still considerable technical issues regarding Materials and Textures importing properly. Because of this, Epic Games actually recommends that all Materials be applied within the Unreal Editor itself, rather than trying to import them in already applied to the mesh.

Packaging

Packaging is the process that prepares your game to run on a specific platform. There are several steps in the packaging process. First, any C++ source code specific to that project will be compiled. Next, all of the project’s assets, like Meshes, Materials, Audio, and so on, are converted into a format that can be read by the target platform, a process known as cooking. Finally, the compiled code and cooked assets are bundled together into a package of files that can be used to run or install the game on the target platform.

Selecting a Default Map

Before your game is packaged, you need to ensure that it has a default map selected. The default map is the Level that will be loaded when the game first starts. Without a default map, nothing will get loaded and you will only see black when the game runs.
To set the default map, first go to Edit ➤ Project Settings, then click the “Maps & Modes” link on the left-hand side. Under the Default Maps category, you can set the default map with the Game Default Map property (Figure 10-15).
Figure 10-15
Setting the default map

Packaging the Game

When you’re ready to package your game, you can do so by going to File ➤ Package Project and then selecting the platform you want to target (Figure 10-16). You will then be prompted to choose a folder to save the packaged project to. Once you have chosen a folder, click “Select Folder” and the packaging will begin immediately.
Figure 10-16
Selecting the target platform
The packaging will run in the background, and you will still be able to use the Editor. In the bottom-right corner of the screen will be a small window that will display the progress of the packaging. This window will also have a Cancel button to cancel the packaging process and a Show Log link to view the output log of the process.

Advanced Packaging Settings

Unreal Engine has some advanced settings you can configure for the packaging process (Figure 10-17). To get to these settings, go to either Edit ➤ Project Settings ➤ Packaging or File ➤ Package Project ➤ Packaging Settings.
Figure 10-17
Advanced packaging settings
Under the Project category, the first property is Build. With this property, you can tell the Editor under which circumstances it should build the project as part of the packaging process. In most cases, you can just use the default setting.
The next property is Build Configuration. If you’re wanting to debug your game, and you have a code-based project, meaning you are using C++ code, you would want to set the Build Configuration to DebugGame. If you’re wanting to debug your game, and are only using Blueprints, and not any C++ code, you would want to set this to Development. Also, for both of these scenarios, you need to set Include Debug Files to True. If you’re wanting to package your game for distribution to end users, you would want to set this to Shipping. Finally, the options ending in “Client” are used for online multiplayer games.
The Staging Directory is just the target directory where the packaged project is saved to. This is the same directory that you are asked to select when you start the packaging process.
The Full Rebuild property specifies whether all of the code should be compiled or just the code that has been modified since the last build. If you are doing a Shipping build, you should set this property to True.
If you are targeting the Android or iOS platform, you need to package your game for distribution. You can do this by setting the For Distribution property to True.

Pak Files

Down in the Packaging category, there is a property called Use Pak File . A .pak file is a file containing all of the assets of your game. If Use Pak File is set to False, the assets will all be individual files, but if it is True, then all assets will be combined into a single .pak file.
If you are packaging a game to be distributed to the public, and you are using a .pak file, you will want to add some security to that file. You can do this by clicking the “Crypto” link on the left-hand side of the Project Settings. Here, you can choose to encrypt and/or sign your .pak file (Figure 10-18).
Figure 10-18
Encryption and signing settings
In the Encryption category, you can generate encryption keys and select which files you want encrypted. In the Signing category, you can generate signing keys and choose whether or not you want your .pak file signed.
Back on the Packaging page of Project Settings, if you expand the Packaging category to view the advanced properties, you will see a property called Create compressed cooked packages. If you set this property to True, it will compress your .pak file. Whether or not you should compress your .pak file is largely dependent on the target platform.
If you are targeting the Xbox One, you should always compress your .pak file as this will always improve the loading times. If you are targeting the Nintendo Switch, you need to test compression for each title, as it will result in faster load times for some games and slower load times for others. For the PS4 and Oculus platforms, you should never compress your .pak file. The PS4 already uses compression, and the Oculus cannot process a compressed .pak file. For Steam, compressed .pak files will result in less space being needed on the end user’s device, but longer download times when patching, and it is thus a matter of personal preference.

Summary

In this chapter, you learned how to migrate assets between projects, where to find additional content to use in your projects, how to import that content, and how to package projects. You have now learned all the theory you need to begin creating simple games using Unreal Engine 4! This theory will also provide you with a solid foundation for learning more advanced topics. In the next chapter, you will go through a series of tutorials to apply all the theory you have learned thus far, in order to create an actual game.