Blender -> Realm Builder

Exporting custom modules design from Blender to Realm Builder

In addition to the procedures outlined in the Blender -> Godot section for exporting/importing static meshes, modules for the Realm Builder should satisfy additional requirements.

Blender

Module position

  • The pivot point determines the origin of the module within the grid system.

  • The base of the first Occupied cell / Module Area Cell is at the coordinates 0,0,0 and centred on the pivot point.

  • No part of the mesh should be located below the pivot point (-Z Axis in Blender/-Y Axis in Godot).

  • If the module is designed to fit seamlessly against another module, it can be useful to create a wireframe mesh of the two grid systems in Blender since cells cannot be occupied by two modules of the same module class.

  • Prior to exporting the module place the chosen pivot point location of the module at the origin of the Blender coordinate system origin (0,0,0), select the mesh and choose Object -> Apply -> All Transforms

Materials

  • In addition to the requirements for Static Meshes - Materials Realm Builder offers the feature to change materials on the fly. To enable this feature create a new placeholder material and name it base_module_colour or decoration_module_colour .

Object naming

  • In addition to using the object name suffix -col or -colonly to define collision meshes in Blender it is also recommended to incorporate a designation for the module type:

    • B - Base module

    • SB - Side base module

    • CB - Corner base module

    • SMB - Semi base module

    • D - Decoration module

    • SD - Side decoration module

    • CD - Corner decoration module

  • Additional designations to further define the object for example G_Cube_D_1-col based on CategoryName_ModuleName_ModuleType_VariationNumber-CollisionType are recommended.

  • In Blender multiple objects can be renamed simoultaneously by selecting the meshes and Edit -> Batch Rename...

Vertex Count

  • As a rough guide the vertex count for base modules should not exceed 10.000 vertices per 4x4m cell.

  • The appearance of smooth and rounded surfaces can still be achieved with faceted surfaces by selecting the object in Blender and RMB -> Shade Smooth . In this case Object Properties ->Object Data Properties -> Normals -> Auto Smooth should be enabled and the smoothing angle specified.

Modular Design

  • We encourage all builders to incorporate the modular approach into their asset design. Instead of joining the meshes of entire scenes and exporting them as a single module try t

Godot

Node setup - Basic

  • In addition to to the import procedure described in Static Meshes ensure that the mesh instance is set as the root node with RMB -> Make Scene Root .

  • If the collision mesh came as a separate mesh from Blender using -colonly place the static body node directly under the root node.

  • Delete any other remaining nodes.

Materials

  • For each mesh instance there are two locations where materials can be assigned.

  • The first one is in the Inspector panel under Mesh -> Surface . This location should only have spatial materials assigned to it for example .tres files. Any other type of shader assigned to the mesh in this location will crash the builder upon placing the module.

  • The second location is also in the Inspector panel under Material . Any shader assigned to the mesh in this location will override the shader in the first location.

The following section is predominantly for internal use, however it might be useful for community builders to understand the entire process. In addition we are working towards fully automating these procedures to streamline the import/export pipeline and empower our community builders to fully test their creations as quicky as possible.

Update Resources

  • Drag and drop new MODULE_NAME.tscn file into the Modules.tscn node tree.

  • Scene -> Convert To... -> MeshLibrary to update existing mesh library

  • If modules were added to a specific location in the node tree or others deleted/rearranged then during saving delete the existing realm_builder_modules.meshlib and save the new one using the same name. Open realm_builder_modules.tres and drag and drop realm_builder_modules.meshlib into the corresponding slot in the inspector.

  • Open realm_builder_modules.tres and click Update in the Inspector panel and Save.

Cell Evaluation

The Realm Builder is based on Godot's Gridmaps tool. In order to correctly place, select, rotate or move a module we need to define the Module Area Cells and Occupied Cells. Both evaluations are executed within CellEvaluation.tscn .

  • Both evaluations are executed within CellEvaluation.tscn .

  • For regular non-overlapping modules with collisions the Module Area Cells and Occupied Cells are the same.

  • Overlapping modules require a Custom Evaluation to define the occupied cells.

  • Modules without in-game collisions require a Custom collision scene which is assigned to the respective module in realm_builder_modules.tres . It enables object selection inside the builder tool but does not collide with the player during play mode.

  • NOTE: During the cell evaluation process ConcavePolygonShapes are regarded as hollow, whereas primitive shapes such as BoxShapes and ConvexPolygonShapes are regarded as solid. That means if a cell is fully enclosed by a ConcavePolygonShape , it will not register during the scan. Therefore a supplemental area node with a primitive shape must be added to any fully enclosed cell or if possible a ConvexPolygonShape by selecting the source mesh and Batch Collision -> Create Convex Static Body .

  • NOTE: Any module must have an Occupied Cell and a Module Area Cell assigned at its pivot/origin. Furthermore no cell value should be negative. Therefore the pivot position must be taken into account prior to exporting a modules to Godot. These are the most common reasons for modules to not function properly.

Module InstanceEvaluation Type

A. Collision + Non-overlapping

Standard Cell Evaluation

B. Collision + Overlapping

Custom Cell Evaluation

C. No Collision + Non-overlapping

Standard Cell Evaluation + [Custom_collision].tscn

D. No Collision + Overlapping

Custom Cell Evaluation + [Custom_collision].tscn

E. Partial Collision + Overlapping

