⇠ More posts

Defold release 1.9.1

By Alexey Gulev on Jul 22, 2024

Tagged as: Release notes


Defold 1.9.1

Defold version 1.9.1 is now available as a stable release. Please keep reading for technical notes and a full list of changes. Enjoy!

Technical preview of C# support As some of you may know, the Defold SDK (dmSDK) is undergoing some pretty significant upgrades. One of the major goals with this work is to practically open up the core of the engine to be able to write an entire game by using just C++, which also means that it is a lot easier to build support for other programming languages down the line, such as zig and C#. This does not mean we are moving away from using Lua as the main scripting language for the engine - in the case of C# we are adding the support as an extension, which is 100% opt-in. This is further clarified in the Q&A section of the website: https://defold.com/faq/faq/#q-i-am-concerned-that-adding-c-support-will-have-a-negative-impact-on-defold-should-i-be-worried

Editor save system The save system in the editor has gotten a complete rewrite - saving files from the editor is now instantaneous! While performance regarding saving is mostly noticeable for large projects, a lot of work has been put into removing redundant data from the source files. Default values are now stripped away, which can have a major impact on the disk size of a large project.

Tilemap improvements The tilemap system in both the engine and the editor has gotten some much needed attention! Two new runtime function have been added as well as lots of UX improvements in the editor.

