Defold 1.2.165 has been released

Defold 1.2.165

First of all, I’d like to thank everyone that participated in the beta, it was extremely useful
to us and the rest of the users. Thank you!

This sprint we’ve added initial support for Sprite trimming, an often requested feature.
With it, you can minimize the polygon area of a sprite, leading to less overdraw of pixels.

We also fixed a potential issue with respect to ANRs (Android Not Responding) during shutdown of the sound engine. The end users might not have noticed the issue, but our developers have seen these issues in the Google console.

Another big step forward is our shift towards using Gradle for the dependency resolving for native extensions on Android phones. This will lead to easier maintenance and development going forward.

Engine

Engine

  • Issue-3153 - Added: Get the window size using window.get_size()
  • Issue-4577 - Added: Add engine licenses to builtins.zip
  • Issue-4350 - Added: Sprite trimming for atlases (Overdraw)
  • Issue-4585 - Fixed: HTTP request crash on Windows when offline
  • Issue-4566 - Fixed: Doing a msg.post() with nil as message generates an error
  • Issue-3119 - Fixed: Possible ANR caused by playing sounds on exit - Don’t wait for sound buffers on shutdown
  • Issue-4594 - Fixed: The project settings are now read before the library resolve is done in bob.jar
  • Issue-4591 - Fixed: Added new launch images for iPad Pro and iPhone XR+XS Max

Sprite trimming (pt 1)

In this first part of the sprite trimming feature, we have added internal support for
sprites made up of more than 2 triangles.

This first step is done in order to reduce sprite overdraw.
The feature allows you to configure an (auto generated) convex hull for atlas images.
You can choose between 4-8 vertices in the hull.

Due to batching, this feature affects the collection the sprite is in: If you enable trimming for one sprite in the collection, all other sprites are using it as well.

To disable the feature, set all images to SPRITE_TRIM_MODE_OFF (default).

Gui

This feature is implemented for Gui as well, but only for box nodes.
Also if the node has 9-slice enabled, the sprite trimming is disabled for that node.

Future

In the future, we will also use this info to pack the textures better into the atlas, greatly reducing the download sizes for the projects. We can then also support external 3rd party file formats.

Gradle dependency resolving

To ease the extension development for the Android platform, we’ve added support for Gradle dependency resolving.

To use this, add a file in your extension: <extension>/manifests/android/build.gradle
and add your dependencies in it. E.g.:

dependencies {
  // https://developers.google.com/android/guides/setup
  implementation 'com.google.android.gms:play-services-base:16.+'

  // https://developer.android.com/topic/libraries/support-library/packages
  implementation 'com.android.support:support-compat:26.+'
}

We’re currently using Gradle 6.

Examples:

Android resources

Since we don’t want to download all android resources from the build server to the client, we instead upload any client resources to the server.

Manifest merging

We now perform the manifest merging on the server due to the fact that each android dependency can contain a manifest stub.

Build result

In the build folder, after a successful cloud build, we now unpack the entire build.zip, making it easier for you to find the resulting files: executable, symbols, manifest files, resources files and the log file.

19 Likes
404 Not Found
Code: NoSuchKey
Message: The specified key does not exist.
Key: archive/a6a088b1dfc1e67a13121bacd8cfca1b668c31c0/stable/editor2/Defold-x86_64-win32.zip
RequestId: BD93C4452BB0FE1B
HostId: UY+GnYmQGz+bU8gLhx7NrPm8lajfZxuBoPXW4lJvmS6aIpU6EOUOnD8fp4G0kHuec8lBglAOzqA=

Hi @filazopovich!
What link did you press to get that error?
I see that both the Win32/Linux builds are missing from d.defold.com.
We’re on it!

1 Like

We’ve now fixed the download links (and the new stable engine sha1 is a64dbc57f30cbb40c47210481ab37e738f7d9212)

1 Like

Downloaded from here on Mac:
http://d.defold.com/stable/

And get this error:
25

1 Like

Has anyone tested profiling this? I would assume 8 would be better almost always.

Other than reducing texture size, will this have an impact on performance? Trying to read up on pixel overdraw and it seems to have to do with rendering transparent pixels and that being an unnecessary cost. Is that right?

I have loads of sprites, I assume flipping the switch on just one of them (triggering the batching for the collection) is the same as updating them all?

Which macOS version are you using?

Initially there will be no reduction in texture size. We do not use the sprite trimming data when packing the texture. The texture will still pack images using their rectangular area.

The feature is however enabled at runtime and it can in some cases have a very positive impact on performance since fewer pixels are processed by the shaders and the GPU.

1 Like

Workaround is to set the executable flag on the Defold exe and on the bundled java:

chmod +x /Applications/Defold.app/Contents/MacOS/Defold
chmod +x /Applications/Defold.app/Contents/Resources/packages/jdk11.0.1/bin/java

We’ll push a new version which fixes this.

2 Likes

This is part 1, it does not affect the texture size.
It affects the polygon shape of the sprite. Previously you always had a quad, now you can have a hull.
This can improve performance if you have a sprite with a lot of 100% transparent pixels (i.e. reduced overdraw).
oops, saw now that britzl already answered this

I have loads of sprites, I assume flipping the switch on just one of them (triggering the batching for the collection) is the same as updating them all?

You set the switch on either a tilesource, or an image in an atlas. If it’s enabled for a sprite, all sprites in that collection will use the new code path. For those that doesn’t have trimming turned on, they will still have a quad shape. You can verify this by setting your transparent pixels to something non-transparent (e.g. adding (0.1,0.1,0.1,0.1) to the output)

3 Likes

Thanks, I’m in!

Edit: I spoke too soon. Now I get this from a blank project:

Where can I download a functional version of v1.2.165?

We have now uploaded a new version (engine sha1 aec0dc0171140cba335bfa8c5afcc15b865c9bbe) on d.defold.com (channel: stable).

The editor (channel editor-alpha) is currently building, and will be ready in ~30 minutes.

1 Like

What does this return exactly? Was expecting a vector or a table with width/height items, but it seems to be returning a single value (e.g. 0 or 1280).

Also, can this be called from init()? Tried that and it returns zero there?

1 Like

It returns a 2-tuple:

width, height = window.get_size()

Documentation:

window.get_size():

This returns the current window size (width and height).
@name window.get_size
@return width [type:number] The window width
@return height [type:number] The window height

Not sure why the documentation page wasn’t updated, we’ll look into that

4 Likes

Ok thanks. However, it doesn’t seem to work consistently.

  1. On HTML5 (Project / Build HTML5), I get the proper windows/height values.
  2. From the editor (Project/Build), I get a (0,0) instead.

Is this expected behavior? I’m calling it from init function.

I downloaded this version (confirmed sha1), I will be on 1.2.165. Then the editor says there is an update available, and when I update and restart, I will be back on 1.2.164. Using Windows 10 here, stable channel. Is there an editor update as well for the stable channel?

The update option does not appear on Windows 10 with version 1.2.164

image