Skip to content

Building Levels

Matthew LaRocca edited this page Sep 5, 2022 · 12 revisions

Levels are loaded as GLTF files with a specific structure. This instructs the pipeline how to process the level file.

A level is a collection of individual scenes or "chunks" of static data that may be loaded and unloaded individually. These chunks are defined by the scene's object hierarchy. Naturally a level must contain at least one chunk.

Simple level example

This text will reference a simple level built in blender to illustrate basic features of the level pipeline.
image

Setup in Blender

The level itself is represented by the root GLTF node and does not serve any particular purpose. Every child of the root node is treated as an individual scene and will result in a separate asset.

Consider the following hierarchy:
image

The processing of this level would result in 4 individual scenes:

  • Atrium
  • Firewall
  • Hallway
  • LavaPit

Individual Scene Definition

Each individual scene is defined by a collection of "category" nodes describing its contents which must be named in a particular way. Note for the category name, the node only needs to begin with the specified text. For example: Scene and Scene.001 will both be treated the same. This is get around the limitation of nodes not being able to share the same name.

Category name Description Required
Scene Contains all nodes which represent objects in the world. Yes
Colliders Contains custom collision meshes No

Consider an expanded view of the hierarchy above:
image

In examining the image we can see that each chunk contains a Scene node and some contain optional collider nodes.

Scene Nodes

All children of a Scene Node will be represented as fw64Nodes with their transform setup when the level is loaded into the game engine. Nodes with mesh data will automatically have their mesh property set.

Consider the scene nodes of the Lava Pit:
image image

You can see that the scene contains a mix of empty and mesh nodes. During level processing a header file will be generated which will allow you to access specific nodes in code.

Node Properties

There are a few properties which can be placed on nodes. Properties are added using "Custom Properties" in a node's "Object Properties Panel".

Property Name Description
Layers Space separated list of layers to assign this object to. These layers can be used for raycasting or collision related queries
Collider Contains the name of a Collider to use as a custom collision mesh

Consider the properties for the walls of the fire pit:
image

We can see here that this node is part of the walls layer and uses the Lava Pit Walls Collision mesh.

Collision Mesh Nodes

Children of the Colliders node contain meshes that can be used as custom collision object. The transform of collision mesh nodes is ignored during processing so they may be positioned anywhere in the blender scene.

Notes on exporting

When exporting the level from blender, ensure that you have checked Include -> Custom Properties from the export options.
image

Clone this wiki locally