Summary

  • BREAKING CHANGE: (#7261) Improve the time it takes to save soon after opening the editor
  • NEW: (#9109) Add initial version of C# support to dmSDK
  • NEW: (#9099) Add an adjustable limit for dynamic GUI textures
  • NEW: (#9057) Add attachment texture resource path into resource.get_render_target_info
  • NEW: (#9130) Add new function tilemap.get_tile_info()
  • NEW: (#9138) Add tilemap.get_tiles() function
  • NEW: (#9069) Get and set material constants in GUI scripts via gui.get/gui.set
  • NEW: (#9081) Overhauled editor save system
  • NEW: (#9091) Tile Source editor: “Collision groups” text color in the outline now corresponds to the tile collision color
  • NEW: (#9101) Add validation for URL symbols ‘:’ and ‘#’
  • NEW: (#9133) Add icons to properties fields to differentiate URL/hash/number
  • NEW: (#9140) Editor: Default to internal code editor for .appmanifest files
  • NEW: (#9144) Editor: Support viewing library resources in Custom Code Editor
  • NEW: (#9162) Use code view when opening resources as text
  • NEW: (#9171) Added the ability for tables to change their width in form view to improve material editing
  • NEW: (#9174) Add possibility to delete, cut and move selected tiles in tilemap
  • FIX: (#9077) Fixed the issue where the tilemap wasn’t updated after a new tilesource was set
  • FIX: (#8995) Fixed black screen on iOS launch
  • FIX: (#9086) Fixed issue where all the tilemaps used only one material.
  • FIX: (#9098) Accept nil instead of a play properties table for model.play_anim()
  • FIX: (#9110) Fix issue that makes it impossible to use tilemap.set_tile() with physics on tiles with indexes greater than 2^16.
  • FIX: (#9163) Fix for collection factory script instances having separate property sets
  • FIX: (#9164) Fix the issue where the window becomes invisible after a restart.
  • FIX: (#9156) Fix bug when Display->Fullscreen has no effect
  • FIX: (#9157) Fix the bug where it’s possible to select the HTML5 game canvas even if it’s not stretched.
  • FIX: (#9159) Fix where a hash can be used as a regular string during concatenation in debug
  • FIX: (#9158) Fix issue where HTML5 build reports Unknown instead of compilation shader errors
  • FIX: (#9176) Fix various issues related to Gui size overrides in the editor
  • FIX: (#9116) Fix the last column size for the table view in the Editor.
  • FIX: (#9139) Editor: Fix load crash resulting from missing Gui template resource
  • FIX: (#9154) Use Gradle as the build system for Bob.jar
  • FIX: (#9186) Only trigger mouse wheel up/down events if they’re in the correct direction
  • FIX: (#9141) Add Enter/Esc controls for properties in the editor
  • FIX: (# 9189) Fix issue when the first single value input into a property field right after the property reset may be lost
  • FIX: (#9197) Fixed tilemap brush visibility
  • FIX: (#452) Update camera manual to showcase the new camera scripting API
  • FIX: (#65) Updated to Play Billing 6.0.0
  • FIX: (#44) Added support for app open ads for AdMob
  • FIX: (#167) Update to spine-c 4.2

Engine

NEW: (#9099) Add an adjustable limit for dynamic GUI textures GUI components can now adjust the maximum number of dynamic textures that can be created in runtime.

NEW: (#9109) Add initial version of C# support to dmSDK

(technical preview)

Note: Currently, DotNet 9 preview only supports macOS, but as more issues are resolved on their end, we’ll integrate them into our pipeline.

This adds a first version of C# support in dmSDK (our sdk for the Defold native extensions).

It adds support for creating a native extension, with apis:

  • namespace dmSDK.Dlib
    • class Hash
    • class ConfigFile
  • namespace dmSDK.Extension
    • class Extension
  • namespace dmSDK.Lua
    • class Lua
    • class LuaL

Example extension source code (WIP): encoder.cs We’ll continue cleaning up this example (and rename it).

Like with C/C++ code, the required step is to add one or more .cs files to your folder. A .csproj file will be automatically generated, and the output will be generated as a NativeAOT static library for the current platform. This allows you to register an extension to the engine and get the same callbacks for the life cycle functions as with a regular native extension.

You can read more about the features and limitations of NativeAOT support here: https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot

Note: We added a small faq regarding our C# support here

NEW: (#9057) Add attachment texture resource path into resource.get_render_target_info Added a new texture field in the data returned from resource.get_render_target_info:

local rt_info = resource.get_render_target_info("/my_rt.render_targetc")
local t_info = resource.get_texture_info(rt_info.attachments[1].texture)

This can then be be used to change the backing texture of an atlas, which should make it easier to achieve custom rendering for any type that is using atlases:

go.property("rt_atlas", resource.atlas())
go.property("rt", resource.render_target())

local function render_target_to_atlas(self)
	-- get the render target info. This contains all the attachment texture resources
	local rt_info = resource.get_render_target_info(self.rt)
	-- get the atlas info, we can create this from scratch, but it's easier
	-- to use the data that is already there and then just modify it
	local atlas_info = resource.get_atlas(self.rt_atlas)
	-- update the atlas backing texture to use our render target attachment
	atlas_info.texture = rt_info.attachments[1].texture
	-- set / update the atlas with the new atlas info
	resource.set_atlas(self.rt_atlas, atlas_info)
end

Scripts can now also pick up render targets as script properties as well: go.property("my_rt", resource.render_target())

NEW: (#9130) Add new function tilemap.get_tile_info() Added a new function tilemap.get_tile_info() which provides full information about the tile at the specified layer and coordinates.

  -- get the tile under the player.
  local tile_info = tilemap.get_tile_info("/level#tilemap", "foreground", self.player_x, self.player_y)
  pprint(tile_info)
  -- {
  --    index = 0,
  --    h_flip = false,
  --    v_flip = true,
  --    rotate_90 = false
  -- }

NEW: (#9138) Add tilemap.get_tiles() function Added a new function tilemap.get_tiles() which returns a table of rows with all the tile indexes for the layer.

local left, bottom, columns_count, rows_count = tilemap.get_bounds("#tilemap")
local tiles = tilemap.get_tiles("#tilemap", "layer")
local tile, count = 0, 0
for row_index = bottom, bottom + rows_count - 1 do
	for column_index = left, left + columns_count - 1 do
		tile = tiles[row_index][column_index]
		count = count + 1
	end
end

NEW: (#9069) Get and set material constants in GUI scripts via gui.get/gui.set gui.get and gui.set can now be used to get or set material constants for a GUI node:

local node = gui.get_node("box")
local tint = gui.get(node, "tint")
tint.x = tint.x + dt * 0.1
go.set(node, "tint", tint)

FIX: (#9077) Fixed the issue where the tilemap wasn’t updated after a new tilesource was set Fixed an issue where setting a Tile Source at runtime required deleting other tile maps already using the tile source before the change became visible.

FIX: (#8995) Fixed black screen on iOS launch When launching an iOS game made in defold, a brief black screen could be observed in the transition from the launch screen to the game. This fix covers up that black screen with the contents of the launch screen.

FIX: (#9086) Fixed issue where all the tilemaps used only one material. Fixed an issue where the material wasn’t properly taken into account when calculating a batch key, resulting in a bug where multiple tile maps couldn’t have different materials.

FIX: (#9098) Accept nil instead of a play properties table for model.play_anim() A call to model.play_anim(url, anim, playback, [play_properties], [complete_function]) will now correctly accept nil instead of a Lua table for the play_properties argument.

FIX: (#9110) Fix issue that makes it impossible to use tilemap.set_tile() with physics on tiles with indexes greater than 2^16. Fix the issue where tiles in tilemaps ignore their collision shape if set using tilemap.set_tile() and if a tile index greater than 65535.

FIX: (#9163) Fix for collection factory script instances having separate property sets This fixes a crash when two script instances tries to delete the same property set.

FIX: (#9164) Fix the issue where the window becomes invisible after a restart. Fixed the issue where the window becomes invisible after a restart or when building from the editor multiple times without closing the window.

FIX: (#9154) Use Gradle as the build system for Bob.jar Using Gradle for Bob.jar makes it easier to set up and develop new features for Bob.jar by speeding up iterative builds and adding the ability to run single tests when needed.

A manual for setting up IntelliJ IDEA is available here.

FIX: (#9156) Fix bug when Display->Fullscreen has no effect Fixed issue when Display->Fullscreen has no effect on macOS.

FIX: (#9157) Fix the bug where it’s possible to select the HTML5 game canvas if it’s not stretched. Fix the issue where a long tap outside the canvas creates a magnifying tool in Safari when the HTML5 bundle doesn’t use Stretch mode for the canvas.

FIX: (#9159) Fix where a hash can be used as a regular string during concatenation in debug Fix the issue where this construction produces a valid URL in debug:

local id = factory.create("#factory")
local broken_path = "main:"..id.."#sprite"
--- main:/go#sprite

Hash reverse strings don’t exist in release build, and the fact that it works in debug may cause confusion. With this fix, the result of concatenation can’t be used as a valid URL:

--- main:[/go]#sprite

FIX: (#9158) Fix issue where HTML5 build reports Unknown instead of compilation shader errors Fixed the issue where the HTML5 bundle reports Unknown instead of shader compilation errors. Additionally, as part of this fix, multiline output has been added for errors in HTML5 bundles.

Editor

BREAKING CHANGE: (#7261) Improve the time it takes to save soon after opening the editor

  • Improved the time it takes to save the project soon after opening it in the editor.
  • Breaking change: This change requires an updated version of extension-spine due to changes to the GuiNode interface in the editor.

NEW: (#9081) Overhauled editor save system Overhauled the systems that are responsible for loading and saving project files in the editor.

Default values and non-overridden values originating from referenced resources such as Gui template scenes will no longer be written to the project files.

The updated sparse file formats will be used for any files that are saved from now on. If you want to upgrade all the project files to the new sparse file formats at once, select Upgrade File Formats… from the File menu.

If you’ve built an extension that includes experimental Clojure-based editor plugins (maybe based on the the extension-simpledata project on GitHub?), you can port it to the new save system by making changes corresponding to our own changes to extension-simpledata. In summary:

  • You should use editor.graph-util/set-properties-from-pb-map in the :load-fn of your Protobuf-based resource types to make sure we only return transaction steps that set properties that are present in the data we read from disk.
  • Every property in your Protobuf-based defnodes should include a default value from the specific Protobuf field it is backed by to ensure the node works correctly when we don’t have a value for the field in the data we read from disk.
  • You should use protobuf/make-map-without-defaults when producing the save-value output in your Protobuf-based defnodes to ensure we don’t write defaults to disk when saving.

NEW: (#9091) Tile Source editor: “Collision groups” text color in the outline now corresponds to the tile collision color. Make it clear which collision group corresponds to which area in the tile source.

NEW: (#9101) Add validation for URL symbols ‘:’ and ‘#’ Added validation to warn the user if a Collection’s name, GO’s or Component’s IDs contain special URL symbols such as ‘:’ and ‘#’.

NEW: (#9133) Add icons to properties fields to differentiate URL/hash/number Makes it easier to distinguish between number, hash, and URL go.properties() using icons.

image

NEW: (#9140) Editor: Default to internal code editor for .appmanifest files Default to using the internal code editor and its accompanying generator UI for .appmanifest files.

NEW: (#9144) Editor: Support viewing library resources in Custom Code Editor It is now possible to view library resources with the configured Custom Code Editor.

NEW: (#9162) Use code view when opening resources as text

  • The editor will now use the full-featured code editor view when you choose Open As > Text for a resource.
  • If you have a Custom Code Editor configured in Preferences, you now have the option to Open As > Text in Defold Editor alongside Open As > Text in Custom Editor.
  • Fixed an issue where it was possible to insert line breaks into the Console by pressing return.
  • Fixed a CSS style regression on the Evaluate Lua input field in the Console.

NEW: (#9171) Added the ability for tables to change their width in form view to improve material editing Fixed the issue where the table view in form view had a very small maximum width, making it difficult to edit materials and leaving most of the widescreen empty.

NEW: (#9174) Add possibility to delete, cut and move selected tiles in tilemap Added an ability to cut tiles using Shitf+Ctrl and erase tiles using Shirt+Atl in the tilemap editor.

CleanShot 2024-07-05 at 08 02 17

FIX: (#9176) Fix various issues related to Gui size overrides in the editor

  • Fixed exception when clearing a manual Size override while Size Mode overrides Auto to Manual.
  • Clear out hidden Gui node manual Size overrides when the Size property is controlled by the assigned Texture.

FIX: (#9116) Fix the last column size for the table view in the Editor. Fix the issue where the last column in a table has a minimum width size, making it hard to edit.

FIX: (#9139) Editor: Fix load crash resulting from missing Gui template resource Fixed editor crash when loading a Gui scene that overrides properties on nodes inside a missing template resource.

FIX: (#9141) Add Enter/Esc controls for properties in the editor Now, if a property is selected, the Esc button cancels uncommitted changes and unselects the property; the Enter button commits changes and selects the value. If the value is selected, it then unselects it.

FIX: (#9197) Fixed tilemap brush visibility Fixed the issue where brush tiles were always behind the tilemap layers.

CleanShot 2024-07-12 at 19 05 00

FIX: (#9189) Fix issue when the first single value input into a property field right after the property reset may be lost Fix the issue where a property value was reset and immediately replaced with a single input value, which would not be saved after the field is unfocused.

Extensions

FIX: (#65) Updated to Play Billing 6.0.0 FIX: (#44) Added support for app open ads for AdMob FIX: (#167) Update to spine-c 4.2