Custom Cell Evaluation + [Custom_collision].tscn

  • DO NOT TOGGLE Start Evaluation!!! Always ensure that a specific evaluation range has been specified beforehand in Modules List Index or Modules From To Index . Otherwise the evaluation will cycle through the entire meshlibrary and will also overwrite any values which have been edited manually which cannot be undone inside of Godot. However realm_builder_modules.tres which stores the values for occupied cells can be reset in your git client.

Module Area Cells

  • Module Area Cells are essential for selecting modules inside the builder tool. Only areas of a collision mesh with a Module Area Cell assigned to them are selectable.

  • When a user points and clicks on a collision mesh, that particular point in the coordinate system is referenced against all the modules which have a Module Area Cell currently occupying that location.

  • If multiple modules are present in the same location then the more recently placed module will be selected (WIP).

  • With Show Evaluation Individually enabled in the CellEvaluation.tscn inspector the scan will be visually represented inside the editor. This is a useful feature, especially for larger modules and to check that the entire mesh surface is covered. Yellow cells represent an assigned cell and the blue cells an unassigned cell.

  • CellEvaluation.tscn scans for Module Area Cells by detecting CollisionShapes on collision layer 1. If an Area node is used to manually place a CollisionShape you cannot use a ConcavePolygonShape but should use primitive shapes like the BoxShape, CylinderShape...

Evaluated NodesProperties

StaticBody

Collision Layer 1 - default

(in-game collision)

CollisionShape

ConcavePolygonShape, BoxShape...

Area

Collision Layer 1 - default

(NO in-game collision)

CollisionShape

BoxShape...

Occupied Cells

  • Everytime a module is placed it must occupy at least one cell of the Gridmap and only one module can occupy that cell on the Gridmap at a time.

  • Cells of different Gridmaps can overlap, therefore a base module (4x4x4m grid) and a decoration module (1x1x1m grid) can be present at the same location in the coordinate sytem.

  • CellEvaluation.tscn scans for OccupiedCells by detecting CollisionShapes on collision layer 1 or collision layer 4 (custom evaluation). If an Area node is used to manually place a CollisionShape you cannot use a ConcavePolygonShape but should use primitive shapes like the BoxShape, CylinderShape...

Evaluated NodesProperties

StaticBody

Collision Layer 1 - default

(in-game collision)

CollisionShape

ConcavePolygonShape, BoxShape...

Area

Collision Layer 1 - default

(NO in-game collision)

CollisionShape

BoxShape...

or for Custom Evaluation

Area

Collision Layer 4 - occupied_cells_only

(NO in-game collision)

CollisionShape

BoxShape...

Node Setup - Advanced

A. Collision + Non-overlapping

Module NodesProperties

MeshInstance

StaticBody

Collision Layer 1 - default

CollisionShape

ConcavePolygonShape, BoxShape...

(Area

Collision Layer 1 - default

CollisionShape )

BoxShape...

B. Collision + Overlapping

Module NodesProperties

MeshInstance

StaticBody

Collision Layer 1 - default

CollisionShape

ConcavePolygonShape, BoxShape...

(Area

Collision Layer 1 - default

CollisionShape )

BoxShape...

Area

Layer 4 - occupied_cells_only

CollisionShape

BoxShape...

  • Enable Custom Evalution in realm_builder_modules.tres inspector

  • Open CellsEvaluator.tscn, specify range, start evaluation

C. No Collision +Non-overlapping

Module NodesProperties

MeshInstance

Area

Collision Layer 1 - default

CollisionShape

BoxShape...

Custom Collision NodesProperties

Spatial

StaticBody

Collision Layer 5 - ignore_player + CustomCollisionController.gd

CollisionShape

PrimitveShape/ ConvexPolygonShape/ ConcavePolygonShape

  • Rename Spatial to [MeshInstance_NAME]

  • Attach (DragDrop) CustomCollisionController.gd onto StaticBody

  • Set Grid Type in Inspector under Script Variables

  • Attach (DragDrop) custom collision scene to module in realm_builder_modules.tres

  • Open CellsEvaluator.tscn, specify range, start evaluation

D. No Collision + Overlapping

Module NodesProperties

MeshInstance

Area

Collision Layer 1 - default

CollisionShape

BoxShape...

Area

Layer 4 - occupied_cells_only

CollisionShape

BoxShape...

Custom Collision NodesProperties

Spatial

Same name as source MeshInstance

StaticBody

Collision Layer 5 - ignore_player + CustomCollisionController.gd

CollisionShape

PrimitveShape/ ConvexPolygonShape/ ConcavePolygonShape

  • Rename Spatial to [MeshInstance_NAME]

  • Attach (DragDrop) CustomCollisionController.gd onto StaticBody

  • Set Grid Type in Inspector under Script Variables

  • Attach (DragDrop) custom collision scene to module in realm_builder_modules.tres

  • Enable Custom Evalution in realm_builder_modules.tres Inspector

  • Open CellsEvaluator.tscn, specify range, start evaluation

E. Partial Collision + Overlapping

Module NodesProperties

MeshInstance

StaticBody

Collision Layer 1 - default

CollisionShape

PrimitveShape, ConvexPolygonShape, ConcavePolygonShape

Area

Collision Layer 1 - default

CollisionShape

PrimitveShape, ConvexPolygonShape

Area

Layer 4 - occupied_cells_only

CollisionShape

PrimitveShape/ ConvexPolygonShape

Custom Collision NodesProperties

Spatial

StaticBody

Collision Layer 5 - ignore_player + CustomCollisionController.gd

CollisionShape

PrimitveShape, ConvexPolygonShape, ConcavePolygonShape

Last updated