⇠ More posts

Defold release 1.8.0

By Mathias Westerdahl on Apr 29, 2024

Tagged as: Release notes


Defold 1.8.0

One of the biggest change in this version is the introduction of the new ‘b2d’ namespace which contains direct access to the Box2D API. This is the first step towards moving our physics APIs into their own extensions, which we will continue working on during this year. Another frequently requested feature that is now available is the introduction of the gui.set and gui.get functions, which is the GUI counterpart of the go.set/get functions. Furthermore, emscripten has now been updated to the latest version (3.1.55). This should enable us to start working on WebGPU support at some point this year.

On the editor side, we have fixed several issues with model rendering. Performance should be better when rendering in the viewport and all known vertex attributes are passed into the vertex shader, which means that you can now preview vertex colors in the editor.

Summary

  • NEW: (#8719) Make maximum amount of text batches configurable via game.project.
  • NEW: (#8758) Add ‘slice’ as a property to get and set slice9 values
  • NEW: (#8732) New function: resource.create_texture_async
  • NEW: (#8712) Added Box2d Lua module
  • NEW: (#5848) Expose allow_sleep and awake Box2D parameters
  • NEW: (#5905) Add option to set IsBullet for Box2D objects
  • NEW: (#8680) Added Apple privacy manifests for iOS and macOS
  • NEW: (#8638) Add gui.get and gui.set
  • NEW: (#8727) Pass all known model scene attributes to shaders in editor viewport
  • NEW: (#8674) Improve resource sync performance
  • NEW: (#6259) Updated to Emscripten 3.1.55
  • FIX: (#8604) Get progress in callback for HTTP requests
  • FIX: (#8664) Fixed issue for DirectInput gamepads with multiple POV’s
  • FIX: (#8657) Add margins to the left and top edges of the atlas.
  • FIX: (#8670) Unpack buffer from argument before setting texture
  • FIX: (#8710) Produce local and world spaced models with correct custom attribute values
  • FIX: (#8757) Migrate texture fields to samplers
  • FIX: (#8698) Fix flickering on vulkan when drawing to a render target
  • FIX: (#8706) Fixed gdc tool when running on OpenGL backends
  • FIX: (#8675) Move experimental vulkan functions to mainline graphics_vulkan library
  • FIX: (#8720) Check response status when fetch wasm for streaming instantiate.
  • FIX: (#8682) Load engine and data concurrently
  • FIX: (#8755) Delete OpenGL textures using the correct context on single threaded graphics backends
  • FIX: (#8751) Fixes misc inconsistencies when setting and getting custom vertex attributes by script
  • FIX: (#8640) Clear the texture data if no buffer is passed in when using resource.create_texture
  • FIX: (#8762) Added more robust shutdown code for our dmJobThread implementation
  • FIX: (#8663) Fix navigating to referencing atlas from missing image build error
  • FIX: (#8694) Editor model rendering optimizations and fixes
  • FIX: (#8725) Add a read timeout when fetching libraries from the editor
  • FIX: (#8754) Support environment-variable replacement for usernames in dependency URLs
  • FIX: (#8769) Fixed broken gizmo manipulations for Model component
  • FIX: (#8787) Enable vulkan backend for Linux platform

Engine

NEW: (#8719) Make maximum amount of text batches configurable via game.project. Maximum amount of text batches can be configured via game.project property graphics.max_font_batches.

NEW: (#8758) Add ‘slice’ as a property to get and set slice9 values Added a new property to sprites for getting and setting slice9 parameters. Examples:

local values = go.get("#sprite", "slice")
local value = go.get("#sprite", "slice.x")
go.set("#sprite", "slice", vmath.vector4(1,2,3,4))
go.set("#sprite", "slice.x", 1337)
go.animate("#sprite", "slice", go.PLAYBACK_LOOP_PINGPONG, vmath.vector4(96, 96, 96, 96), go.EASING_INCUBIC, 2)
go.animate("#sprite", "slice.x", go.PLAYBACK_LOOP_PINGPONG, 96, go.EASING_INCUBIC, 1)

NEW: (#8732) Added resource.create_texture_async Added a new resource function to create textures asynchronously: resource.create_texture_async(path, tparams, [buffer], [callback]):

  • path - the path to the resource to create (/main/my_texture.texturec)
  • tparams - texture params, width, height, format and so on
  • [buffer] - optional buffer that contains the texture data. if the buffer isn’t provided, the texture will be created with blank data
  • [callback] - optional callback that will be called when the upload has completed. The callback has the following setup:

function my_callback(self, request_id, result)

  • self - the script where the request was issued
  • request_id - the unique request id that is returned from resource.create_texture_async
  • result - a table containing: ‘path’ - the resource path of the texture that was updated

This function will create a new texture resource and upload the data into it in a worker thread. The function will return both a resource path and a request id for the async upload, so that specific requests can be tracked during the lifetime of the app or game. The returned resource path can be used immediately (i.e you can pass it to components with go.set), the initial texture will be a blank 1x1 texture which will later be replaced by the actual texture data.

function my_callback(self, request_id, result)
    -- texture has been updated, do something with it
   self.requests[request_id].loaded = true
   go.set("#model", "texture0", result.path)
end

local t_path, t_request_id = resource.create_texture_async("/main/my_texture.texturec", t_params, my_buffer, my_callback)
self.requests[t_request_id] = { path = t_path, loaded = false }

NEW: (#8712) Added Box2d Lua module This allows you to get a physics body and manipulate its forces, velocities and other properties.

Example:

local id = factory.create("#factory", position)
local url = msg.url(nil, id, "collisionobject") -- get the collision object in the spawned object
self.body = b2d.get_body(url) -- get the b2body object
b2d.body.dump(self.body) -- debug print

-- add an impulse
local pos = b2d.body.get_position(self.body)
b2d.body.apply_linear_impulse(self.body, vmath.vector3(300,200,0), pos + vmath.vector3(16,16,0))

A full list of functions is available in the reference api for b2d and b2d.body. Note that this was a first step. Next up is adding the missing structs, e.g. world, joints, fixtures and shapes support.

⚠️⚠️⚠️⚠️

In order to support the feature of removing physics, we have now introduced two app manifest settings. If you are using a custom .appmanifest, and you wish to remove all physics, take note of these changes (or compare with a vanilla app manifest with physics removed):

      excludeLibs: [physics, Box2D, script_box2d]
      excludeSymbols: [ScriptBox2DExt]

⚠️⚠️⚠️⚠️

NEW: (#5405) Expose allow_sleep and awake Box2D parameters

The ability is now possible via the new script api b2d.body.set_awake(body, flag) / b2d.body.is_awake(body)

NEW: (#5905) Add option to set IsBullet for Box2D objects

The ability is now possible via the new script api b2d.body.set_bullet(body, flag) / b2d.body.is_bullet(body)

NEW: (#8680) Added Apple privacy manifests for iOS and macOS This change adds an Apple Privacy Manifest (PrivacyInfo.xcprivacy) to builtins for both iOS and macOS. The privacy manifest will also be added as a game.project setting for both iOS and macOS. If the project also contains native extensions any privacy manifests used by the extensions or any extension dependencies these will be merged with the project manifest. The merged (or original manifest) will be included in the bundled app.

Including a privacy manifest will be required by Apple when uploading to App Store Connect:

“If you upload an app to App Store Connect that uses required reason API without describing the reason in its privacy manifest file, Apple sends you an email reminding you to add the reason to the app’s privacy manifest. Starting May 1, 2024, apps that don’t describe their use of required reason API in their privacy manifest file aren’t accepted by App Store Connect.”

Source: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api?language=objc

NEW: (#8638) Add gui.get and gui.set Gui scripts can now query/set node properties via gui.get and gui.set:

local node = gui.get_node("my_node_id")
local node_pos = gui.get(node, "position")
local node_pos_x = gui.get(node, "position.x")

gui.set(node, "position", vmath.vector3(1, 2, 3))
gui.set(node, "position.x", 1)

We have also added a new property to the gui namespace euler which is linked with the rotation property. When changing one of them, both will change its underlying data. The important change between them is that the rotation property must be set by quaternion values, and the euler property must be set by degree values. You can set a single component of the rotation or the euler properties as usual:

gui.set(node, "rotation.x", math.rad(45))
gui.set(node, "euler.x", 45)

There are no custom script properties available, you can only get and set the already existing node properties:

"position"
"rotation"
"euler"
"scale"
"color"
"outline"
"shadow"
"size"
"fill_angle" (pie)
"inner_radius" (pie)
"slice9" (slice9)

⚠️⚠️⚠️⚠️

Please pay attention! gui.PROP_ROTATIONand gui.set_rotation() now works with quaternions. Therefore, existing code should be fixed to use gui.PROP_EULER and ``gui.set_euler(), or the value used with gui.PROP_ROTATION` should be a quaternion. Please check your existing code and make the necessary changes.

⚠️⚠️⚠️⚠️

FIX: (#8604) Get progress in callback for HTTP requests

Added a new parameter to the option table for the http.request function called ‘report_progress’. When report_progress is true, the amount of bytes sent and/or received for a request will be passed into the callback function:

http.request("http://my-address", "GET",
	function(self, id, response)
		if response.bytes_total ~= nil then
			update_my_progress_bar(self, response.bytes_received / response.bytes_total)
		else
			-- handle response like normal
		end
	end,
	nil, nil, { report_progress = true })

FIX: (#8664) Fixed issue for DirectInput gamepads with multiple POV’s

This fixes an crash when a gamepad has more than one POV.

FIX: (#8657) Add margins to the left and top edges of the atlas. Fixed an issue where the margin specified for the atlas ignored the top and left edges of the atlas and was added only between images and on the right and the bottom edges of the atlas.

FIX: (#8670) Unpack buffer from argument before setting texture Fixed an issue when using resource.set_texture with a buffer object that is acquired from a buffer resource. Previously we did not unpack the buffer correctly, which would cause script errors.

FIX: (#8710) Produce local and world spaced models with correct custom attribute values Fixed an issue where models are using custom attributes with and without mesh colors available in the .glb file:

  • When a model is using a mesh without color data, it should produce the overridden data from the custom vertex attributes
  • When a model is using a mesh with color data, the color data should always take precedence over the custom vertex format

FIX: (#8757) Migrate texture fields to samplers Fixed an issue in bob when building materials, if the material has specified textures they will not be used in the engine because the texture field is now deprecated. The fix migrates all the textures of a material into samplers instead.

FIX: (#8698) Fix flickering on vulkan when drawing to a render target Fixed an issue where flickering was happening on the Vulkan and MoltenVK renderers when using a render target.

FIX: (#8706) Fixed gdc tool when running on OpenGL backends

FIX: (#8675) Move experimental vulkan functions to mainline graphics_vulkan library Removed the experimental vulkan API + library and instead moved all the code into the mainline vulkan library. This should make building the rive extension simpler (due to less dependencies) as well as merging some of the shared functionality later on.

FIX: (#8720) Check response status when fetch wasm for streaming instantiate. Check if fetch() was successful during wasm loading. Otherwise return Response with null body to trigger fallback logic.

FIX: (#8682) Load engine and data concurrently Now dmloader.js loads game data and game engine (wasm + js files) concurrently. ⚠️⚠️⚠️⚠️

The default template builtins/manifests/web/engine_template.html has been changed. If you use your own custom template, make sure to update it with these changes. Pay attention to css changes for progress bar and how progress bar animation now handling. Also change how extra_params passed according to new documentation https://defold.com/manuals/html5/#extra-parameters

⚠️⚠️⚠️⚠️

FIX: (#8755) Delete OpenGL textures using the correct context on single threaded graphics backends This fixes a memory leak with textures on iOS and Html5

FIX: (#8751) Fixes misc inconsistencies when setting and getting custom vertex attributes by script We have fixed multiple issues with setting and getting custom attributes on sprites. The functionality overall is more robust now.

FIX: (#8640) Clear the texture data if no buffer is passed in when using resource.create_texture We now explicitly clear the texture data before uploading it to the GPU texture when using resource.create_texture with no explicit buffer is being used.

FIX: (#8762) Added more robust shutdown code for our dmJobThread implementation This fixes an issue where it was possible for get a dead lock when shutting down the job thread system.

Editor

NEW: (#8727) Pass all known model scene attributes to shaders in editor viewport The scene view will now pass all currently supported vertex attributes to the shader when rendering models.

NEW: (#8674) Improve resource sync performance

FIX: (#8663) Fix navigating to referencing atlas from missing image build error Fixed a regression where double-clicking a build error originating from an .atlas referencing a non-existent image resource would not take you to the referencing .atlas.

FIX: (#8694) Editor model rendering optimizations and fixes

  • Fixed a performance regression in the editor introduced by the recent addition of custom vertex attributes to models.
  • Fixed broken preview of model scene files (.gltf, .dae, etc.). Previously you’d only see the bounding boxes if you opened a .gltf file in the editor.
  • Fixed a memory leak of scene-cache data associated with the OpenGL context used for scene picking hit tests after closing an editor tab.
  • The editor will now share vertex buffers among meshes, as long as they do not use any world-space attributes.
  • The Coordinate Space setting of declared vertex attributes takes precedence, but the Vertex Space setting on the material will be used as the default for any undeclared vertex attributes where it has relevance.
  • The editor will now produce world-space normal attributes correctly, if desired.
  • The editor will no longer produce a broken normal matrix for objects that have a non-uniformly scaled parent.

FIX: (#8725) Add a read timeout when fetching libraries from the editor Added a timeout when fetching libraries from the editor so it doesn’t block indefinitely if a server stops responding.

FIX: (#8754) Support environment-variable replacement for usernames in dependency URLs The editor can now inject environment variables into both the username and password of library dependency URLs that use authentication.

FIX: (#8769) Fixed broken gizmo manipulations for Model component

  • Fixed a regression where the move gizmo would translate rotated Models along the wrong axis.
  • Fixed a regression where the manipulator gizmo would not be properly aligned to Model pivot points.

FIX: (#8787) +8803 Enable vulkan backend for Linux platform

We’ve fixed the building of the Vulkan backend for the Linux platform. :warning: If you have a custom app manifest, then you need to make sure that it’s updated with the relevant dynamicLibs change for the Linux platform. Here’s the text from the editor when selecting the Vulkan backend:

  x86_64-linux:
    context:
      excludeLibs: [graphics]
      excludeSymbols: [GraphicsAdapterOpenGL]
      symbols: [GraphicsAdapterVulkan]
      libs: [graphics_vulkan, X11-xcb]
      dynamicLibs: [vulkan]
      linkFlags: []