With Scene Graph, you can quickly transition from greyboxing and world building to a complete playable level in a few simple steps.
Scene Graph is a Verse native system that takes advantage of Verse’s characteristics. This provides a way for you to add more customization to your projects with interactive, custom-built objects, and gameplay experiences.
Scene Graph improves project stability because Verse does all the heavy lifting in the background, ensuring entities work as intended. Verse also has deep access to all parts of the scene entities and components, which means you can add greater variety to your scene.
Enabling Scene Graph in Your Project
To use Scene Graph in your project:
In the Toolbar, choose Project > Project Settings to open the Project Settings window.
In the Project Settings window under Beta Access, enable Scene Graph Tools. Scene Graph is enabled by default in Beta.
To verify that you can view Scene Graph features, in the Toolbar select Place Actors and see Entities in the Place Actors dropdown.
Objects in the Metaverse
The metaverse is an online social entertainment experience in real time, where people play and connect in a 3D world. Epic Games is designing the Scene Graph system for UEFN to empower you to create these metaverse experiences.
In the Scene Graph system, you can instance and reuse objects without Unreal Engine’s Actor classification. At the core of Scene Graph is a set of building blocks that use data and logic to build your game, as well as render and simulate objects in any gaming environment.
Actors and entities are not interchangeable, they are different systems that work together in the scene.
With Scene Graph, you can establish a 3D real-time simulation framework where all design decisions and results are instantly visible in the viewport. These can be edited in the Details panel or the Prefab Editor.
You can import assets that you create or buy from a vendor, like Fab, and use them with Scene Graph to make custom built objects and prefabs.
Anything you build in Scene Graph can be reused many times over, and with less memory. The Scene Graph building system is designed to enable complex content sharing and shared simulations while enforcing boundaries between content.
Entities and Components
Entities and components are the backbone of Scene Graph. They work by controlling the definition and behavior of objects.
Entities are containers for components or other entities. An empty entity will have no visible effects or functionality. Components are what provide data and behavior to an entity. The combination of components added to an entity define what that entity is doing in the scene.
An entity can contain any number of different components. However, only one component of a specific component type can be added to an entity at a time. For example, only one type of light_component can be used on an entity. To use multiple components of a common type you can create new entities to hold each instance of the component.
Some component types are generated by assets created in UEFN. An asset-generated component is a component class that is automatically created based on preexisting content in your project, such as a mesh, sound, or particle system asset. These assets may also expose properties that you can modify on the generated component.
Components have editable properties. These properties can be physical, like a static mesh and particle system, or logical like a gameplay tag or custom Verse code, which defines the movement of a platform. By default, all entities have a Transform Component to specify where the entity exists in the world.
Constructing an entity with Verse does not create a Transform Component automatically.
With Scene Graph, you can quickly put together set pieces and game mechanics by harnessing the physical data from meshes, sound cues, and much more.
An entity becomes the physical representation of a static mesh when you add a Mesh Component to the entity and a mesh is selected in the component’s Mesh slot. This means that you can quickly mock up buildings or individual set pieces and use them right away in your scene.
For example, in the video below, an entity is turned into a cluster of ever green trees.
You can turn this cluster of trees into a prefab on its own or combine it with additional entities to create a forest prefab.
One entity (the simulation entity) sits at the root of your project to represent the simulation. The scene is created when entities are nested under the simulation entity. By adding entities to the map, you are automatically making child entities of the simulation entity.
The top entity of a prefab is the root entity of the prefab with other prefabs and entities nested below. Parent prefabs comprise the look and behavior of their children to interact with other objects in the scene.
Click image to enlarge.
Prefab Root Entity → WoodenHouse_Tiny_Prefab
Child Prefab → WoodenHouse_RoofSmall_Prefab_C_1
Child Entity → Building_WIndowCircle_Bright2
Child Entity → Building_WIndowCircle_Bright4
Child Entity → Building_WIndowCircle_Dark2
Child Entity → Building_WIndowCircle_Dark4
Child Entity → WoodenHouse_Floor
Child Entity → WoodenHouse_RoofCap2
Child Entity → WoodenHouse_RoofCap3
Child Entity → WoodenHouse_RoofWindow2
Child Prefab → WoodenHouse_SmallFloor_Prefab_C_1
Child Entity → WoodenHouse_Floor
Child Entity → WoodenHouse_Wall10
Child Entity → WoodenHouse_WallDoor_C4
Child Prefab → WoodenHouse_Windows_Prefab_C_3
Child Entity → Building_WindowPlane_Bright3
Child Entity → Building_WindowPlane_Bright4
Child Entity → Building_WindowPlane_Dark3
Child Entity → Building_WindowPlane_Dark4
Child Entity → WoodenHouse_Windoows_10
Each child prefab features components that determine what the prefab looks like and how it aligns with other prefabs in the scene. You can use Verse to target specific prefabs and entities to exchange the child prefab for another prefab, or even change the color used for the Building_WindowPlane_Bright and Building_WindowPlane_Dark entities.
There are numerous component types that determine how a part or whole entity acts. To learn more about the different component types available in Scene Graph, refer to Components.
For more information about using entities and components, refer to Working with Entities and Components.
Prefabs
Scene Graph creates prefabs by packaging entities together in an ancestor and descendent relationship. An ancestor is any entity level above other entities, such as parent, grandparent, great-grandparent, and so on. A descendent is an entity level below that of child, grandchild, and so on.
All selected entities, entity hierarchies, and their components are instantly added into this entity tree in the prefab. Once you have a prefab, you can customize all instances of that prefab in the Prefab Editor.
To create an instance of your prefab, drag the prefab out of the Content Browser and into the viewport. You can also nest prefabs inside a prefab hierarchy. You can use the hierarchy to apply the changes made across all instances and prefabs in the hierarchy.
As you update and improve the prefab, you save time because you don’t need to find all instances of that object to update each one individually.
Additionally, you can make a multitude of similar-looking objects by selecting sub-pieces in the hierarchy and overriding different component values. You can also rotate objects and add new component values to different prefab instances as you edit in the Prefab Editor.
The editor marks all changes in the Details panel with an override toggle icon on individual component attributes. It also marks different component icons on the component card dropdown menu button.
To go back to the original prefab design, click on the individual component override toggles. The object automatically returns to the state of the parent Prefab. You can also click the component card dropdown menu button and select Clear Override.
To learn more about modifying prefabs, refer to Prefabs and Prefab Instances.
In the video below, Scene Graph is used to create two castle room prefabs.
The room is duplicated. One element of the room is changed by selecting the floor mesh and replacing the original, which creates a new prefab. You can continue to copy and replace parts to quickly mock up a small castle and even a village. This even works with components, so you can add different behavior to each of the rooms in the castle.
Editing prefabs doesn’t affect the stability and memory of the original object or its copies. This means that you can finish your level layout, abstract design, and art to create custom objects for your island. With the Scene Graph building system, you can reuse the prefabs you create across projects to create your own game universe in Fortnite.
Verse in Scene Graph
Verse is the programming language that Scene Graph uses to spawn and remove entities from the world and create custom components and behaviors.
With Verse, you can create a swinging outdoor lantern for the house in the previous example. Verse provides a way for you to define the properties for swinging, rotation, and duration to determine how the lantern moves.
Prefabs that you create in your project are exposed as a class to Verse in the Assets.digest.verse file of your project. Entities and components defined in your prefab are accessible in Verse through the GetEntities()
and GetComponents()
calls on a prefab.
To get started using Verse in Scene Graph, check out Creating Your Own Component using Verse.
Hands On Experience
The Scene Graph Sample Template introduces you to the basic concepts of working with Scene Graph features, and builds upon these foundational workflows to illustrate the power of creating your project using prefabs and Verse. Each example displays the power of using Scene Graph to iterate on a design to create interesting and functional game objects and gameplay.
Open the Creating a Platformer with Scene Graph to learn more about using Scene Graph to create interesting gameplay.
For more in depth tutorials, look through the available Scene Graph Tutorials.