FANDOM


SCENE's (also known as SCENEGRAPHS) are MBIN files used as containers for object references in the game. SCENE files can reference a lot of things - including ENTITIES, EFFECTS, other SCENES, MESHES and so forth. Using SCENE files, you can attach scripts and objects together into one form, like a prefab.

All objects in the game are spawned from SCENE files from plants, ships, and to even your multitool. As you will eventually find out, SCENE files are extremely powerful and can be used for more than just stringing objects together.

For those already used to game development, SCENE files are similar to Unity GameObjects - they are containers that reference models, sounds, scripts, and more.

Scene Nodes Edit

Each SCENE file contains Scene Nodes (TkSceneNodeData) which is a complete data struct that defines the basic structure of a SCENE. These include:

  • Name - the name of the scene file. The root node of the scene file usually bears the directory and the name of the scene itself i.e. a DRONE.SCENE has the name "MODELS\COMMON\ROBOTS\DRONE"
  • Type - the type of scene node. This will influence the attributes declared within in the Attribute container. The types are listed in a category further below.
  • Transform - the vector3 (x, y, z) position, rotation, and scale of an object
  • Attributes - depending on the scene node Type, different fields will be declared here along with their corresponding values. Each attribute has a Name, AltID, and Value. The AltID is usually empty.
  • Children - each scene node can have more scene nodes as children

Scene Node Types Edit

  • MODEL - this scene node type references a GEOMETRY MBIN. Most SCENE files have this as the type used for their root node.
    • GEOMETRY - this one single property simply references a GEOMETRY MBIN file i.e. "MODELS\COMMON\ROBOTS\DRONE.GEOMETRY.MBIN" Geometry files are also serialized XML's containing 3D models for the game.
  • MESH - this scene node explicitly takes mesh data from a root node's referenced GEOMETRY file to be displayed in-game. It is important to note that mesh data is obviously not supposed to be manually written by a human. See the Importing Custom Models page to see how this is done.
    • BATCHSTART
    • BATCHCOUNT
    • VERTSTART
    • VERTEND
    • FIRSTSKINMAT
    • LASTSKINMAT
    • MATERIAL - path to the MATERIAL MBIN this mesh uses.
    • ATTACHMENT - a path to the ENTITY MBIN this mesh uses. ENTITY files are MBIN's that define behaviors or interactions.
  • COLLISION - this node type is responsible for rendering collisions for objects with a wide array of options possible. Much like the MESH node, data here is usually created during the import of custom models.
    • TYPE - collisions can be in the form of meshes, or use more performance-efficient shape primitives provided by the engine
      • Sphere
      • Cylinder
      • Capsule
      • Sphere
      • Mesh collision
  • JOINT - possibly an element of the model's skeletal animation rig?
  • LOCATOR - an empty node that simply holds transform data. These can be used quite heavily by ENTITY files for a number of things such as interactions being placed at specific locations with them as well as things like the location of the scanner icon if your object is scannable or the point from a gun model from which projectiles are shot from.
            <Property value="TkSceneNodeData.xml">
              <Property name="Name" value="LocatorName" />
              <Property name="Type" value="LOCATOR" />
              <Property name="Transform" value="TkTransformData.xml">
                <Property name="TransX" value="0" />
                <Property name="TransY" value="0" />
                <Property name="TransZ" value="0" />
                <Property name="RotX" value="0" />
                <Property name="RotY" value="0" />
                <Property name="RotZ" value="0" />
                <Property name="ScaleX" value="1" />
                <Property name="ScaleY" value="1" />
                <Property name="ScaleZ" value="1" />
              </Property>
              <Property name="Attributes" />
              <Property name="Children" />
            </Property>
  • LIGHT - allows a light source to be attached to the SCENE file.
    • FOV - controls the arc of a light's emission. 90 creates a 90-degree spotlight, while 360 does what a standard pointlight does.
    • FALLOFF - controls how light fades away over distance.
    • INTENSITY
    • COL_R - Red component of the colour. All colours are on a scale from 0 to 1, with 0 being 0 and 1 being 255 in the usual RGB decimal colour convention.
    • COL_G - Green component.
    • COL_B - Blue Component.
    • MATERIAL - always set to MATERIALS/LIGHT.MATERIAL.MBIN
        <Property value="TkSceneNodeData.xml">
          <Property name="Name" value="pointLight1" />
          <Property name="Type" value="LIGHT" />
          <Property name="Transform" value="TkTransformData.xml">
            <Property name="TransX" value="0" />
            <Property name="TransY" value="0" />
            <Property name="TransZ" value="0" />
            <Property name="RotX" value="0" />
            <Property name="RotY" value="0" />
            <Property name="RotZ" value="0" />
            <Property name="ScaleX" value="1" />
            <Property name="ScaleY" value="1" />
            <Property name="ScaleZ" value="1" />
          </Property>
          <Property name="Attributes">
            <Property value="TkSceneNodeAttributeData.xml">
              <Property name="Name" value="FOV" />
              <Property name="AltID" value="" />
              <Property name="Value" value="360.000000" />
            </Property>
            <Property value="TkSceneNodeAttributeData.xml">
              <Property name="Name" value="FALLOFF" />
              <Property name="AltID" value="" />
              <Property name="Value" value="quadratic" />
            </Property>
            <Property value="TkSceneNodeAttributeData.xml">
              <Property name="Name" value="INTENSITY" />
              <Property name="AltID" value="" />
              <Property name="Value" value="83453.234375" />
            </Property>
            <Property value="TkSceneNodeAttributeData.xml">
              <Property name="Name" value="COL_R" />
              <Property name="AltID" value="" />
              <Property name="Value" value="1.000000" />
            </Property>
            <Property value="TkSceneNodeAttributeData.xml">
              <Property name="Name" value="COL_G" />
              <Property name="AltID" value="" />
              <Property name="Value" value="0.301729" />
            </Property>
            <Property value="TkSceneNodeAttributeData.xml">
              <Property name="Name" value="COL_B" />
              <Property name="AltID" value="" />
              <Property name="Value" value="0.000000" />
            </Property>
            <Property value="TkSceneNodeAttributeData.xml">
              <Property name="Name" value="MATERIAL" />
              <Property name="AltID" value="" />
              <Property name="Value" value="MATERIALS/LIGHT.MATERIAL.MBIN" />
            </Property>
          </Property>
          <Property name="Children" />
        </Property>
  • REFERENCE - allows you link another SCENE file into this SCENE file, because you know you like putting SCENE files inside SCENE files. This gives a lot of flexibility, as it allows you to create a custom object and place already existing objects from the game into your scene.

