The parenting system

GameMaker Studio developers

The parenting system

Welcome to a new tutorial from the DarkSpine series, the parenting system.

In this tutorial we show you how to match objects, with the relatives system we can inherit attributes from our level editor.

SoloStudio Tech Youtube Channel


1.0- Enlazado de objetos

Parenting objects is one of the editor’s star tools. This technique allows us to link objects, being able to share attributes between them, create systems that only affect that group and even transform them relative to the parent.

Selecting the terrain

Linking is very simple, we just have to touch the virtual SET CHILD button located on our main panel in the EDIT mode (orange color).

Now we must select with the RIGHT CLICK who will be the parent object. In this case we opt for the block, since by logic, it will be easy for us to recognize a terrain that represents our mother earth. Where it houses its beings.

Assigning a hierarchy

As you can see in the image above, we will only have more to select who your children will be.

Positioning our mouse on the interactive green circles that represent the descendants, with CLICK LEFT we will add this object to the hierarchy. The color of the interactive circle will go from being green to becoming blue, thus representing a son.

The list of colors to represent hierarchies is as follows:

  • Green circle: It does not belong to any hierarchy. Our object is independent.
  • Orange circle: He is a father in a family. You can control the transformations of your children.
  • Blue circle: He is a son in a family. It can inherit data from the father, and is controlled in motion by it.
  • Orange-Blue Circle: He is the father of one family and the son of another, thus being able to control objects from his hierarchical position and at the same time be controlled by a superior.

1.1 – Transforming objects

Rotating a father

By applying transformation to a father, his children will be transformed in a relative way. We will use this technique a lot to control areas of our level and make graphic adjustments more efficiently and dynamically.

Scaling a family

The children will consider the transfer, the scale and rotation in addition to several graphic options such as color masks. They may even be part of functions customized by the user.


1.2 – Copying hierarchies

Copy/paste of a child

Como vemos en la imagen de arriba, si copiamos un objeto (CONTROL+C o desde nuestro panel virtual) que sea hijo en nuestra jerarquía (imagen de arriba), su duplicado no pertenecerá a ninguna familia.

En cambio, como vemos en la imagen de abajo, si copiamos un objeto Padre, toda su jerarquía será duplicada (CONTROL+V o desde nuestro panel virtual).

Copy/pasting the complete family

Ya sabemos como encadenar familias, pero ahora…¿Podemos enlazar estos grupos? La respuesta no podía ser otra que si, podemos enlazar cuantas jerarquías queramos.


1.3 – Efficiency

Keep in mind one thing, the larger our family to manage, the greater the computing power necessary to manage these groups from our editor. All this depending on what attributes we implement to our objects.

We anticipate that the transformation system is very efficient, you can move easily many objects at the same time without the editor suffers.

Traslating a family

This does not mean that we cannot have several chained lands. The processing power necessary to manipulate several families is the same regardless of its complexity, no matter how many vectors that compose it, the number of triangles and the calculation to generate them again in real time, we only use matrices to transform our objects. The tests done so far are very satisfactory, comparing DarkSpine with other extensions created for the same purpose from other engines, this is much more solvent in the handling of large terrains of this type, allowing to have on screen a larger number of models than the of the competition. In this link you can see the data by executing an HD scenario from a smartphone.

Rotating a family

1.4 – Eliminating hierarchies or part of them

If we remove an object (DELETE / DEL key from our keyboard) father, his children will be orphaned. Removing any parental allowance they had.

Detaching a family

On the other hand, if we want to eliminate the whole family, we must keep the CONTROL key pressed on our keyboard while our object is removed.

Deleting a hierarchy

When we remove a child, it will disappear from the hierarchy … In the event that we delete all the objects in a hierarchy. The parent will become an independent object and the data in our hierarchy will be automatically deleted.

Removing an object from the hierarchy

Recommendation:

We strongly recommend that you view the video located at the beginning of this article to get a clear idea of this section.

The video tutorials provided on the YouTube channel support subtitle contributions from users. This means that any user can contribute to add subtitles with the editor and the new contribution program of YouTube subscribers.


Conclusions:

The new functionalities are always welcome in an editor, and the system of relatives will have to speak, since it is the base a fluid work that provides us with efficiency and great possibilities to create customized systems in our game without the need to create controllers for every feature.

Creating a family of objects

And that is all for now for this section, in future articles we will see in depth other functionalities that we will have at our disposal to squeeze our system of relatives. Greetings and see you in the next article!


You may also like:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.