Defold 1.8.1
Overview
Defold 1.8.1 includes new engine features like error handling for file writes, options for disabling LiveUpdate auto-mounting, and support for Lua transpilers, new and improved camera component and API, as well as numerous bug fixes related to meshes, sprites, fonts, HTTP requests, and editor UI issues.
We’d like to highlight the initial support for Lua transpilers in the build pipeline (both editor and bob). The first language that can be used to try the transpiler feature is Teal — a typed dialect of Lua. You will need to add teal extension to the dependencies to try it out. The support is currently limited to transpilation only and excludes automatic extern generation for Defold’s Lua APIs. This means it is more useful for writing type-safe standalone logic than interacting with Defold runtime, though teal allows writing necessary externs yourself.
The first iteration of an improved camera component has been added in this version of Defold. The camera API is now available in all scripts (including render scripts and gui scripts) via the camera
namespace, and contain new functionality to bind a camera to the renderer instead of passing explicit view and projection matrices to it.
Summary
- NEW: (#8870) Add error reason for fwrite in sys.save
-
NEW: (#8857) Add a new option in
game.project
:liveupdate.mount_on_start
, which disables auto-mounts at the start of the game. - NEW: (#8868) Camera component refactor + improved camera module
- NEW: (#8284) Use Teal as a typed Lua alternative
- NEW: (#8843) Add ogg validation in the editor
- FIX: (#8882) Support building a mesh without any samplers assigned
- FIX: (#8845) Reset buttons state when focus lost.
- FIX: (#8819) Make sure go.get_world_position() returns the correct value when called from the init() function.
- FIX: (#8844) Fixed canvas flickering in the HTML5 bundle when the window is being resized.
- FIX: (#8853) Support using no color when writing custom vertex attribute for sprites
- FIX: (#8864) Added missing lua_source_ddf.proto to dmSDK
- FIX: (#8880) Fixed crash when sprite material uses N samplers but shaders uses less than N samplers.
- FIX: (#8886) Fixed an issue where font metrics were incorrect for monospaced fonts.
- FIX: (#8893) Engine crashes when producing secondary uv sets
- FIX: (#8906) Handle ‘path’ option in http.request for html5 implementation.
- FIX: (#8879) [Web] Fix sound play while AudioContext is suspended
- FIX: (#8837) Allow setting Image property when multi-selecting
- FIX: (#8839) Limit the number of rendered errors
- FIX: (#8883) Changing from a material with an overridden vertex attribute causes an assert
Engine
NEW: (#8870) Add error reason for fwrite in sys.save
Fixed an issue where sys.save doesn’t output the reason why it couldn’t write to a file.
NEW: (#8857) Add a new option in game.project
: liveupdate.mount_on_start
, which disables auto-mounts at the start of the game.
In some cases, it might be useful to fully control from the code what exactly needs to be mounted instead of using auto-mount at the start of the application. Now, this is possible to do using the liveupdate.mount_on_start
checkbox in game.project
.
NEW: (#8868) Camera component refactor + improved camera module
The camera script module and the camera component has been updated:
- The camera component will automatically acquire focus when it is created. There is no more need to send the “acquire_camera_focus” message to the component. To disable the camera, use go.set("#camera", “disable”) instead.
NOTE: This is a subtle change in behaviour. Previously you had to send a "acquire_camera_focus" message to the component for a camera to be updated. With the new code path, all cameras will be enabled and updated automatically until you actively send an "unacquire_camera_focus" message. Since the old behaviour was so cumbersome to work with, we **do not consider this as a breaking change** - instead we consider it to be a bugfix or simply as a workflow improvement.
- All scripts can now access the
camera
namespace. There are new functions in the module that can now be used:
-- returns a list of all currently available cameras. each entry in the table is a camera URL (see msg.url)
local all_cameras = camera.get_cameras()
-- get/set properties. note that not all properties can be set
camera.get_projection(camera_url) -- read-only
camera.get_view(camera_url)-- read-only
camera.get_aspect_ratio(camera_url)
camera.set_aspect_ratio(camera_url)
camera.get_fov(camera_url)
camera.set_fov(camera_url)
camera.get_near_z(camera_url)
camera.set_near_z(camera_url)
camera.get_far_z(camera_url)
camera.set_far_z(camera_url)
camera.get_orthographic_zoom(camera_url)
camera.set_orthographic_zoom(camera_url)
- The render API has a new function
render.set_camera(camera_url, [options])
- this can be used in a render script to automatically use the view and projection matrices from the camera in the next draw call:
-- a typical camera based render loop can now look like this
for k,v in pairs(camera.get_cameras()) do
-- note that the view and projection matrices previously set up
-- using render.set_view and render.set_projection will be wiped by this call
-- the 'use_frustum' option will use the cameras view projection matrix for frustum culling
-- this will take precedence over any frustum passed in to the render.draw function
render.set_camera(v, { use_frustum = true })
-- set other drawing states
render.draw(pred_scene)
end
-- unbind the camera for custom rendering
render.set_camera()
render.set_view(...)
render.set_projection(...)
render.draw(pred_gui)
The next iteration of improving the camera component involves:
- adding a viewport property to the camera that will automatically be set when calling render.set_camera
- adding coordinate system conversion functions (screen->world, world->screen, project/unproject and so on)
FIX: (#8882) Support building a mesh without any samplers assigned
Bob can now bundle projects with meshes that have no textures specified.
FIX: (#8845) Reset buttons state when focus lost.
FIX: (#8819) Make sure go.get_world_position() returns the correct value when called from the init() function.
Fixed an issue where objects in deep hierarchies returned the wrong value for go.get_world_position()
when called from init()
.
FIX: (#8844) Fixed canvas flickering in the HTML5 bundle when the window is being resized.
Fixed an issue where the game’s canvas flickers black (a background color) when resizing the browser window.
FIX: (#8853) Support using no color when writing custom vertex attribute for sprites
Fixed an issue where a sprite was using a material with a “color” semantic type that didn’t get written to the vertex buffer.
FIX: (#8864) Added missing lua_source_ddf.proto to dmSDK
FIX: (#8880) Fixed crash when sprite material uses N samplers but shaders uses less than N samplers.
FIX: (#8886) Fixed an issue where font metrics were incorrect for monospaced fonts.
Monospaced fonts should always use the fixed Advance Width for each symbol as its width, instead of the glyph’s real width.
FIX: (#8893) Engine crashes when producing secondary uv sets
FIX: (#8906) Handle ‘path’ option in http.request for html5 implementation.
Add ‘path’ parameter handling for html5 implementation in http.request
function.
FIX: (#8879) [Web] Fix sound play while AudioContext is suspended
Editor
NEW: (#8284) Use Teal as a typed Lua alternative
Follow-up prototyping task to Investigation: any options of using type system with Lua (strictly typed or gradually typed Lua) · Issue #6398 · defold/defold · GitHub
NEW: (#8843) Add ogg validation in the editor
FIX: (#8837) Allow setting Image property when multi-selecting
FIX: (#8839) Limit the number of rendered errors
FIX: (#8883) Changing from a material with an overridden vertex attribute causes an assert
Fixed an issue where a component has an overridden vertex attribute and the user changes the material where the attribute doesn’t exist. In this case the editor triggers an assert which leaves the editor in a bad state.