Defold 1.8.1 has been released

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.

21 Likes

Thanks a lot for update! especially for this web-related fixes!

8 Likes

:+1: The increased focus on web related fixes is thanks to our recent partnership with Poki!

8 Likes

Amazing update! camera features very good to see.

9 Likes

I lack the experience and knowledge to do this, and am hoping someone will make a defold extension for it or better explain how to achieve it.

Also no colouring of the text in teal yet it seems. Would be perfect dev environment otherwise.

Something happened with folder name.
I make builds with bob.

When i make build for web result folder have “Punch Legend Simulator” name.

But when i build for android, result folder have “PunchLegendSimulator” name. Spaces was removed

This is most likely caused by Remove accents from project title when used as filename while bundling for Android by britzl · Pull Request #8660 · defold/defold · GitHub

2 Likes

I think yes. Space is not in list of allowed symbols.
What you will be do with that? i think behavier should be consistent for all platforms.

For my cases it will be enough to add space in this list:)

But mb you need make this fix for folder names for all platforms not only for android?

So think about it:)

2 Likes

I agree with removing spaces in general from the bundled names. We can adapt with scripting anyway.

1 Like

Wow! :heart_eyes: Such great features! I can’t wait to check out Teal :heart:

1 Like

faced with some issue with 1.8.1 and spine extension 3.2.0 :face_with_monocle:

One proposition idea:

It would be great if Release Notes would also include links to teasers that you sometimes publish (and then they are sometimes lost in limbo), like for example, there was a teaser:

Or in this thread:

Or many other teasers, especially that those are with visuals, images, gifs or videos - or even if you share ones on Twitter - it’s worth linking them to the release notes later on as well, as ready examples of what you want to present :wink:

3 Likes

added repo case on GitHub! just like @AGulev taught me!

3 Likes

:blush:

The spine release was a bit of false advertisement - you need to use 1.8.2 (alpha currently) for it to work. The release have been updated to reflect this. Sorry for the inconvenience!

4 Likes

Thanks! :relaxed:

Is there any way to disable code highlighting?

  1. I often use code converted to LUA from other languages, and there the highlighting goes crazy.
  2. When editing code on Windows, code highlighting often goes astray.

All this creates an unpleasant inconvenience.

1 Like

Actually, is the type checking actually working?

I expected to get an error or something on type mismatch, but using the example on the extension site I get results:

print( greeter.greet( { t  = 1 } ) ) -- >> DEBUG:SCRIPT: Hello, table: 0x01fb9251b5e0!
print( greeter.greet(1) ) -- >> DEBUG:SCRIPT: Hello, 1!

So it automatically casts to string, both in Build and in Bundle (windows)

If you are calling greeter.greet from a .script file then the calling code is Lua not Teal hence it’s not subject to type checks.

1 Like