This referenced scene will be procedural if it is able to be (ie. if it has an associated descriptor, and the scene you are referencing it from is being called procedurally). If you want to avoid a scene being called procedurally, you can specify an AltID. This is a list of the names of nodes with space between them to specify exactly what parts you want. The model viewer can export AltID's for objects, so if you load a scene with it, you can set only the parts of the scene you want to be visible and then export the AltID and put this value here to reference that exact scene configuration.

    • SCENEGRAPH - the relative path to the desired SCENE.
        <Property value="TkSceneNodeData.xml">
          <Property name="Name" value="NameForThisNode" />
          <Property name="Type" value="REFERENCE" />
          <Property name="Transform" value="TkTransformData.xml">
            <Property name="TransX" value="0" />
            <Property name="TransY" value="0" />
            <Property name="TransZ" value="0" />
            <Property name="RotX" value="0" />
            <Property name="RotY" value="0" />
            <Property name="RotZ" value="0" />
            <Property name="ScaleX" value="1" />
            <Property name="ScaleY" value="1" />
            <Property name="ScaleZ" value="1" />
          </Property>
          <Property name="Attributes">
            <Property value="TkSceneNodeAttributeData.xml">
              <Property name="Name" value="SCENEGRAPH" />
              <Property name="AltID" value="" />
              <Property name="Value" value="MODELS\WHATEVER\WHATEVER.SCENE.MBIN" />
            </Property>
          </Property>
          <Property name="Children" />
        </Property>