Defold 1.9.0 has been released

Defold 1.9.0

Defold version 1.9.0 is now available as a stable release. Please read on for technical notes and a full list of changes. Enjoy!

Migration to glfw3 for macOS

This version of Defold will use glfw3 for macOS. This is the first step in an effort to move all platforms from glfw2 to glfw3. Migrating to glfw3 will eventually solve a lot of platform specific problems related to window management, application lifecycle, input management etc but there is a risk that problems are discovered along the way. One such problem that was discovered late in the beta for 1.9.0 was that the update frequency on macOS is 120hz despite vsync being enabled (Defold 1.9.0 BETA - #13 by AarrrBee).

Compute program support

We have also released general compute program support as a technical preview. Please refer to the Compute Program manual to learn more: Defold compute manual

Lua language server integration

It is also worth pointing out that the Lua language server is now fully integrated with the editor. If you previously used the LSP as an extension, please make sure to remove it from your project dependencies. Some users have reported that linting sometimes takes a long time and slows down builds. You can disable lint on build from the editor preferences.

Summary

  • BREAKING CHANGE: (#7889) Added initial C support to configfile.h, extension.h and resource.h
  • NEW: (#8935) Frustrum culling for tilemap
  • NEW: (#8912) Vulkan readpixels support
  • NEW: (#29) Spine Clipping Feature Support
  • NEW: (#8667) dmSDK: Added possibility to load collection proxies and spawn factories from C++
  • NEW: (#8932) Make the ASCII character set optional in fonts
  • NEW: (#8348) Migrate OSX to GLFW3+
  • NEW: (#9021) Add option to build script that generates compile_commands.json file(s)
  • NEW: (#9047) Change sprite image by sampler hash
  • NEW: (#9049) Updated to Xcode 15.4, iOS SDK 17.5 and macOS SDK 14.5
  • NEW: (#9060) Concat errors when creating shaders in runtime
  • NEW: (#8975) Compute shader support part 3
  • NEW: (#8983) Fixed the order of layers in the dropdown menu
  • NEW: (#8973) Added ability to rotate and flip the brush when painting in tilemap.
  • NEW: (#8914) Bundle lua language server into the editor
  • NEW: (#8986) Allow adding multiple components at once
  • NEW: (#9031) Add child-seqs to outline nodes for copy+paste handling
  • NEW: (#9059) Allow disabling globals linting
  • NEW: (#9055) Add imperative editor script API
  • FIX: (#376) Unescape gcc defines before use
  • FIX: (#380) Improved Info.plist merge handling
  • FIX: (#8871) Support tangent space handedness
  • FIX: (#8987) Fixed the issue where the Tilemap was not using flip and rotate attributes for physics
  • FIX: (#8945) Use resource pointers all the way for GUI textures
  • FIX: (#8972) Fix crash in GUI when atlas changes texture resource internally
  • FIX: (#8918) Fixed triggers and back button for controllers on macOS
  • FIX: (#26) AdQuality SDK
  • FIX: (#382) Include shared objects from an .aar file into Android builds
  • FIX: (#8956) Added Android bundler option to extract native libs on install
  • FIX: (#8994) Fixed APK installation on device after bundling.
  • FIX: (#9015) Update Android SDK to version 34.0.0 and targetSdkVersion to 34
  • FIX: (#9028) Fix issues with physics.set_shape() for Sphere shape
  • FIX: (#9029) Fix issue whenPrivacyInfo.xcprivacy end up in wrong directory in macOS bundle
  • FIX: (#9002) Multi-touch improvements for Android devices
  • FIX: (#9062) Delete dynamic attributes from sprites when deleting the instance
  • FIX: (#8951) Make sure user uses only one shape type in a Collision Object
  • FIX: (#9026) Ensure build targets from embedded objects inside editable resources fuse with equivalents from non-editable resources
  • FIX: (#8980) Added the ability to select a tile region in the palette map as a brush
  • FIX: (#8984) Fixed the issue where “Frame Selection” (F) doesn’t work on multipage atlas.
  • FIX: (#8934) Bring back update download progress
  • FIX: (#8963) Sanitize project folder name in the Welcome dialog.
  • FIX: (#8958) Improve suggested completions
  • FIX: (#8959) Don’t suggest completion popup unnecessarily
  • FIX: (#9022) Refactor editor scripts runtime
  • FIX: (#9042) Make sure that recursion is impossible when pasting a folder into its subfolders.
  • FIX: (#9030) Show an error if the wrong script type is used

Engine

BREAKING CHANGE: (#7889) Added initial C support to configfile.h, extension.h and resource.h
We’ve added some first pure C api headers to our dmSDK: configfile.h, extension.h and resource.h.
This is a step in our current effort to add C# support to our engine.

:warning:
The old C++ api’s should be mostly intact, however we did change passing some structs as pointers (previously passed as references).

Also, due to limitations of typedef’ing enums, we generate some C++ enums from the C equivalents. Casting between them is safe.

While stricly a breaking change for extension developers, we don’t anticipate many developers having to do any changes to their extensions.

New extension releases:

We have updated some extensions that use the new api’s:

Migration:

For a full list of migration notes, see the PR

dmsdk/dlib/configfile.h

This file now contains both the the C and C++ api.

dmsdk/extension/extension.h

This file now contains both the the C and C++ api.

  • May need to cast from C++ enum to C enum
  • May need to cast to correct callback type

dmsdk/resource/resource.h

This file now contains both the the C and C++ api.

  • We’ve updated the resource system to use pointers to structs in the public callbacks.
  • We’ve moved some structs into opaque handles

NEW: (#8935) Frustrum culling for tilemap
Tilemaps are now included when doing frustum culling in render.draw(). Tilemaps are divided into 32x32 tile regions and culling is applied per region, not individual tiles.

NEW: (#8912) Vulkan readpixels support
The vulkan render adapter can now read the framebuffer into a pixel buffer. This is currently only used in recorder extension(s), but the functionality might be available in a user facing api at some point.

NEW: (#29) Spine Clipping Feature Support
Add support for clipping in spine extension.

NEW: (#8667) dmSDK: Added possibility to load collection proxies and spawn factories from C++
This update adds more functionality to our C++ sdk, which is part of our effort to allow a developer to write the game logic using C++.
It is an ongoing task, and we’ll add more functionality along the way.

NEW: (#8932) Make the ASCII character set optional in fonts
The Extra Characters field has been deprecated and replaced with a new field called Characters. This new field combines the default ASCII with any previously defined Extra Characters. Using this new field, developers can specify exactly which symbols the font should include, e.g. numbers only, etc.

NEW: (#8348) Migrate OSX to GLFW3+
We have removed our old modified GLFW version on OSX in favour of the latest publicly released GLFW 3.4 version. This will enable us to improve our desktop feature set, as well as help fix many legacy OS issues across the board. When we consider that this work is stable enough on OSX, the rest of the desktop platforms will get updated as well.

NEW: (#9021) Add option to build script that generates compile_commands.json file(s)
Adds a new --generate-compile-commands option to build.py that generates compile_commands.json files per engine lib/sub project and concatenates them into one “global” json that is written to the root.

Before (using ECC, but without compile_commands.json):


After:


NEW: (#9047) Change sprite image by sampler hash
Scripts can now change a sprite image by using a sampler hash:
go.set("#sprite", "image", self.my_atlas_mask, { key = sampler_name })

Or get the atlas from a specific sampler:
go.get("#sprite", "image", { key = sampler_name })

For example, this sprite is using a material that has two samplers, tex0 and tex1:

To change the second atlas, pass “tex1” in as the key in the go.set call:
go.set("/go1#sprite", "image", my_tex1_atlas, { key = "tex1" })

To retrieve the atlas of the sampler, call:
local my_tex1_atlas = go.get("/go1#sprite", "image", { key = "tex1" })

NEW: (#9049) Updated to Xcode 15.4, iOS SDK 17.5 and macOS SDK 14.5

NEW: (#9060) Concat errors when creating shaders in runtime
Shader errors now include the name of the shader and a concatenated error string when the graphics driver is unable to create it.

NEW: (#8975) Compute shader support part 3
We have released a technical preview of the next iteration of the compute shader support in Defold. Compute shaders are a general purpose shader program that can be used for any type of game related tasks on the GPU. Although you can use it for rendering as well, compute shaders are typically used for things like updating rigged animation, particle systems, ray marching and so on.

A compute program is similar to a Material - you can specify constants and samplers in the resource itself, as well as use certain render api functions to bind textures and constants. However, there is no logical connection to a game object, everything related to a compute program happens in a render script and there is no editor preview.

Please note!
since we consider this to be a a technical preview, things might change between versions in case we need to make significant changes to the source formats and engine functionality. Please help us improve this feature by testing it out and report any bugs you might encounter!

FIX: (#376) Unescape gcc defines before use
The GCC_PREPROCESSOR_DEFINITIONS of a Podspec may contain escaped strings. These need to be unescaped before use. Example:

FIX: (#380) Improved Info.plist merge handling
This change improves how <array> entries are merged. An array key can now specify a keep merge strategy, to keep existing values as-is and add new values to the array. If the array has the merge merge strategy (the default), any values in the array will be merged (more specifically <dict> values).

Example with the default merge strategy:

A:
<key>My Array</key>
<array>
	<dict>
		<key>Foobar</key>
		<array>
			<string>a</string>
		</array>
	</dict>
</array>

B:
<key>My Array</key>
<array>
	<dict>
		<key>Foobar</key>
		<array>
			<string>b</string>
		</array>
	</dict>
</array>

MERGED:
<key>My Array</key>
<array>
	<dict>
		<key>Foobar</key>
		<array>
			<string>a</string>
			<string>b</string>
		</array>
	</dict>
</array>

Same example with the keep merge strategy:

A:
<key merge='keep'>My Array</key>
<array>
	<dict>
		<key>Foobar</key>
		<array>
			<string>a</string>
		</array>
	</dict>
</array>

B:
<key>My Array</key>
<array>
	<dict>
		<key>Foobar</key>
		<array>
			<string>b</string>
		</array>
	</dict>
</array>

MERGED:
<key>My Array</key>
<array>
	<dict>
		<key>Foobar</key>
		<array>
			<string>a</string>
		</array>
	</dict>
	<dict>
		<key>Foobar</key>
		<array>
			<string>b</string>
		</array>
	</dict>
</array>

FIX: (#8871) Support tangent space handedness
Tangents are now produced as vec4 in the engine, where the fourth component is the handedness of the tangent vector. This can then be used to calculate the correct tangent space vectors in a shader:

vec3 bitangent = cross(normal, tangent.xyz * tangent.w);

FIX: (#8987) Fixed the issue where the Tilemap was not using flip and rotate attributes for physics
Fixed the issue where tile rotation and flip were applied for the visualization of the tile but not for physics.

FIX: (#8945) Use resource pointers all the way for GUI textures

FIX: (#8972) Fix crash in GUI when atlas changes texture resource internally
Fixed a crash where a call to resource.set_atlas(…) replaces the texture that was backing an atlas used in a GUI with a new texture resource. In this case, the engine was using the old texture resource pointer that was originally used in the atlas, whereas now we resolve the actual pointer being used instead.

FIX: (#8918) Fixed triggers and back button for controllers on macOS
Fixed an issue when triggers and back button on macOS weren’t caught by the gamepads input system.

FIX: (#26) AdQuality SDK
The extension now supports the IronSource Ad Quality SDK which can be used to review the ads that are served to your users and report problematic content, ad network quality issues and measure how your ads perform.

The Ad Quality SDK will be initialized together with the IronSource SDK when calling ironsource.init().

Fixes #20

FIX: (#382) Include shared objects from an .aar file into Android builds
Some .aar fils contain a jni folder with .so files. This task should make sure to find these files and send them back to the client for bundling.

FIX: (#8956) Added Android bundler option to extract native libs on install
The Android bundler will now respect the android:extractNativeLibs attribute on the application level in AndroidManifest.xml. The option is configurable from game.project in the Android section.

This attribute indicates whether the package installer extracts native libraries from the APK to the file system. If set to “false”, your native libraries are stored uncompressed in the APK. Although your APK might be larger, your application loads faster because the libraries load directly from the APK at runtime.

IMPORTANT

If you are using a custom AndroidManifest.xml and would like to use this new option please make sure to add the android:extractNativeLibs attribute to the <application> tag:

<application
        android:extractNativeLibs="{{android.extract_native_libs}}"

FIX: (#8994) Fixed APK installation on device after bundling.
Make sure that the correct APK path is used when the editor installs the APK on a device.

FIX: (#9015) Update Android SDK to version 34.0.0 and targetSdkVersion to 34

FIX: (#9028) Fix issues with physics.set_shape() for Sphere shape
Fixed the issue where physics.set_shape() doesn’t apply physics world scale when Allow Dynamic Transformis checked in game.project.

FIX: (#9029) Fix issue whenPrivacyInfo.xcprivacy end up in wrong directory in macOS bundle
In the macOS bundle, PrivacyInfo.xcprivacy should be in the Resources folder instead of the root *.app directory.

FIX: (#9002) Multi-touch improvements for Android devices
Fixed an issue where multi-touch on Android caused some events to not be processed, leading to “ghost” input events that gets dispatched to the on_input function forever.

FIX: (#9062) Delete dynamic attributes from sprites when deleting the instance
Fixed an issue where dynamically allocated vertex attributes were not correctly released from sprite components when the sprite component has been deleted.

Editor

NEW: (#8983) Fixed the order of layers in the dropdown menu
Make the order of layers in the dropdown menu the same as specified in the outline panel.

NEW: (#8973) Added ability to rotate and flip the brush when painting in tilemap.
Now it’s possible to flip and to rotate the brush when editing tile map using the following hotkeys:

  • X - flip the brush horizontally
  • Y - flip the brush vertically
  • Z - rotate the brush 90° clockwise

NEW: (#8914) Bundle lua language server into the editor
This changeset includes the Lua language server into the editor distribution, so it’s enabled in all projects. Yay!

NEW: (#8986) Allow adding multiple components at once
Now it’s possible to add multiple components to a GameObject at once.

NEW: (#9031) Add child-seqs to outline nodes for copy+paste handling
The editor now has support for copy/paste/cut of all resources nodes in the outline view except for “layouts”. Layouts are unique and only one of each type can exist in a GUI at any time.

NEW: (#9059) Allow disabling globals linting
It’s now possible to set or disable globals linting in .luacheckrc, e.g.:

globals = false -- disable all globals warnings

NEW: (#9055) Add imperative editor script API
This changeset adds imperative editor script APIs:

  1. editor.transact(txs): similar to "set" action — modify the editor’s in-memory state.
  2. editor.execute(cmd...): similar to "shell" action — execute a shell script.
  3. editor.save(): persist all unsaved changes to disk.

FIX: (#8951) Make sure user uses only one shape type in a Collision Object
Show an error if the user uses both a Collision Shape based on a tilemap and a primitive shape in the same Collision Object.

FIX: (#9026) Ensure build targets from embedded objects inside editable resources fuse with equivalents from non-editable resources
Fixed exception when building a project that contains equivalent embedded objects in both an editable and a non-editable resource.

FIX: (#8980) Added the ability to select a tile region in the palette map as a brush
Now it is possible to select a few tiles in the palette as a brush.

FIX: (#8984) Fixed the issue where “Frame Selection” (F) doesn’t work on multipage atlas.
Fixed the issue where “Frame Selection” (F) doesn’t work on a multipage atlas if an image is selected on any page except the first one.

FIX: (#8934) Bring back update download progress
Now the update download progress is back

FIX: (#8963) Sanitize project folder name in the Welcome dialog.
Sanitize the project folder path to remove all prohibited symbols used in the project title when creating a new project in the Welcome screen.

FIX: (#8958) Improve suggested completions
This changeset does not show “lower quality” completions (text) when the “higher quality” completions are present (e.g. method, variable, etc.).

FIX: (#8959) Don’t suggest completion popup unnecessarily
The editor no longer shows the completion popup after typing { and ,.

FIX: (#9022) Refactor editor scripts runtime
We want to expand the editor scripting capabilities in the future, so we refactored the editor script Lua runtime to be more efficient when it comes to runtime-editor interactions, and to be more user-friendly. One noticeable change in editor script behavior is automatic reload of resources after file:write(...); file:close() calls while the editor script is running. This means that using editor.get(my_resource_path, "text") after writing to a file identified by my_resource_path will now return the updated text.

FIX: (#9042) Make sure that recursion is impossible when pasting a folder into its subfolders.
Show an error if the user tries to paste a folder into its subfolders.

FIX: (#9030) Show an error if the wrong script type is used
Fixed the issue where neither the editor nor bob reacts when the wrong script type is used, such as a .script file instead of a *.gui_script in *.gui etc.

18 Likes

What a great release, awesome.
I know about the efforts to bring C# to the engine, but I believe this will attract more C/C++ game developers to the engine, and they bring a lot of expertise. :smiley:

5 Likes

Thanks! :slightly_smiling_face:

2 Likes

Yes, that is our plan. We get both an expanded C++ SDK and a C# SDK at the cost of one.

6 Likes

Lua has been the main scripting language for the engine, and I’ve heard that it would always be. I also understand that having C/C++ support is great for performance and is already the engine language, and due to the openness of the engine that would reasonable to extend the engine in a great way. What’s the idea with C# now? I’ve heard before that the Defold team were against this, but now things have changed. Unity used to have 3 languages, and now it’s just one. C# certainly attracts dissatisfied Unity users, and that’s a good reason to have C#, but as a Lua user I have concerns about a heavier, bigger engine. What runtime would the engine use? Mono, .NET Core? Would C# support be available as extension, or a different engine build? I think it would be nice to address those questions for the user base, if not done already (I may have missed something)

1 Like

Hi!
It seems a lot of users feel a worry about our upcoming C# support.
I don’t think there is a reason to. We’ll keep things working “the Defold way”, just as we have for the past ten years (that I’ve been working on Defold).
Small engine size and performance is still part of our main directives.

We’re not moving away from Lua as a the primary scripting language.
We’re merely adding C# support for our extensions, just as we already support C/C++/Java/Objective-C/Zig.
It will not impact the engine unless you choose to use C# extensions in your project.

C# support will come at a price (executable size, runtime performance etc), but that’s for the individual developer/studio to decide upon. We’re merely giving them the option. As for specific numbers, it’s too early to tell reliably yet.

As for adding more functions to our C++ sdk, it’s beneficial for certain studios to use those functions directly. E.g. to write more game code in C or C++ (and later C#). The effort itself is mostly cleaning up our apis, as they already exist in our private headers. The notable exception was resource.h which required a big refactoring/cleanup, which was a long time overdue.

As for C# itself, it’s a relatively minor change for us, as we already support many languages in our plugin system. We will keep our sdk’s in sync by generating the bindings. This will allow us to keep them up-to-date with minimal effort.

We’ve previously been against this C# support, but we decided to go for it for a few reasons:

  • We’ve continued to get questions about C# support
  • We’ve scoped it down to extensions only (i.e. low effort)
  • We realized it won’t impact the core engine
  • We can keep (generated) api’s in sync with minimal effort
  • We get paid (!) for this task

We’ll use the DotNet 9 (currently in preview) with NativeAOT, thus generating static libraries that we can link against (just like any other Defold extension).

I hope this answers your questions.

11 Likes

Amazing release!
I’ve seen the Defold team answering that question a couple of times here and on Discord. I think it should be a good idea to make a sticky post or a blog about it.

3 Likes

Yeah, I thought the same thing! ^^

Thanks! This means that for the future we may have an extension that provides the full Defold scripting API in C#? That would be great to have if that is the case. Would attract lots of new users without compromising the Lua users. Sounds great.

I added an FAQ entry:

4 Likes

My friend is reporting that he can’t open the game anymore after I make a new build for OSX (I don’t have a Mac myself, I know his Mac is quite old to say the least).

Maybe the migration to glfw3 for MacOS is what broke it for him.

Do you see anything what might explain it in the following crash log? Building the same game in the previous version of Defold (1.8.0) still works.

Attached you will find the crashlog which hopefully sheds some light on the issue at hand :).
mmm-crashlog.txt (41.9 KB)

Dyld Error Message:
  Symbol not found: _OBJC_CLASS_$_NSConstantDictionary
  Referenced from: /private/var/folders/*/Martian Meteor Massacre 2.app/Contents/MacOS/MartianMeteorMassacre
  Expected in: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
 in /private/var/folders/*/Martian Meteor Massacre 2.app/Contents/MacOS/MartianMeteorMassacre

Are you using any native extensions? If so which ones? And which versions?

1 Like

Thanks britzl!

I’m using DefOS v2.7.1 and DefSave v1.2.5

Other extensions I’m using (not sure if these are native extensions) are:

  • Defold Input 4.6.2
  • Monarch 4.5.0
  • HorriFold 1.0.0-beta3
  • Defold Orthographic 3.3.0

This is the only native extension you have. I’m able to build and run it on macOS 14.5. Which version of macOS does your friend have?

OS Version: Mac OS X 10.13.6 (17G14042)

I’ll try to see what happens when I disable DefOS from a build for him.

I have rebuilt our glfw3 library for macOS, with support for osx 10.13.
You can try it here to see if it works better:

3 Likes

@britzl Disabling DefOS didn’t work. But thanks for thinking / debugging with me :slight_smile:

@Mathias_Westerdahl The rebuild with support for OSX 10.13 seems to have done the trick. When building with v1.9.1 alpha (and changing the build server to https://build-stage.defold.com) I got word that this version starts up again without any issues and plays fine.

Thanks again for all your support guys!

7 Likes

Is there any working compute program example? I try to follow manual, but can’t make it work.

All I know is @dlannan 's experiment: