# Defold 1.3.1 BETA

**URL:** <https://forum.defold.com/t/defold-1-3-1-beta/70594>\
**Category:** Release notes\
**Created:** [March 22, 2022, 10:46am UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594 "2022-03-22T10:46:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [March 22, 2022, 10:46am UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/1 "2022-03-22T10:46:15Z")

</div>

# Defold 1.3.1 BETA

The latest beta is now released, and we invite those interested in beta testing the new features in the editor and engine to join now.  
The beta period will be 2 weeks and the next planned stable release is two weeks from now.

We hope this new workflow will highlight any issues earlier, and also get valuable feedback from our users. And please comment if you come up with ideas on improving on this new workflow.

Please report any engine issues in this thread or in [issues](https://github.com/defold/defold/issues) using Help → Report Issue

Thx for helping out!

## Disclaimer

This is a BETA release, and it might have issues that could potentially be disruptive for you and your teams workflow. Use with caution. Use of source control for your projects is strongly recommended.

## Access to the beta

Download the editor or bob.jar from [beta · Releases · defold/defold · GitHub](https://github.com/defold/defold/releases?q=beta&expanded=true)

Set your build server to [https://build-stage.defold.com](https://build-stage.defold.com)

## Release notes

## Improved timestep support ⚠

The biggest change this release is the improved support for the different timesteps between the game update loop and the physics update loop.

The goal is to have the game using vsync, and use the delta time between the display refreshes as the `dt` for the game loop.  
This will fix the issues we’ve seen with game running on displays with variable frame rates (or rates \> 60hz).

The `display.update_frequency` (default is 0) variable has changed somewhat, and is only limiting the frame rate if it’s lower than the current refresh rate of the display.  
E.g. it can be useful to limit the frequency to something low (like 30) to simulate the behavior of for instance a KaiOS device.

The fixed physics update is off by default, in order to stay compatible with the old behavior.

(More on the settings at the end of this post)

We’ve added a `fixed_update(self, dt)` life cycle function to the game object scripts.  
When using fixed timesteps for the physics, this is where you’ll want to add the forces to your game objects, in order to keep in sync with the physics updates.

⚠ After the requests and comments from the community, we’re confident that the new implementation is a good way forward.  
However, due to the nature of the implementation, it wasn’t possible to keep it 100% backwards compatible.  
We hope that the community can help test their project with this beta, and find and report any changes in behavior, so that we may discuss a way forward.

### Frustum culling

We’ve added support for frustum culling. In this initial version of the feature, it’s only used for sprites.  
Expected benefits are reduced vertex buffer sizes (saving GPU bandwidth), and reduced number of draw calls (depending on projects).

_EDIT 2022-03-23_: Frustum culling is enabled by default in the [default.render\_script](https://github.com/defold/defold/blob/dev/engine/engine/content/builtins/render/default.render_script#L77). If you have a custom render script, you need to create a frustum matrix, and pass it into your `render.draw()`calls.

### Floating point render targets

We’ve added support for floating point render targets on the devices that support them.  
The following constants are set if supported on the device and are otherwise nil if not supported:

```
* render.FORMAT_RGB16F
* render.FORMAT_RGB32F
* render.FORMAT_RGBA16F
* render.FORMAT_RGBA32F
* render.FORMAT_R16F
* render.FORMAT_RG16F
* render.FORMAT_R32F
* render.FORMAT_RG32F

```

# Engine

- [`Issue-6319`](https://github.com/defold/defold/issues/6319) - **Added** : Added support for creating floating point render targets
- [`Issue-6456`](https://github.com/defold/defold/issues/6456) - **Added** : Added frustum culling to default render script
- [`Issue-6460`](https://github.com/defold/defold/issues/6460) - **Added** : Added support for specifying fixed physics time steps
- [`Issue-6336`](https://github.com/defold/defold/issues/6336) - **Fixed** : Ignore focus lost/gain events for detection if app is in background (Android)
- [`Issue-6431`](https://github.com/defold/defold/issues/6431) - **Fixed** : Add all `android:configChanges` with requered API less or equal than 16
- [`Issue-6437`](https://github.com/defold/defold/issues/6437) - **Fixed** : Make sure particle fx duration doesn’t go below 0
- [`Issue-6440`](https://github.com/defold/defold/issues/6440) - **Fixed** : Reset key state when canvas focus is lost (HTML5)
- [`Issue-6445`](https://github.com/defold/defold/issues/6445) - **Fixed** : Add frustum culling support (currently sprites only)
- [`Issue-6447`](https://github.com/defold/defold/issues/6447) - **Fixed** : Correctly scale convex collision shapes in nested factory created game objects
- [`Issue-6452`](https://github.com/defold/defold/issues/6452) - **Fixed** : Improved error handling when using multiple tilemap collision objects in a single game object
- [`Issue-6453`](https://github.com/defold/defold/issues/6453) - **Fixed** : NE: Added dmGraphics api for querying the supported extensions
- [`Issue-6458`](https://github.com/defold/defold/issues/6458) - **Fixed** : Do not create animations for box nodes with one frame flipbook animations during gui scene creation
- [`Issue-6461`](https://github.com/defold/defold/issues/6461) - **Fixed** : Label alpha not always working properly in html5
- [`Issue-6464`](https://github.com/defold/defold/issues/6464) - **Fixed** : Game loop now uses display.update\_frequency to use variable/fixed frame rate
- [`Issue-6467`](https://github.com/defold/defold/issues/6467) - **Fixed** : Changed default value for wasm streaming
- [`Issue-6470`](https://github.com/defold/defold/issues/6470) - **Fixed** : Editor plugin restart message
- [`Issue-6472`](https://github.com/defold/defold/issues/6472) - **Fixed** : Bob doesn’t unpack plugin shared libraries unless they’ve changed
- [`Issue-6473`](https://github.com/defold/defold/issues/6473) - **Fixed** : Improved GUI property API reference
- [`Issue-6474`](https://github.com/defold/defold/issues/6474) - **Fixed** : Speed up building of script files
- [`Issue-6476`](https://github.com/defold/defold/issues/6476) - **Fixed** : Improved Bob exception reports (“resource cannot be null”)
- [`Issue-6478`](https://github.com/defold/defold/issues/6478) - **Fixed** : Editor: Added support for setting constant arrays
- [`Issue-6481`](https://github.com/defold/defold/issues/6481) - **Fixed** : Added support for component timestep

# Settings related to time steps

These are the relevant settings:

- `engine.fixed_update_frequency`

- `physics.use_fixed_timestep`

- `display.update_frequency` (integer)

- `display.swap_interval`

- ~~`display.vsync`~~ (DEPRECATED)

- Use the [sys.set\_update\_frequency(hz)](https://defold.com/ref/stable/sys/?q=set_update_frequency#sys.set_update_frequency:frequency) to control the “display.update\_frequency” at runtime.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 22, 2022, 1:17pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/2 "2022-03-22T13:17:23Z")

</div>



---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [March 22, 2022, 2:24pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/3 "2022-03-22T14:24:54Z")

</div>

An amazing set of updates 👏

> [@Mathias\_Westerdahl](#):
>
> - `physics.use_fixed_timestep`
> - boolean
> - `0` (false) is default
> - `0` means variable frame rate (default)
> - We recommend using `1` for new projects

Just curious, why is 1 the suggested value if 0 is the default?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [March 22, 2022, 2:27pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/4 "2022-03-22T14:27:41Z")

</div>

Backwards compatibility.  
Currently, the games use their “update()” function to add forces to their physics objects.  
When using fixed updates for physics, you need to move such code to the “fixed\_update()” function.

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [March 22, 2022, 4:01pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/5 "2022-03-22T16:01:59Z")

</div>

I can not download the beta editor:

[https://d.defold.com/archive/editor-alpha/487296f0e70e8f3c09d7f3e79673926bc8ee18ae/editor-alpha/editor2/Defold-x86\_64-win32.zip](https://d.defold.com/archive/editor-alpha/487296f0e70e8f3c09d7f3e79673926bc8ee18ae/editor-alpha/editor2/Defold-x86_64-win32.zip)

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/8/c/8cfde61c035d2447faa6da1400f9bb67a2c1f24a.png)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [March 22, 2022, 4:07pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/6 "2022-03-22T16:07:58Z")

</div>

Download it from Github:

> **[Release v1.3.1 - beta · defold/defold](https://github.com/defold/defold/releases/tag/1.3.1-beta)**
>
> Defold version 1.3.1 channel=beta sha1=06bc078e490fd7d94ec01e38abac989f6cc351a5 date='2022-04-01 09:18:23'

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [March 22, 2022, 5:19pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/7 "2022-03-22T17:19:31Z")

</div>

> [@Mathias\_Westerdahl](#):
>
> Expected benefits are reduced vertex buffer sizes (saving GPU bandwidth), and reduced number of draw calls (depending on projects).

I did a quick test (opened the project and made a screenshot of profiler in two places on the map (middle of the map in top row and far right in bottom row) in Witchcrafter, where several sprites of different atlases are + GUI is **not** drawn, I have a custom render script + no changes were made to project when switching editors) with 1.2.192 alpha, 1.3.0 alpha and 1.3.1 beta:

 ![Screenshot 2022-03-22 160337](https://forum-defold-uploads.b-cdn.net/original/3X/3/d/3d4d63c9fa1dc0a22a636c01649fe8f739821084.jpeg)

Could you please judge the results?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [March 22, 2022, 6:11pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/8 "2022-03-22T18:11:46Z")

</div>

Well, you didn’t seem to have much performance issues to begin with? The `Engine.Sim`taking ~ 2-3ms is virtually nothing.  
Sure there are a few draw calls, but not that many to be honest.

Let me ask you this, are you experiencing any performance issues?

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [March 22, 2022, 7:31pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/9 "2022-03-22T19:31:13Z")

</div>

I’m glad with current performance, I rather do not experience stuttering or lower fps at all, maybe sometimes testing on mobile. The fps sometimes drop when I trigger too much particles and there is already a lot of sprites in the screen (I also have still a design mistake, where particles remain enabled not in visible area e.g. fire is burning on other part of map and I try to do mayhem in the other 😁)

Since I couldn’t figure out proper Culling myself I started to design smaller maps and add loading screens between - I want to get rid of them and make bigger, open maps, so one part of this is to still load chunks of map asynchronously, but with possibly no stuttering while loading neighbouring chunk, other is to cull anything not visible.

---

<div class="post-metadata">

**Author:** ![coderm4ster](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@coderm4ster](https://forum.defold.com/u/coderm4ster)\
**Post date:** [March 23, 2022, 8:27am UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/10 "2022-03-23T08:27:54Z")

</div>

> [@Mathias\_Westerdahl](#):
>
> [`Issue-6447`](https://github.com/defold/defold/issues/6447) - **Fixed** : Correctly scale convex collision shapes in nested factory created game objects

I have several prototypes whose collision shapes consist of a multitude of convex polygons. In addition, they are nested multiple times. Scaling did not work well in version 1.3.0 even though Allow Dynamic Transforms is turned on in the project settings. In the 1.3.1 beta, however, everything is perfect. Thanks! 👍

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [March 23, 2022, 8:40am UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/11 "2022-03-23T08:40:09Z")

</div>

> [@Pawel](#):
>
> Could you please judge the results?

Just to make sure: Did you apply changes in your custom render\_script for culling?

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [March 23, 2022, 8:44am UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/12 "2022-03-23T08:44:41Z")

</div>

> [@AGulev](#):
>
> Did you apply changes in your custom render\_script for culling?

No - I did not change anything, even though I was pretty sure there must be something more to do 😃 I’m looking for the information on what should be changed

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [March 23, 2022, 8:53am UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/13 "2022-03-23T08:53:50Z")

</div>

Compare with the default.render\_script.  
I’ve updated the release notes with the relevant info.

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [March 23, 2022, 9:15am UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/14 "2022-03-23T09:15:16Z")

</div>

> [@Mathias\_Westerdahl](#):
>
> [`Issue-6431`](https://github.com/defold/defold/issues/6431) - **Fixed** : Add all `android:configChanges` with requered API less or equal than 16

There are also changes in the default `AndroidManifest.xml` file. I would recommend to apply the same changes in custom manifest devs use on their projects.

---

<div class="post-metadata">

**Author:** ![coderm4ster](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@coderm4ster](https://forum.defold.com/u/coderm4ster)\
**Post date:** [March 23, 2022, 10:15am UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/15 "2022-03-23T10:15:04Z")

</div>

I try frustum culling, but it doesn’t happen what I would expect.  
All I do is set up frustum based on:

```lua
local frustum = vmath.matrix4_frustum(100, render.get_window_width() - 100, 100, render.get_window_height() - 100, -1, 1)

```

Then this:

```lua
render.draw(self.tile_pred, { frustum = frustum })

```

So based on that, I would expect the sprites to render in an area smaller than the screen. But in the same way, they are rendered in full screen. Am I missing something or misinterpreting it?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [March 23, 2022, 10:24am UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/16 "2022-03-23T10:24:34Z")

</div>

Here’s en example of what I used in my tests:

```lua

        local view = vmath.matrix4_look_at(eye, eye+vmath.vector3(0,0,-1), vmath.vector3(0,1,0))
        local margin = 100
        local proj = vmath.matrix4_orthographic(margin, margin + render.get_width()-2*margin, margin, margin + render.get_height() - 2 * margin, -1, 1)
        frustum = proj * view

```

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [March 23, 2022, 12:34pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/17 "2022-03-23T12:34:20Z")

</div>

Now we’re talking! 😃 1.3.0 beta with passed frustum:

[UPDATED picture:]

 ![Screenshot 2022-03-23 121745](https://forum-defold-uploads.b-cdn.net/original/3X/f/5/f5420ddf311f78f0e48408f27a5f10a7d8bf89f8.jpeg)

Now the atlases could be optimized and I could have a huge map, with just a few draw calls and **really** decreased buffer!

---

<div class="post-metadata">

**Author:** ![coderm4ster](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@coderm4ster](https://forum.defold.com/u/coderm4ster)\
**Post date:** [March 23, 2022, 12:36pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/18 "2022-03-23T12:36:16Z")

</div>

Thanks Mathias! It works with vmath.matrix4\_ortoghraphic (weird because I thought I should use vmath.matrix\_frustum), but still not as I would expect.

I created a test project that includes 9 sprites as shown below. There is also a white frame showing the current position / size of the frustum. I start to reduce the size of the frustum dynamically. Sprites at the edge of the screen as the size of the frustum decreases disappear sooner than they should and then reappear later when they are outside the frustum boundary. Because of these, I would think culling isn’t perfect yet, but it could also be that I’m making a mistake.

[FrustumCullingTest.zip](https://forum.defold.com/uploads/short-url/fJq4VknwgTYu3YLA8PcG9G2sh9g.zip) (544.2 KB)

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/b/1/b11aa75ee398d2ccebc660162e788cd7e06e94ed.png)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [March 23, 2022, 12:43pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/19 "2022-03-23T12:43:04Z")

</div>

I don’t understand, did you swap the version numbers?  
I’d expect the lower vertex buffer size to be in the 1.3.1 beta?

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [March 23, 2022, 12:44pm UTC](https://forum.defold.com/t/defold-1-3-1-beta/70594/20 "2022-03-23T12:44:55Z")

</div>

Yes, good catch, there is a mistake on the bottom picture (I will correct it) 😃 the bottom picture is the same version - 1.3.1 beta! Comparing to my previous posts, results are way better!

[Next page](https://forum.defold.com/t/defold-1-3-1-beta/70594.md?page=2)
