Defold 1.9.1 has been released

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: Defold engine and editor FAQ

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.

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.

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.

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

32 Likes

Thanks for another great release! :+1:

4 Likes

new cool features the engine is evolving very fast

3 Likes

Another great release! :partying_face:

4 Likes

Just updated. My project stopped to work. Apparently, a problem with instances :

ERROR:SCRIPT: Normal/Scripts/curseur.script:134: could not find any instance with id '<unknown:7837189161009595363>'.
stack traceback:
  [C]:-1: in function set
  Normal/Scripts/curseur.script:134: in function Wheel_Zoom
  Normal/Scripts/curseur.script:46: in function <Normal/Scripts/curseur.script:35>

ERROR:GAMEOBJECT: Instance '<unknown:7837189161009595363>' could not be found when dispatching message 'set_constant' sent from main:/curseur#curseur
INFO:DLIB: SSDP: Done on address 192.168.1.11

Tried a few past saves, the messages can be differents, but always refers to some “unknown instance” :

DEBUG:SCRIPT: wheel_down
ERROR:GAMEOBJECT: Instance '<unknown:7837189161009595363>' could not be found when dispatching message 'set_constant' sent from main:/curseur#curseur
ERROR:GAMEOBJECT: Instance '<unknown:12989995969024804642>' could not be found when dispatching message 'set_constant' sent from main:/curseur#curseur
ERROR:GAMEOBJECT: Instance '<unknown:9838123673650379807>' could not be found when dispatching message 'set_constant' sent from main:/curseur#curseur
ERROR:GAMEOBJECT: Instance '<unknown:3800118385834849441>' could not be found when dispatching message 'set_constant' sent from main:/curseur#curseur
ERROR:GAMEOBJECT: Instance '<unknown:12343910578270488106>' could not be found when dispatching message 'set_constant' sent from main:/curseur#curseur
ERROR:GAMEOBJECT: Instance '<unknown:12443886979733718156>' could not be found when dispatching message 'set_constant' sent from main:/curseur#curseur
ERROR:GAMEOBJECT: Instance '<unknown:6205521174631620690>' could not be found when dispatching message 'set_constant' sent from main:/curseur#curseur

After all this work to make it work :frowning:

Installed Defold 1.9.0 on the side : Working perfectly.
Will try with the 1.9.1. Alpha and Beta, now.

1.9.1.Alpha not working. Will try with Beta, but it’s probably going to be the same thing, since Alpha and Stable don’t work.

ERROR:SCRIPT: Normal/Scripts/curseur.script:116: could not find any instance with id '<unknown:7837189161009595363>'.
stack traceback:
  [C]:-1: in function set
  Normal/Scripts/curseur.script:116: in function Wheel_Zoom
  Normal/Scripts/curseur.script:46: in function <Normal/Scripts/curseur.script:35>

ERROR:GAMEOBJECT: Instance '<unknown:7837189161009595363>' could not be found when dispatching message 'set_constant' sent from main:/curseur#curseur
INFO:DLIB: SSDP: Done on address 192.168.1.11

Then there :
1.9.0 : Working.

1.9.1 Alpha : Not working.
1.9.1 Beta : Not working.
1.9.1 Stable : Not working.

1.9.2 Alpha : Not working.

I’m trying to open a Github to put my project on it. Wish me luck. Send pizzas.

It’s hard to say without details what exactly the code is and what you use as an url. I assume it might be related to hash concatenation when a hash is used as a string. It worked only in debug mode and might be a problem during development.

Now, if you concatenate a hash as a string, it will not work even in debug mode. This change is consistent and helps to catch issues earlier.

It’s hard to help you without a minimal repro case or more info about your code.

Another way is to test this code by bundling a release in version 1.9.0 and check if this functionality works there. If it does not, then it is likely a hash concatenation-related issue.

3 Likes

After upgrade to new format. Resources in my game reduced from 1021.81kb to 1014.28kb. Saved 7kb:)

guic and collections sized less) :partying_face:

5 Likes

Size reduction isn’t the main benefit here. The main benefit is how the editor works with project files, reading and writing them. This part was rewritten, providing a speed boost. While this improvement might not be noticeable on small projects, it will be on huge projects with thousands of resource files.

9 Likes

Wow! So much new features! Thanks for new version!

5 Likes

Thank you! Lots of new stuff in there!

1 Like
ERROR:SCRIPT: game/scripts/manager/battle_manager.script:730: Could not find any instance with id '<unknown:11379135658103374103>'.

		if(action.released) then
		for _, v in pairs(battle.all_units) do
			if(v.actor ~= nil and v.death == false) then
				local pos = v.pos + go.get(v.actor .. "#Character", "height") / 2   # line: 730
				local distance = vmath.length(vmath.vector3(action.x, action.y, pos.z) - pos)
				if distance < 32 then 
					msg.post("main:/gui#unit_info", MESSAGE.show, {id = v.actor})
					break
				end
			end
		end
	end
1 Like

Assuming v.actor is a game object ID, replace:

go.get(v.actor .. "#Character", "height")

with:

go.get(msg.url(nil, v.actor, "Character"), "height")

This will properly construct a URL instead of relying on the debug functionality, which would have broken in release mode on previous versions anyway.

8 Likes

Yes, it works for the 1.9.1 version.
thank you. :+1:

2 Likes

As wanted, here’s the code, put on github. I think it’s good, but it was an horror to pass through all the “errors/can’t/won’t/denied” from this thing"

https://github.com/Vampiloup/syzygie

It’s WORKING on 1.9.0 stable, I assure you. Just non with 1.9.1.alpha+

I tried to use the answer you gave to GuaiWuLieRenGe, but it’s not working more (well, I don’t understand why we even have to put a msg command in the go.get one, to be honest).

  • The instances are created by a Factory in object CreationEtoile

  • the factory call the Etoile object, that have its own Etoile.script

  • and called in CreationEtoile.script (line 36)

  • Line 37, call a function (lua_ecrire_systeme) in the serveur_variables.lua (line91-100), that put all stuff about this instance (it’s a star system in the game), starting its instance number (id_instance)

  • in game, when using the wheel, the function Wheel_Zoom (curseur.script line 101-140) make zoom changes. I’m not sure I’m going to let the function there (maybe it will be better in the camera.script. Tried ; works also good).

  • in 1.9.0 stable, work without problem

  • in 1.9.1 alpha+, lines 115 or 133 (zoom in or out) send the “unknown instance” error message.

Game commands :
Click on stuff with Enter or Left Button (“touch”)
moving camera with cursor keys, or by dragging the screen with middle button / space key
zoom with page up/down or wheel up/down
double click center the camera on the cursor

Working actually on the map bounding problems, but they don’t affect the situation.

exactly as I said, you are using concatenation on hash:

tmp isn’t a string. It is a hash.
So you can’t just concatenate a hash value with a string value.
To create a url to some particular component you have to do something like:

local comp_url = msg.url(nil, tmp, "#sprite")
go.set(comp_url,  "scale.y", 1*(math.pow(zoom_gap, -zoom_state))

etc

6 Likes

Working, thank you :slight_smile:

local comp_url = msg.url(nil, tmp, "sprite")
2 Likes