fabamaq logo
godot game engine at software house game developer coding
Share

Harnessing the Power of Godot: Optimizing Workflow with Custom Tools

Godot, the game engine we've chosen at Fabamaq, boasts numerous advantages over its competitors. It's open-source, free, lightweight, fast, and user-friendly. However, one of its most significant advantages for us lies in its extensibility. In this article, our Gamer Gonçalo Ferreira explores the various possibilities Godot offers for optimizing workflows and creating expert content.

The fact that we can adapt the engine's source code to meet our specific needs and easily create plugins and tools is a game-changer. 

​However, it's not even necessary to go through that trouble, as there are multiple ways to extend, modify, and improve the working environment through various types of plugins that can be written in the supported languages (GDScript, C#, etc.), without the need to modify and recompile the source code.


Godot's Extensibility

Being an open-source project, it allows us to customize the source code to create an engine that caters to both our team's requirements and market demands. Let's find all about it!

Godot's extensibility opens up a world of possibilities for enhancing our workflow. It allows us to create custom tools and plugins, providing a seamless way to improve efficiency without altering or recompiling the source code. Here's some of the possibilities Godot holds for developers:


EditorPlugin - Enhancing the Editor

One of Godot's standout features is EditorPlugin. This type of plugin extends the default Godot editor to provide specific functionalities. With EditorPlugins, we can easily create and add custom windows to the Godot interface. These windows can run internal code or invoke scripts from external tools, making our workflow more efficient.


Example code:

​    # Call an external script that makes the images processing, combines
    # images on an optimized atlas or even turns on the office lights.
    var output = []
    var res = OS.execute("bash", ["./AwsomeScript.sh", param1)], true, output)
    if (res != OK):
                    print("Errors: ", output)
    else:
                    print("Result: ", output)


Editing this interface is equivalent to creating a new Scene with the desired UI and associated scripts, making it quite intuitive for those who are already familiar with Godot.



EditorPlugins are particularly useful for automating repetitive tasks that designers, programmers, and sound designers face daily. This includes:

  • Import specific and/or proprietary file types and convert them into data understandable by the engine,
  • Creating atlases/spritesheets,
  • Managing versioning,
  • Configuring work environments,
  • Authentication processes.

EditorPlugins streamline these processes, either directly in Godot or by making external software calls.


EditorInspectorPlugin - Customizing the Inspector

EditorInspectorPlugins go beyond creating custom windows in the editor. They allow us to customize the inspector for objects within the Scene, referred to as Nodes. This customization is beneficial when we want to add behaviors or interfaces to a group of Nodes without adding specific logic (scripts) to each one, for example:

  • Modify the "position" parameter to always be multiples of 0.5,
  • Add the option for all Nodes with a "Pivot Offset" to center this value,
  • Add a button that opens the documentation for custom Nodes,
  • Implement versioning for a custom Node,
  • Add a callback for the change of a specific data with consequences on another.


Example code:

       extends EditorInspectorPlugin

    # EditorProperty
    var _center_pivot_property = preload("center_pivot_property.gd")

    func can_handle(object):
                # For all Control type Nodes 
                return object is Control

    func parse_property(object, type, path, hint, hint_text, usage):
                # We can find a property and add another before this one 
                # Or replace
                var delete_original_property = false
                if path == "rect_pivot_offset":
                            # Create an instance of a custom property and register it

                # to a specific property path
                            add_property_editor(path, _center_pivot_property.new())
                return delete_original_property


The "tool" Keyword - Real-time Editing

Outside the realm of plugins, Godot offers the "tool" keyword, allowing scripts to run not only in exported games but also within the editor. This feature facilitates the creation of widgets, visualizations, auto-complete features, and Node configurations while the editor is open.

Example code:

    tool # The keyword
    extends Node2D

    func _process(delta):
                # Update the node every frame, if running on the editor
                if (Engine.is_editor_hint()):
                            update()

    func _draw():
                # Updating the node makes it redraw itself, calling _draw
                if (Engine.is_editor_hint()):
                                # Directly draw a circle, or a line, or a pie, or many others
                                draw_circle(position, attack_area, Color.red)


​For example, consider an enemy with an attack area. For visualization purposes, it can be interesting to have a tool script that dynamically draws an area in real-time to identify the attack range. In the resulting game, this area wouldn't be visible as it's defined to run only in the editor. However, for prototyping and level design, this becomes highly beneficial.



​Another useful trick when using tool scripts is to create an exported variable of type bool and, in its set function, perform an action without updating its value. In practice, this creates a button for that Node that can perform various tasks. In the example below, the button could be located in a level manager, and when pressed, it could randomly generate a level, which can then be saved as a fixed scene for later use.​


Example code:

    export var randomize_level = false setget _on_randomize_level

    func _on_randomize_level(value):

    …


Intuitive Parameter Design

Lastly, sometimes the most effective tool is the one you don't need because the parameters are designed intuitively. Godot allows us to export variables to users in a user-friendly way. Instead of thinking purely in mathematical terms, we can create visual, manipulable curves and other descriptive methods for users to configure settings easily. When combined with "tool" scripts, this approach accelerates prototyping and parameterization.



​For instance, when configuring the "bounce" of a ball, we might be tempted to describe the parameters with rigid and mathematical attributes. Alternatively, we can export a manipulable curve to visually achieve the desired result. When combined with tool scripts, this approach can significantly accelerate the prototyping and parameterization process, making it much faster than adjusting non-descriptive values and running the game.


In conclusion...

These are just a few of the many possibilities Godot offers to streamline our work and make game development more efficient for our team and collaborators.

These tools will continue to evolve, ensuring that we can produce games in the most efficient, organized, and scalable manner possible. By harnessing the power of Godot's extensibility, we're taking our expertise to new heights in the world of game development.


Looking for a Career Jackpot? Join Fabamaq now

With over 220 Gamers so far, Fabamaq has several IT jobs in different areas of operation. From mathematics to game development, passing through project management, and software development, there are a lot of job openings to explore. Do not miss out on what could be the jackpot of your career!

Grab a career jackpot and give your life a spin!

Ready to join the game?