UE4 Using sub-levels for source control management

UE4 Using sub-levels for source control management

Postby BenChang » Sun Oct 25, 2015 8:03 am

One of the biggest problems with source control for complex game engines is that binary data like Levels can't be easily merged. If two people are both editing part of a level, it's very hard to keep their work in sync without overwriting each other's changes. In Unreal this applies to Levels (*.umap), Blueprints, and most other *.uasset files. (In Unity this applies to Scenes and Prefabs but we'll get to that later).

UE4 has a system for partitioning a level into different files which helps with this problem. It was originally designed for streaming parts of very large levels as needed, but it also lets you set up a better workflow for team level editing.

Starting Project
Screen Shot 2015-10-25 at 2.52.45 AM.png

(1.97 MiB) Downloaded 337 times

To start with, I've set up a basic scene. There's a house, some trees, and a few winged skulls flying around (the flying code isn't added yet, this demo is just about the scene layout).


We have 3 team members who are going to work on different parts of the scene, broken up into tasks like this:
  • The house: add some props, materials, and a trigger event when the player walks near it
  • The trees: add more trees, edit them, add some ground foliage
  • The skulls: work on the Blueprint code to make them fly around, work on their placement

So, we're going to split those up into three separate level files which will all be combined together.

Create levels
To create a new level, you can just go to File->New Level, and choose either a completely empty level or one with a floor mesh and lights. But I'm going to create my levels from a different window so that they start off linked with my current level.

For this, open the Levels window: Window->Levels

Screen Shot 2015-10-25 at 3.04.52 AM.png

Create a new level from the popup menu: Levels->Create New...
Screen Shot 2015-10-25 at 3.05.35 AM.png

Name the level Exterior_House.
Screen Shot 2015-10-25 at 3.07.18 AM.png

This will create an empty level file called Exterior_House.umap in your Content directory.

Add Actors to the level

First, make sure the Exterior_House level is set as the current level by double-clicking it, or R-click and choose "Make Current".
Screen Shot 2015-10-25 at 3.11.52 AM.png

In the main editor window, select the House actor, R-click on it in the World Outliner, and select Level->Move Selection to Current Level

Create the levels for the trees and skulls
Screen Shot 2015-10-25 at 3.16.05 AM.png

You can also select actors and create a level with them in it to begin with. Select all the trees, go back to the Levels window, and choose Create New With Existing Actors.
Screen Shot 2015-10-25 at 3.17.37 AM.png

Do the same for the skulls, so you have a Exterior_Trees and Exterior_Skulls level.

Go to File->Save All to save all your levels

[Working with levels

As you're working, you can change the current level you're editing from the Levels window.

When you edit any of the objects in that level, it will only make changes to that level's file. The main level, "Exterior Level.umap", now just has references to Exterior_House, Exterior_Trees, and Exterior_Skulls. Any changes within those levels will be visible when you're editing "Exterior Level", but Exterior Level.umap won't change so you there shouldn't be merge conflicts.

When you add anything to the level, it will be added to the current level. To add more trees, make Exterior_Trees current in the Levels window. Drag more trees from the Content Browser into the Viewport. They'll be added to Exterior_Trees.umap.

Screen Shot 2015-10-25 at 3.25.17 AM.png

You can also edit the levels individually just by double-clicking them in the Content Browser or going to File->Open Level. Note that they won't have lights in them unless you create lights, so they'll look completely black. You can set the view mode to Unlit to edit without needing lights.

Screen Shot 2015-10-25 at 3.29.27 AM.png

To quickly tell which actors are in which sub-level, you can set the color for the level in the Levels window and in the viewport go to Show->Advanced->Level Coloration.

Final project folder
(1.25 MiB) Downloaded 333 times
User avatar
Posts: 176
Joined: Mon Jan 17, 2011 4:48 pm

Re: UE4 Using sub-levels for source control management

Postby BenChang » Mon Oct 26, 2015 2:11 am

One detail I left out from the instructions above: set the "Streaming Method" of the sub-level to "Always Loaded" to make it load immediately on play. Otherwise it will defer loading until explicitly called for through the level's Blueprint. (This is used for very large worlds where you only want to load parts of the world when you actually need them.)
Screen Shot 2015-10-25 at 10.08.08 PM.png
User avatar
Posts: 176
Joined: Mon Jan 17, 2011 4:48 pm

Return to Game Development

Who is online

Users browsing this forum: No registered users and 0 guests