Defold 1.12.0 BETA

:warning: Breaking changes :warning:

Fixed update + update order

Note: If you don’t use fixed_update() you don’t need to do anything.

This release we did a bug fix and moved the fixed_update() before update() in the game update loop. This means it now uses the same update flow as in Unity, and it also helps us keep our componentes (e.g. physics objects) synchronized.
So please pay attention to your game logic, if it needs changing.

JDK 25

For those of you using bob.jar, we have now updated to Java JDK 25, so you need to use that from now on.

Disclaimer

This is a BETA release, and it might have issues that could potentially be disruptive for you and your teams workflow. Use with caution. Use of source control for your projects is strongly recommended.

Access to the beta

Download the editor or bob.jar from GitHub: Release v1.12.0 - beta · defold/defold · GitHub

Defold 1.12.0

Summary

  • BREAKING CHANGE: (#11491) Rearrange component’s update (by ekharkunov)
  • NEW: (#11386) Added new camera functions for converting between world and screen coordinates. (by AGulev)
  • NEW: (#8309) Added engine throttle performance Lua api (by JCash)
  • NEW: (#9981) Add sys.get_config_boolean() (by appsoluut)
  • NEW: (#10948) Added support for .astc texture format in gui.new_texture() (by JCash)
  • NEW: (#7277) Introduce late_update script function (by ekharkunov)
  • NEW: (#8763) Added sound group mute functionality to C++ dmSDK (by deurell)
  • NEW: (#9844) Added support for text shaping (by JCash)
  • NEW: (#11184) WelcomeScreen: Enter keybinding to open selected project (by JosephFerano)
  • NEW: (#11334) Check ENV and validate DM_SERVICE_PORT (by JosephFerano)
  • NEW: (#3868) Save and Restore open tabs (by JosephFerano)
  • NEW: (#10999) Build runtime-generated fonts from the editor (by matgis)
  • NEW: (#11508) Improve Model rendering performance in Scene View (by matgis)
  • FIX: (#10971) New sound backend for iOS and macOS: AVAudio (by AGulev)
  • FIX: (#11416) Make sure ASTC used in maximum possible cases in HTML5 bundle (by AGulev)
  • FIX: (#10312) Fixed Crash when using raycasts under certain conditions (by DarkRavenStar)
  • FIX: (#11464) Add astc encoding context destruction to deallocate memory (by JCash)
  • FIX: (#9917) Fix frustrum culling for sprites with pivot point (by ekharkunov)
  • FIX: (#11519) ASTC encoder fixes (by AGulev)
  • FIX: (#11419) Added Microsoft Xbox Series S|X Controller for Linux (by paweljarosz)
  • FIX: (#11379) Allow typing tilde (~) on Swedish keyboard layout (by vlaaad)
  • FIX: (#11377) Repaint up to last visible minimap row (by JosephFerano)
  • FIX: (#10891) Update Java version to 25 (by vlaaad)
  • FIX: (#11400) Show errors from exceptions thrown during tile source texture layout (by matgis)
  • FIX: (#11166) Produce user-friendly build errors from invalid Tile Sources (by matgis)
  • FIX: (#11452) Fix exceptions from removed nodes when getting overridden properties (by matgis)
  • FIX: (#11457) Localize resource type labels (by vlaaad)
  • FIX: (#11465) Localize form views (by vlaaad)
  • FIX: (#11462) Fix editor exception when double-clicking on a Build Error from a resource with an empty Outline (by matgis)
  • FIX: (#11487) Localize editor scripts and bundle dialogs (by vlaaad)
  • FIX: (#11461) Fix outline re-ordering (by vlaaad)
  • FIX: (extender#802) Update JDK to 25 (Docker image only) (by ekharkunov)
  • FIX: (extender#801) Fix extension build errors when PodSpec has more than 2 level of subspecs (by ekharkunov)
  • FIX: (extender#806) Rework health report collection (by ekharkunov)

Engine

BREAKING CHANGE: (#11491) ‘Rearrange component’s update’ by ekharkunov
:warning: :warning: :warning: Possible breaking change :warning: :warning: :warning:

  • FixedUpdate moved before regular Update. It means that all transform’s changes introduced by physics components will be applied before execution of regular component’s Update.
  • Order of lua callbacks update(self) and fixed_update(self) stays the same as it was before.

NEW: (#11386) 'Added new camera functions for converting between world and screen coordinates. ’ by AGulev
Adds three camera-space conversion helpers to the Lua camera module:

  • camera.world_to_screen(world_pos, [camera])
  • camera.screen_xy_to_world(x, y, [camera])
  • camera.screen_to_world(pos, [camera])
-- Place objects at the touch point.
function on_input(self, action_id, action)
    if action_id == hash("touch") then
        if action.pressed then
            local world_position = camera.screen_xy_to_world(action.screen_x, action.screen_y)
            go.set_position(world_position, "/go1")
        end
    end
end
-- Place objects at the touch point with a random Z position, keeping them within the visible view zone.
function on_input(self, action_id, action)
    if action_id == hash("touch") then
        if action.pressed then
            local percpective_camera = msg.url("#perspective_camera")
            local random_z = math.random(camera.get_near_z(percpective_camera) + 0.01, camera.get_far_z(percpective_camera) - 0.01)
            local world_position = camera.screen_to_world(vmath.vector3(action.screen_x, action.screen_y, random_z), percpective_camera)
            go.set_position(world_position, "/go1")
        end
    end
end
-- Convert go position into screen position
go.update_world_transform("/go1")
local world_pos = go.get_world_position("/go1")
local screen_pos = camera.world_to_screen(world_pos)

NEW: (#8309) ‘Added engine throttle performance Lua api’ by JCash
This api allows the developer to skip engine updates altogether, except input detection.

  • No update or rendering will occur once the engine is throttled
  • Any input will wake up the engine again
  • The engine will be throttled again after the cooldown period

Api:

sys.set_engine_throttle(false) -- No throttling, full engine updates + rendering (default)
sys.set_engine_throttle(true, 1.0) -- Throttling with a cooldown. Engine will wake up for 1 second after each input
sys.set_engine_throttle(true, 0.0) -- Throttling with a cooldown. Engine will wake up for 1 frame after each input.

NEW: (#9981) ‘Add sys.get_config_boolean()’ by appsoluut
Allow to get the config parameter as a boolean in Lua. Converts only 1 and 0 to their boolean counterparts.

NEW: (#10948) ‘Added support for .astc texture format in gui.new_texture()’ by JCash
This allows for using compressed textures in gui.

There are some restrictions on the input .astc file:

  • Format should be RGBA
  • The flip parameter is not supported, so make sure texture is already flipped

Example:

local path = "/assets/images/logo_4x4.astc"
local buffer = sys.load_resource(path)
local n = gui.new_box_node(pos, vmath.vector3(size, size, 0))
gui.new_texture(path, 0, 0, "astc", buffer, false)
gui.set_texture(n, path)

NEW: (#7277) ‘Introduce late_update script function’ by ekharkunov
New script function late_update(self, dt) was introduced. That function runs after regular update(self, dt) function. All in-games messages are dispacthed in between update(self, dt) and late_update(self, dt). You can safely update game object’s transforms in late_update(self, dt) because components will update inner transforms after script execution.

NEW: (#8763) ‘Added sound group mute functionality to C++ dmSDK’ by deurell
Add functionality to mute sound groups from extensions.

NEW: (#9844) ‘Added support for text shaping’ by JCash
Added support for

  • Text shaping
  • Font Collections

Deprecated support for the extension-font native extension.
Most that code has moved into the core engine, along with major improvements to the workflow.

We added the Lua script functions:

  • font.add_font(font_hash, ttf_hash) – associate .ttf font with .fontc
  • font.remove_font(font_hash, ttf_hash)
  • font.prewarm_text(font_hash, text, callback) – generate necessary glyphs before rendering.
  • font.get_info(font_hash) - print info about the .fontc

Text shaping

This feature adds support for unicode text shaping at runtime.
For instance proper pair kernings, ligatures and right-to-left text.

The overhead of the extra engine code is around 22%, which means ca 178kb size increase on Wasm target (brotli compressed). That should be compared to the prerasterized font textures in our ligacy system, and the new system where it includes the raw .ttf fonts.
We feel that this is an acceptable cost to pay, for the return value of getting better support for different languages.

Prewarming glyph cache

As the text layout system considers the internal glyph indices of a font, it is no longer sufficient to specify a list of code points to use for prewarming the glyph texture cache.
Instead, add an example text is currently recommended

Asynchronous

On systems that support threading, the glyph image generation is handled on a worker thread.
Due to this fact, and the fact that the font resource glyph cache may not yet contain your needed glyphs, we also added helper functions to prewarm the font glyph cache.

The helper has a callback function, which is useful to let you know when the glyphs have landed in the cache, and it’s safe to show the text on screen.

local font_hash = hash("/assets/fonts/roboto.fontc")
font.prewarm_text(font_hash, "Some text")

Font Collections

To help with localization, we added support to our font resources to associate multiple .ttf files with a single font resource. It allows for easier memory management. E.g. only load the language fonts you need.

local font_hash = hash("/assets/fonts/roboto.fontc")
local ttf_hash = hash("/assets/fonts/Roboto/Roboto-Bold.ttf")
font.add_font(font_hash, ttf_hash)

How to use in your project

You need to…

  • set the font.runtime_generation = 1 in game.project to use .ttf fonts at runtime.
  • use an app manifest, selecting the “Font Layout” feature.

FIX: (#10971) ‘New sound backend for iOS and macOS: AVAudio’ by AGulev
This new backend replaces the deprecated OpenAL backend on iOS and macOS.

FIX: (#11416) ‘Make sure ASTC used in maximum possible cases in HTML5 bundle’ by AGulev
Because of a Chromium-side issue, Defold uses a workaround that disables ASTC compression when the issue is detected, falling back to ETC2 - which offers lower visual quality.

This update narrows the fallback to ETC2 so it only applies to paged atlases in affected cases.
As a result, single-paged atlases now use ASTC for maximum texture quality, while multi-paged atlases remain visible even on devices impacted by the Chromium problem.

FIX: (#10312) ‘Fixed Crash when using raycasts under certain conditions’ by DarkRavenStar
This fixes a crash when the length of a 2D or 3D raycast is zero.
This fix specifically takes into account the case when the ray length becomes zero after applying the physics.scale setting in game.project.

FIX: (#11464) ‘Add astc encoding context destruction to deallocate memory’ by JCash
Added memory fix when using ASTC texture compression. It previously leaked memory after each compressed image.

FIX: (#9917) 'Fix frustrum culling for sprites with pivot point ’ by ekharkunov
Fixed culling for sprites with pivot points. Also implemented some optimization on how geometry data calculated and stored between batches. So now it should be a bit faster in terms of calculation but consume some memory to store cached information.

FIX: (#11519) ‘ASTC encoder fixes’ by AGulev

  • Updated the ASTC encoder to version 5.3.0
  • Enabled the release flag to ensure full performance
  • Fixed the ASTC 4x4 RGB build

FIX: (#11419) ‘Added Microsoft Xbox Series S|X Controller for Linux’ by paweljarosz
Added gamepad mapping for the Microsoft Xbox Series S|X controller for Linux to the built-in default.gamepads.

Editor

NEW: (#11184) ‘WelcomeScreen: Enter keybinding to open selected project’ by JosephFerano
Currently pressing ENTER in the welcome screen to select a project doesn’t do anything. This PR adds the ENTER keybinding so it opens the currently selected project.

NEW: (#11334) ‘Check ENV and validate DM_SERVICE_PORT’ by JosephFerano
Editor used to ignore DM_SERVICE_PORT and always use a dynamic port. Now the editor can read the port when the environment variable supplied.

NEW: (#3868) ‘Save and Restore open tabs’ by JosephFerano
Currently, when a user has open tabs and assigned to different panes, when they close the editor, they are all closed out and require opening them up again. This PR will restore all previous open tabs, in the correct order, and in the proper splits.

NEW: (#10999) ‘Build runtime-generated fonts from the editor’ by matgis
The editor now respects the font.runtime_generation setting in game.project. Previously only Bob would produce runtime-generated fonts when this setting was enabled for the project.

NEW: (#11508) ‘Improve Model rendering performance in Scene View’ by matgis
The editor responsiveness in scenes that feature Models has been drastically improved, especially when per-instance vertex attributes are involved.

Partially adresses #9817.

FIX: (#11379) ‘Allow typing tilde (~) on Swedish keyboard layout’ by vlaaad
Now it’s possible to enter the tilde character (~) when using the Swedish keyboard layout by pressing ⌥ ^ followed by space or another character.

FIX: (#11377) ‘Repaint up to last visible minimap row’ by JosephFerano
The minimap in the code editor wasn’t syntax highlighting all the lines visible in larger files. Now the minimap will have syntax colors all the way through.

FIX: (#10891) ‘Update Java version to 25’ by vlaaad
Defold Java version is updated to 25 (from 21). If you are only using the editor, you don’t need to do anything, but if you use bob.jar (e.g., in a CI pipeline), you’ll need to update Java from 21 to 25.

The update gives us a small, but noticeable performance and memory use improvement:

  • memory usage when opening a big project decreased by 5% (7.4Gb → 7Gb)
  • time to open a big project decreased by 17% (4m34s → 3m47s)
  • time to build a big project decreased by 10% (8m18s → 7m20s)

FIX: (#11400) ‘Show errors from exceptions thrown during tile source texture layout’ by matgis

FIX: (#11166) ‘Produce user-friendly build errors from invalid Tile Sources’ by matgis

  • All invalid properties in Tile Sources now generate clickable build errors.
  • Highlight Tile Source Animations with invalid properties in the Outline View.
  • Render errors in the Scene View will now report the source file when the error originates from a substructure node.
  • Fixed Exception in the editor when setting the Tile Source Tile Margin to a negative value.
  • Tile Source Tile Width and Height must be positive.
  • The error tooltip for the Sprite Default Animation field now refers to the correct Image property label.

FIX: (#11452) ‘Fix exceptions from removed nodes when getting overridden properties’ by matgis

FIX: (#11457) ‘Localize resource type labels’ by vlaaad

FIX: (#11465) ‘Localize form views’ by vlaaad

FIX: (#11462) 'Fix editor exception when double-clicking on a Build Error from a resource with an empty Outline ’ by matgis

  • Fixed exception in the editor if the user double-clicked a Build Error originating from a resource whose Outline view was empty after opened.
  • Fixed empty Outline view for Tile Sources whose tile count couldn’t be determined as a result of invalid property values. This was a regression introduced by #11442.

FIX: (#11487) ‘Localize editor scripts and bundle dialogs’ by vlaaad

FIX: (#11461) ‘Fix outline re-ordering’ by vlaaad
We introduced a regression in 1.11.2 during the outline refactor that made re-ordering behavior erratic. Now the issue is fixed.

Other

FIX: (extender#802) ‘Update JDK to 25 (Docker image only)’ by ekharkunov
The base Docker image has been updated to use JDK 25

FIX: (extender#801) ‘Fix extension build errors when PodSpec has more than 2 level of subspecs’ by ekharkunov
This change fixes issues when building extensions with certain Cocopod dependencies, for instance Appmetrica.

FIX: (extender#806) ‘Rework health report collection’ by ekharkunov
Improved how the data for the build server status page is collected.

22 Likes

Many thanks for this! :folded_hands: :fire:

7 Likes
local font_hash = hash("/assets/fonts/lilita.fontс")
local ttf_hash = hash("/assets/fonts/Lilita One Regular.ttf")
font.add_font(font_hash, ttf_hash)

get error: Failed to get font /assets/fonts/lilita.fontс: -3

Do you have this font used somewhere? On a label or in gui? The resource should be linked in the project somewhere so you can use it like that.

Yes, of course, this font is used in both gui and label.

But I get it. It should be called where it is used.:sweat_smile:

I also have a test project here (on a branch) to look at.

2 Likes

Amazing! And so many other great quality of life improvements. Brilliant.

Could the team clarify the details of this breaking change? If I’m using fixed updates, what do I need to change? What was the old update order and what will the new one be?

I read the GitHub issue but it also doesn’t directly explain the before state and the after state.

This comment from the announcement is particularly confusing to me, since it seems to contradict the core change announced:

Order of lua callbacks update(self) and fixed_update(self) stays the same as it was before.

I’m not of the team but this is how I understand it:

FixedUpdate moved before regular Update.

Means the order is FixedUpdateUpdate when it was the opposite, before; so: UpdateFixedUpdate.

Order of lua callbacks update(self) and fixed_update(self) stays the same as it was before.

I think this just means the actual code you see in the scripts files (visual order); The function fixed_update(self, dt)is below the function update(self, dt)in the script files.

1 Like

This version features excellently localized interfaces and provides a positive user experience. At the same time, we suggest adding a new feature: an option in the “Preferences - Code” section of the Defold editor that allows users to control support for Unicode characters in Lua encoding. We hope the development team will consider this proposal.

First of all, when we mention Update/FixedUpdate, we are talking about functions that affect the internal state of components. When we mention update(self, dt)/fixed_update(self, dt), we are talking about functions inside Lua scripts.

So the main changes is order of internal component update. For example, physics components update their transforms and game object’s transforms in FixedUpdate. Before changes if you have game object with physics component and, for example, model or sprite - non-physics components use game object’s transform for their internal calculation which can be changed later in the current frame, because physics made calculation after (old order is UpdateFixedUpdate). Now if physics affects somehow game object’s transform all other component will use correct game object’s transform.

From your point of view it shouldn’t affect your game in any way only if you don’t have any custom components in C++ or any kind of logic based on assumption that physics components updates their state after all other components.

4 Likes

Are you talking of this feature request? Request for Full UTF-8 Support in Game Engine · Issue #11086 · defold/defold · GitHub

Yes, it is recommended to fully support Unicode characters, including in paths and variable names in Lua.

Thanks for clarifying!

From your point of view it shouldn’t affect your game in any way only if you don’t have any custom components in C++ or any kind of logic based on assumption that physics components updates their state after all other components.

One of the reasons I wanted clarity is, I have a deterministic physics system that uses a graph and update counters to - in part - work around the old behavior of the engine. I may be able to simplify it now.

Since so much of building non-buggy frame-by-frame behavior in defold depends on really understanding the update lifecycle, I hope the final version of this release will also update and perhaps even improve these docs:

3 Likes

Yes we are working on update life cycle docs

1 Like

Thanks! The late update function is much appreciated. I noticed the linter complains about the function not being a standard global variable.