Defold 1.5.0 has been released

Release notes

Summary

  • BREAKING CHANGE: (#7609) Add support for multiple liveupdate zip archives
  • NEW: (#7800) Add option to avoid copying or cloning buffer in resource.set_buffer
  • NEW: (#7780) Bob.jar support for Apple Silicon (M1/M2) chips using JDK for arm64
  • NEW: (#7803) Material constant array support for go.get/go.set
  • NEW: (#7788) Make sure that unloading of a gui component removes its dynamic textures
  • NEW: (#7798) Error about syncfs is now a warning message
  • NEW: (#7772) Update all cameras in the focus stack
  • NEW: (#7849) Get and set node materials from gui scripts
  • NEW: (#7876) Use asynchronous build on the extender by default.
  • NEW: (#7787) Add conditional breakpoints
  • FIX: (#7852) Set the correct previous state for xinput devices
  • FIX: (#7813) Sound stopped event
  • FIX: (#7812) Shader include with pragmas doesnā€™t translate to ES3 correctly
  • FIX: (#7821) Fix issue with long comments in shaders
  • FIX: (#7794) Fix profiler step blinking
  • FIX: (#35) Set extension version as user agent
  • FIX: (#7822) Fix issue when wasm-web arch canā€™t be built without js-web
  • FIX: (#7869) Make sure old LiveUpdate flow works fine
  • FIX: (#7793) Fix bug when debugger stops with an error if GUI text node contains newline
  • FIX: (#7791) Donā€™t replace all occurences of empty string
  • FIX: (#7825) Fix issue when CMD+H doesnā€™t hide the editor on MacOS

Engine

BREAKING CHANGE: (#7609) Add support for multiple liveupdate zip archives
It is now possible to load and mount multiple resource archives using liveupdate.add_mount(name, uri, priority, callback). A loaded mount can be removed using liveupdate.remove_mount(name) and a list of all mounted archives can be retrieved using liveupdate.get_mounts(). When the engine needs a resource it searches the list of mounted archives from the highest priority mount (priority is assigned when an archive is mounted) down to the base archive in search of the resource.

After mounting a .zip file, its resources are immediately available. There is no longer a need to reboot the game to access the new content. Resources in a mounted .zip file are no longer verified. It is up to the developer to verify the integrity of downloaded and mounted archives.

In order to facilitate this functionality the manifest and archive file format has been updated to version 5. This means that existing .zip files wonā€™t load. The liveupdate.ref will be removed and as such the liveupdate workflow should trigger again.

A future improvement will be a way for developers to specify how liveupdate content is split into multiple archives when building. For now the excluded content is stored in a single archive and it is up to the developer to manually split the content into multiple archives.

NEW: (#7800) Add option to avoid copying or cloning buffer in resource.set_buffer
Added an argument table for resource.set_buffer with the optional flag transfer_ownership to set a buffer handle immediately on a resource instead of copying or cloning the incoming buffer to the destination buffer. This can be used to improve performance in some cases where heavy use of buffers will invoke lots of data copying. Similar to resource.create_buffer, to set the handle directly on a resource from an external lua buffer do this:

resource.set_buffer(path, buf, { transfer_ownership = true })

NEW: (#7780) Bob.jar support for Apple Silicon (M1/M2) chips using JDK for arm64
Now it is possible to use bob.jar with JDK for arm64 (Apple Silicon chips) on Mac.

NEW: (#7803) Material constant array support for go.get/go.set
Added support for setting constant array values from a table via go.set:

go.set("#sprite", "uniform_array", {
        vmath.vector4(1, 0, 0, 1),
        vmath.vector4(0, 1, 0, 1)
})

Calling go.get on the same target will return the entire array as a table as well:

go.get("#sprite", "uniform_array")
-- result: { vmath.vector4(1,0,0,1), vmath.vector4(0,1,0,1) }

NEW: (#7788) Make sure that unloading of a gui component removes its dynamic textures
Make sure that unloading a GUI component removes any dynamic textures associated with it to free up memory and prevent memory leaks.

Added GuiDynamicTexturesSizeMb counter to the profiler.

NEW: (#7798) Error about syncfs is now a warning message
This change will log a user friendly warning instead of an error in HTML5 builds if the mounted file system fails to sync.

NEW: (#7772) Update all cameras in the focus stack
Changed how the focus stack for cameras work. Instead of just updating the camera on the top of the stack, the engine now updates all cameras that have acquired focus via the message msg.post(id, "acquire_camera_focus"). This means that all cameras that have acquired focus will send set_view_projection messages to the render script. Each camera component can be identified in the render script by using the sender in the render script:

function on_message(self, message_id, message, sender)
    if message_id == hash("set_view_projection") then
        -- here, we use the sender.path to identify the camera, but you can combine path and fragment to create a more
        -- precise identifier for the camera
        self.my_cameras[sender.path] = { view = message.view, proj = message.proj }
    end
end

NEW: (#7849) Get and set node materials from gui scripts
GUI scripts have three new functions:

gui.get_material(node) - Gets the node material assigned in the editor (or an empty hash of ā€œā€ if none assigned)
gui.gui.set_material(node, material) - Sets a material for a gui node from either material string or hash as specified in the list of materials in the GUI file
gui.reset_material(node) - Reset the material for a node to the default node specified in the GUI the node belongs to.

In addition to the GUI functions, you can also get and set materials in the gui via go.get and go.set:

go.get("#my_gui", "materials", { key = "my_custom_material_1" })
-- returns the hash of the resource, e.g hash("/path/to/material.materialc")
go.property("material_property", resource.material("/other_material.material"))
function init(self)
     -- this changes the material with key "my_custom_material1" to use a different material ("/other_material.material")
     go.set("#my_gui", "materials", self.material_property, { key = "my_custom_material_1" })
end

NEW: (#7876) Use asynchronous build on the extender by default.
Using of the asynchronous build process fixed an issue when some big extensions fail to build with Internal Server Error.

FIX: (#7852) Set the correct previous state for xinput devices
Fixed an issue where gamepads connected from the start doesnā€™t trigger any ā€˜connectedā€™ actions to the input system.

FIX: (#7813) Sound stopped event
Added a new message id for the sound component when a sound instance has been stopped via sound.stop. The new sound message id is called sound_stopped and will be passed into the lua callback specified when playing a sound.

FIX: (#7812) Shader include with pragmas doesnā€™t translate to ES3 correctly
Fixed an issue where using header guards in shader includes produces the wrong output.

FIX: (#7821) Fix issue with long comments in shaders
Fixed issue when long comments in shaders canā€™t be processed.

FIX: (#7794) Fix profiler step blinking
Fix the issue where the profiler blinks when the property Update Frequency other than 0.

FIX: (#35) Set extension version as user agent
Fixes #32

FIX: (#7822) Fix issue when wasm-web arch canā€™t be built without js-web
Fixed an issue when Bob doesnā€™t build the project for wasm-web architecture if the platform specified as js-web.

FIX: (#7869) Make sure old LiveUpdate flow works fine

Editor

NEW: (#7787) Add conditional breakpoints
You can set a Lua condition that must evaluate to true for the breakpoint to be triggered. You can do it using new breakpoint popup that you can open by right-clicking on the breakpoint code editor area or pressing Alt F9.

FIX: (#7793) Fix bug when debugger stops with an error if GUI text node contains newline
Fix issue when debugger stops if a text node has a newline symbol and then debugger tries to get information about such a node on the breakpoint.

FIX: (#7791) Donā€™t replace all occurences of empty string
The problem: when running replace-all with an empty string find term, the editor got stuck in an infinite loop finding the next occurrences.

the editor no longer locks up executing the ā€œReplace Allā€ command in the code editor view when the search term is empty

FIX: (#7825) Fix issue when CMD+H doesnā€™t hide the editor on MacOS
Fixed issue when CMD+Hon MacOS shows Java About window instead of application hiding.

30 Likes

Installing the update fails on my Windows machine unless Defold is run as administrator:

2023-08-29 16:04:48.194 11422610 [JavaFX Application Thread] INFO  editor.updater - {:line 263, :message "Installing update"}
2023-08-29 16:04:48.211 11422627 [JavaFX Application Thread] INFO  editor.ui.updater - {:line 38, :message "Update failed"}
java.io.FileNotFoundException: C:\Program Files (x86)\Defold\config (Access is denied)

You should move your Defold installation to another folder (e.g. Documents) because Program Files is a protected folder, so modifying it requires running Defold as administrator.

1 Like

Thank you @vlaaad.
This is the path stated in the manual so I just thought Iā€™d let you know.
And thank you all for another great update!

1 Like

Great work as always guys!


This function appears to be documented as set_material in the API doc :wink:

3 Likes

Good catch, Iā€™ve updated the code now.
Iā€™m not sure I can make it visible until next release though :thinking:

1 Like

Someting weird with GameAnalytics (started from 1.5.0) it works in [Project ā†’ Build HTML5] but not working if [Project ā†’ Bundle ā†’ HTML5 application]

this error:

small repo:
test_gameanalytics.zip (7.8 KB)

oh, found the reason, this is happening, due to a missing GameAnalytics.js file if you select only wasm arhitecture!
image

if select both - works fine.

1 Like

This PR should fix that https://github.com/GameAnalytics/GA-SDK-DEFOLD/pull/41
Could you please add your comment in this PR (that you also have this issue and waiting for the fix)

2 Likes

ready! @gameanalytics check out please! :slight_smile:


:sob: :sob: :scream:

Can you try to remove your build folder and try to build again?

Iā€™ve found the reason. I need to close the built game application and then build it again, so I canā€™t use ā€˜rebuildā€™ while the game is running. @jhonny.goransson


This is the result of me using an example with Defold-Orthographic for a rebuild
@jhonny.goransson

Iā€™m trying out bob.jar with Apple Silicon (M2), but get this error:

Generating report... 101% ...done!
Bundling...Cannot read the array length because "b" is null
Cause: java.lang.NullPointerException: Cannot read the array length because "b" is null
2023-09-04 23:06:04 SEVERE  Cannot read the array length because "b" is null 

How can I debug further? Thanks!

Can you run bob with -v or --verbose and share the output here. Does it happen for all projects or just one? What is the exact command line you are using?

Output with --verbose:

Generating report... 101% ...done!
Bundling...2023-09-04 23:17:32 INFO    Entering IOSBundler.bundleApplication() 
2023-09-04 23:17:32 INFO    Bundling to /Users/willem/dev/demonshand/client/build/default/Demon's Hand.app 
2023-09-04 23:17:32 INFO    Code signing enabled. 
Cannot read the array length because "b" is null
Cause: java.lang.NullPointerException: Cannot read the array length because "b" is null
2023-09-04 23:17:32 SEVERE  Cannot read the array length because "b" is null 

Here are the build options:

	$(JAVA_BIN) -jar bob.jar --archive \
		--liveupdate yes \
		--resource-cache-local $(BUILD_CACHE) \
		--settings $(AUX_PROJECT_FILE) \
		--build-report-html build-report.html \
		--texture-compression true \
	    --architectures arm64-ios \
	    --identity $(IOS_IDENTITY) \
	    --mobileprovisioning $(IOS_PROVISIONING_PROFILE) \
	    --platform arm64-ios \
		--verbose \
        --variant=debug \
	    resolve distclean build bundle  

I tried without --identity but get the same error

Generating report... 101% ...done!
Bundling...2023-09-04 23:18:39 INFO    Entering IOSBundler.bundleApplication() 
2023-09-04 23:18:39 INFO    Bundling to /Users/willem/dev/demonshand/client/build/default/Demon's Hand.app 
2023-09-04 23:18:39 INFO    Code signing disabled. 
Cannot read the array length because "b" is null
Cause: java.lang.NullPointerException: Cannot read the array length because "b" is null
2023-09-04 23:18:39 SEVERE  Cannot read the array length because "b" is null 

I havenā€™t tried other projects yet. Iā€™ll give that a stab.

Iā€™m guessing that it is here: https://github.com/defold/defold/blob/dev/com.dynamo.cr/com.dynamo.cr.bob/src/com/dynamo/bob/archive/ArchiveReader.java#L77

This might be related to build report. Does it work if you do not generate a build report?

OK:

  • Iā€™ve tried without build report. Still same error
  • Android builds fine (looks like this is iOS specific)
  • I was able to build extension-iap just fine for iOS (include mobileprovisioning and identity). Therefore there is something specific to my project causing this error.

Iā€™ve reduced the arguments down further:

	$(JAVA_BIN) -jar bob.jar --archive \
		--resource-cache-local $(BUILD_CACHE) \
	    --architectures arm64-ios \
	    --platform arm64-ios \
		--verbose \
	    resolve distclean build bundle

UPDATE: it is not bob.jar specific, the editor has the same error too